Skip to content

Commit

Permalink
Merge branch 'main' into simple-todos-meteor
Browse files Browse the repository at this point in the history
  • Loading branch information
b1ron authored Nov 10, 2023
2 parents 81e74a3 + 502b712 commit 0580d88
Show file tree
Hide file tree
Showing 10 changed files with 98 additions and 91 deletions.
48 changes: 31 additions & 17 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Contributing

The dance tool and tests run on the host; macOS, Linux, and Windows are expected to work.
Databases under test (FerretDB and MongoDB) may be running on the host or inside Docker; Docker Compose configuration is provided for convenience but not required.
In particular, the FerretDB development cycle (fix-compile-run-dance) is faster with it running on the host as it does not involve Docker image building or PostgreSQL restarts.
Databases under test (FerretDB and MongoDB) may be running on the host or inside Docker;
Docker Compose configuration is provided for convenience but not required.
In particular, the FerretDB development cycle (fix-compile-run-dance) is faster with it running on the host
as it does not involve Docker image building or PostgreSQL restarts.
Running FerretDB on the host is recommended for that reason.

## Cloning repository
Expand All @@ -23,14 +25,14 @@ to include required submodules.
## Running tests

```sh
bin/task dance DB=ferretdb TEST=mongo-go-driver
bin/task dance DB=postgresql TEST=mongo-go-driver
```

