Skip to content

Commit 573415b

Browse files
authored
PHPC-2074: Document test suite env vars and revise Mongo Orchestration notes (#1307)
1 parent d403023 commit 573415b

File tree

1 file changed

+34
-30
lines changed

1 file changed

+34
-30
lines changed

CONTRIBUTING.md

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -89,38 +89,42 @@ run in as many environments as possible. To paraphrase the
8989
Consider that a well-crafted `EXPECTF` section may allow a `SKIPIF` section to
9090
be less restrictive.
9191

92-
### Local Mongo Orchestration (and CI platforms)
93-
94-
The test suite depends on [Mongo Orchestration](https://github.com/10gen/mongo-orchestration).
95-
Mongo Orchestration is an HTTP server that provides a REST API for maintaining
96-
MongoDB configurations. These configurations are provided by the
92+
### Environment Variables
93+
94+
The test suite references the following environment variables:
95+
96+
* `MONGODB_URI`: Connection string. Defaults to `mongodb://127.0.0.1/`, which
97+
assumes a MongoDB server is listening localhost port 27017.
98+
* `MONGO_ORCHESTRATION_URI`: API endpoint for Mongo Orchestration. Defaults to
99+
`http://localhost:8889/v1`. This is only used by a few tests that start
100+
temporary servers, and those tests will be skipped if Mongo Orchestration is
101+
inaccessible.
102+
* `MONGODB_DATABASE`: Default database to use in tests. Defaults to `phongo`.
103+
* `SSL_DIR`: Path to directory containing certificate files. On Evergreen, this
104+
will be set to the
105+
[.evergreen/x509gen](https://github.com/mongodb-labs/drivers-evergreen-tools/tree/master/.evergreen/x509gen)
106+
directory within
107+
[drivers-evergreen-tools](https://github.com/mongodb-labs/drivers-evergreen-tools).
108+
If undefined or inaccessible, tests requiring certificates will be skipped.
109+
* `API_VERSION`: If defined, this value will be used to construct a
110+
[`MongoDB\Driver\ServerApi`](https://www.php.net/manual/en/mongodb-driver-serverapi.construct.php),
111+
which will then be specified as the `serverApi` driver option for
112+
[`MongoDB\Driver\Manager`](https://www.php.net/manual/en/class.mongodb-driver-manager.php)
113+
objects created by the test suite.
114+
115+
### Mongo Orchestration
116+
117+
[Mongo Orchestration](https://github.com/10gen/mongo-orchestration) is an HTTP
118+
server that provides a REST API for managing MongoDB servers and clusters.
119+
Evergreen CI and GitHub Actions use configurations provided by the
97120
[drivers-evergreen-tools](https://github.com/mongodb-labs/drivers-evergreen-tools)
98-
repository. These configurations can be run locally. Alternatively, you can use
99-
the GitHub Actions workflow if you don't want to set up a local development
100-
environment.
101-
102-
Mongo Orchestration expects that the ``mongod`` (and ``mongos``) binaries are
103-
available in the ``PATH``.
104-
105-
Once installed, Mongo Orchestration can be started with
106-
107-
```
108-
~/.local/bin/mongo-orchestration start --no-fork --enable-majority-read-concern
109-
```
121+
repository. These configurations are loaded by Mongo Orchestration, which then
122+
provides a connection string to assign to `MONGODB_URI` and run the test suite.
123+
Additionally, some tests start temporary servers and interact directly with
124+
Mongo Orchestration (via `MONGO_ORCHESTRATION_URI`).
110125

111-
The test suite uses the ``MONGODB_URI`` environment variable as connection
112-
string to run all tests. If not set, tests assume MongoDB is listening on the
113-
default MongoDB port (27017) on localhost.
114-
115-
With this set-up, the tests can be run with `make test`.
116-
117-
If Mongo Orchestration is running on non-default settings, the
118-
``MONGO_ORCHESTRATION_URI`` environment variable can be used to specify where
119-
mongo-orchestration is listening:
120-
121-
```
122-
MONGO_ORCHESTRATION_URI=http://localhost:1234/v1 make test
123-
```
126+
For local development, running Mongo Orchestration is not required and it is
127+
generally sufficient to test against a single-node replica set.
124128

125129
## Updating libmongoc, libbson, and libmongocrypt
126130

0 commit comments

Comments
 (0)