That command will run `mongo-go-driver` tests against FerretDB.
`DB` environment variable should have the value `ferretdb` or `mongodb`.
That command will run `mongo-go-driver` tests against FerretDB with PostgreSQL backend.
`DB` environment variable should have the value `postgresql`, `sqlite`, or `mongodb`.
It defines what tests are expected to pass and fail.
For example, see [mongo-go-driver tests configuration](https://github.com/FerretDB/dance/blob/main/tests/mongo-go-driver.yml) (fields under `results.ferretdb` and `results.mongodb`).
`TEST` environment variable should have the value `mongo-go-driver`, or be empty.
For example, see [mongo-go-driver tests configuration](https://github.com/FerretDB/dance/blob/main/tests/mongo-go-driver.yml).
`TEST` environment variable should have the value matching a YAML file in the `tests` directory, or be empty.
It defines what test configuration to run; empty value runs all configurations.

## Starting environment with Docker Compose
Expand All @@ -40,17 +42,25 @@ bin/task env-up DB=mongodb
```

That command will start MongoDB in Docker container.
Please note that running `bin/task dance DB=ferretdb` after that would run tests against that MongoDB, but results would be compared against results expected for FerretDB.
Please note that running `bin/task dance DB=postgresql` after that would run tests against that MongoDB,
but results would be compared against results expected for FerretDB.
In short, that would be wrong.

```sh
bin/task env-up DB=ferretdb
bin/task env-up DB=postgresql
```

That command will start FerretDB from `ferretdb-local` Docker image.
or

```sh
bin/task env-up DB=sqlite
```

That command will start FerretDB with a specified backend from `ferretdb-local` Docker image.

To build a local image use the `bin/task docker-local` command in the [FerretDB](https://github.com/FerretDB/FerretDB) repository.
To use a pre-built image you must set the `FERRETDB_IMAGE` environment variable, e.g. `export FERRETDB_IMAGE=ghcr.io/ferretdb/ferretdb-dev:main`.
To use a pre-built image you must set the `FERRETDB_IMAGE` environment variable,
e.g. `export FERRETDB_IMAGE=ghcr.io/ferretdb/ferretdb-dev:main`.

As mentioned above, this approach is not recommended.

Expand All @@ -61,11 +71,15 @@ The `command` runner will invoke any command and CLI arguments.

For example if you wanted to add your Java application to dance, you would do the following:

1. Add the submodule to the `tests` directory `git submodule add https://github.com/my-org/my-app.git`.
2. Create a shell script in the `tests` directory called `my-app-runtime.sh` with the required logic needed to run your test.
3. Create a YAML file called `my-app.yml` in the `tests` directory and provide the `args` field with the shell script so that the runner can invoke it.
4. Start the environment and test it locally before submitting a PR to ensure that it works correctly. Refer to the above [section](https://github.com/FerretDB/dance/blob/main/CONTRIBUTING.md#starting-environment-with-docker-compose) on how to start the environment.
5. Run the test locally to verify the output `bin/task dance DB=ferretdb TEST=my-app`.
1. Add the submodule to the `tests` directory `git submodule add -b main https://github.com/my-org/my-app.git`.
2. Create a shell script in the `tests` directory called `my-app.sh` with the required logic needed to run your test.
3. Create a YAML file called `my-app.yml` in the `tests` directory
and provide the `args` field with the shell script so that the runner can invoke it.
4. Start the environment and test it locally before submitting a PR to ensure that it works correctly.
Refer to the above [section](#starting-environment-with-docker-compose)
on how to start the environment.
5. Run the test locally to verify the output `bin/task dance DB=postgresql TEST=my-app`.
6. Submit a PR to with a title of the form "Add MyApp tests".

See an example [shell script](https://github.com/FerretDB/dance/blob/main/tests/java-example.sh) and [YAML](https://github.com/FerretDB/dance/blob/main/tests/java-example.yml) file.
See an example [shell script](https://github.com/FerretDB/dance/blob/main/tests/java-example.sh)
and [YAML](https://github.com/FerretDB/dance/blob/main/tests/java-example.yml) files.
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@
FerretDB integration testing tool named after [Ferret war dance](https://en.wikipedia.org/wiki/Weasel_war_dance).
It runs integration tests of various software that uses MongoDB
(such as [MongoDB Go driver](https://github.com/mongodb/mongo-go-driver))
against both MongoDB and FerretDB,
against both MongoDB and FerretDB with various backends,
and compares results with ones expected by tests configurations.
It also runs [mongo tooling](https://github.com/mongodb/mongo-tools) such as `mongodump` against both of them,
to make sure that we provide various functionalities and provide the best user experience.
It is expected that most or all tests pass when run against MongoDB,
so we mark a few or none tests as expected failures or skips in configuration.
More tests fail (and are marked as expected failures in tests configuration) when run against FerretDB,
but their number goes down over time.

Dance also includes one additional set of integration tests (called `diff`) that is written by FerretDB developers.
It highlights the known differences between FerretDB and MongoDB,
as [noted in documentation](https://docs.ferretdb.io/diff/).
All failing or skipping tests should have comments with explanation, typically a GitHub issue URL.

See [CONTRIBUTING.md](CONTRIBUTING.md) for running instructions.
2 changes: 1 addition & 1 deletion build/deps/ferretdb-textlint.Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM ghcr.io/ferretdb/ferretdb-textlint:13.3.3-2
FROM ghcr.io/ferretdb/ferretdb-textlint:13.3.3-3
2 changes: 1 addition & 1 deletion build/deps/postgres.Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM postgres:15.3
FROM postgres:16.0
4 changes: 1 addition & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
version: "3.8"

services:
postgresql:
image: ${FERRETDB_IMAGE:-ferretdb-local}
Expand Down Expand Up @@ -96,7 +94,7 @@ services:
working_dir: /tests/mongo
volumes:
- ./tests/mongo:/tests/mongo

# for documentation
textlint:
build:
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ require (
github.com/pmezard/go-difflib v1.0.0
github.com/sethvargo/go-githubactions v1.1.0
github.com/stretchr/testify v1.8.4
go.mongodb.org/mongo-driver v1.12.1
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
golang.org/x/sys v0.13.0
go.mongodb.org/mongo-driver v1.13.0
golang.org/x/exp v0.0.0-20231108232855-2478ac86f678
golang.org/x/sys v0.14.0
gopkg.in/yaml.v3 v3.0.1
)

Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gi
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA=
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.mongodb.org/mongo-driver v1.12.1 h1:nLkghSU8fQNaK7oUmDhQFsnrtcoNy7Z6LVFKsEecqgE=
go.mongodb.org/mongo-driver v1.12.1/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ=
go.mongodb.org/mongo-driver v1.13.0 h1:67DgFFjYOCMWdtTEmKFpV3ffWlFnh+CYZ8ZS/tXWUfY=
go.mongodb.org/mongo-driver v1.13.0/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
golang.org/x/exp v0.0.0-20231108232855-2478ac86f678 h1:mchzmB1XO2pMaKFRqk/+MV3mgGG96aqaPXaMifQU47w=
golang.org/x/exp v0.0.0-20231108232855-2478ac86f678/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
Expand All @@ -49,8 +49,8 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
2 changes: 1 addition & 1 deletion tests/enmeshed-runtime
32 changes: 16 additions & 16 deletions tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ go 1.21
require (
github.com/BurntSushi/go-sumtype v0.0.0-20221020234012-480526a59796
github.com/go-task/task/v3 v3.31.0
github.com/golangci/golangci-lint v1.55.0
github.com/golangci/golangci-lint v1.55.2
github.com/pingcap/go-ycsb v1.0.1
github.com/quasilyte/go-consistent v0.6.0
golang.org/x/perf v0.0.0-20231006134539-cd219cffda85
golang.org/x/tools v0.14.0
golang.org/x/perf v0.0.0-20231108231503-cb71e802ccb8
golang.org/x/tools v0.15.0
golang.org/x/vuln v1.0.1
mvdan.cc/gofumpt v0.5.0
)
Expand Down Expand Up @@ -73,7 +73,7 @@ require (
github.com/bombsimon/wsl/v3 v3.4.0 // indirect
github.com/breml/bidichk v0.2.7 // indirect
github.com/breml/errchkjson v0.3.6 // indirect
github.com/butuzov/ireturn v0.2.1 // indirect
github.com/butuzov/ireturn v0.2.2 // indirect
github.com/butuzov/mirror v1.1.0 // indirect
github.com/catenacyber/perfsprint v0.2.0 // indirect
github.com/ccojocar/zxcvbn-go v1.0.1 // indirect
Expand Down Expand Up @@ -136,10 +136,10 @@ require (
github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 // indirect
github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca // indirect
github.com/golangci/misspell v0.4.1 // indirect
github.com/golangci/revgrep v0.5.0 // indirect
github.com/golangci/revgrep v0.5.2 // indirect
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/s2a-go v0.1.4 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
Expand Down Expand Up @@ -198,7 +198,7 @@ require (
github.com/nakabonne/nestif v0.3.1 // indirect
github.com/nishanths/exhaustive v0.11.0 // indirect
github.com/nishanths/predeclared v0.2.2 // indirect
github.com/nunnatsa/ginkgolinter v0.14.0 // indirect
github.com/nunnatsa/ginkgolinter v0.14.1 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
Expand Down Expand Up @@ -226,7 +226,7 @@ require (
github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect
github.com/sashamelentyev/interfacebloat v1.1.0 // indirect
github.com/sashamelentyev/usestdlibvars v1.24.0 // indirect
github.com/securego/gosec/v2 v2.18.1 // indirect
github.com/securego/gosec/v2 v2.18.2 // indirect
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sivchari/containedctx v1.0.3 // indirect
Expand Down Expand Up @@ -283,16 +283,16 @@ require (
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/crypto v0.15.0 // indirect
golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect
golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/sync v0.4.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/oauth2 v0.14.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/term v0.14.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.126.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand Down
Loading

0 comments on commit 0580d88

Please sign in to comment.