Skip to content

Commit 1eed8c7

Browse files
committed
Update documentation for tests with dependencies
1 parent 72a0e8a commit 1eed8c7

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

docs/development.md

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Follow the steps below to configure the necessary settings.
5151
NMDC_SESSION_SECRET_KEY=changeme
5252
NMDC_API_JWT_SECRET=changeme
5353
```
54-
54+
5555
### NERSC Credentials
5656

5757
To load production data or to run an ingest locally, you will need NERSC credentials.
@@ -78,13 +78,13 @@ Google Cloud Storage (GCS) is used to store images associated with Submission Po
7878

7979
Whether you use the real or fake GCS server, you will need to set up authentication. The recommended way to do this is to use Application Default Credentials (ADC) with service account impersonation. Service account impersonation is required for generating signed URLs for uploading/downloading images directly to/from GCS.
8080

81-
1. Ask a team member with the necessary GCS permissions to associate your Google Cloud account with the NMDC Google Cloud project and service account.
81+
1. Ask a team member with the necessary GCS permissions to associate your Google Cloud account with the NMDC Google Cloud project and service account.
8282
2. Install the Google Cloud Command Line Interface (CLI) by following the instructions at https://cloud.google.com/sdk/docs/install.
8383
3. Run the following command to set up Application Default Credentials (ADC):
8484
```bash
8585
gcloud auth application-default login --impersonate-service-account <service account email will be provided by team member>
8686
```
87-
87+
8888
You also must generate a local object name prefix. This prefix is used to differentiate which system uploaded to the shared GCS bucket. Local development systems should use the prefix `local_<random_suffix>`.
8989

9090
1. Generate a random suffix using the following command:
@@ -166,7 +166,7 @@ Although the project is designed to be run in Docker, having the dependencies in
166166
source .venv/bin/activate
167167
pip install -e .
168168
```
169-
169+
170170
### Frontend dependencies
171171
172172
1. Install the frontend dependencies.
@@ -182,7 +182,7 @@ Run the full stack via Docker Compose:
182182
<!-- TODO: Consider adding `--build` to this command so that Docker Compose builds
183183
the containers, rather than pulling from from GHCR (unless you
184184
want to use the versions that happen to currently be on GHCR).
185-
This has to do with the fact that the `docker-compose.yml` file
185+
This has to do with the fact that the `docker-compose.yml` file
186186
contains service specs having both an `image` and `build` section. -->
187187
188188
```bash
@@ -220,16 +220,16 @@ yarn serve
220220
<details>
221221
<summary>Running yarn via npx?</summary>
222222
223-
When you run `$ npx yarn serve` while using a Node.js version newer than 17, the frontend development server may fail to start and may, instead, display the error code "`ERR_OSSL_EVP_UNSUPPORTED`".
223+
When you run `$ npx yarn serve` while using a Node.js version newer than 17, the frontend development server may fail to start and may, instead, display the error code "`ERR_OSSL_EVP_UNSUPPORTED`".
224224
225-
You can work around that error by prefixing the command with "`NODE_OPTIONS=--openssl-legacy-provider`", as explained [here](https://stackoverflow.com/a/70582385) and shown below:
225+
You can work around that error by prefixing the command with "`NODE_OPTIONS=--openssl-legacy-provider`", as explained [here](https://stackoverflow.com/a/70582385) and shown below:
226226
227227
```bash
228228
NODE_OPTIONS=--openssl-legacy-provider npx yarn serve
229229
```
230230
</details>
231231
232-
View the main application at `http://127.0.0.1:8081/`. Changes to files in the `web` directory will automatically trigger a reload in your browser.
232+
View the main application at `http://127.0.0.1:8081/`. Changes to files in the `web` directory will automatically trigger a reload in your browser.
233233
234234
> **Note**: An instance of the frontend application will continue to be served via Docker Compose on port `8080`, but that instance will not pick up changes to the `web` directory automatically. Be aware of which port you are accessing when doing frontend development.
235235
@@ -241,7 +241,7 @@ It is recommended to use `127.0.0.1` instead of `localhost` for local developmen
241241
242242
> **Note**: This is not generally required unless you are specifically working on the ingest code. If you are working on the web application, simply [loading from a recent production backup](#load-production-data) is sufficient.
243243
244-
1. Ensure that you have completed the sections above about configuring your [NERSC credentials](#nersc-credentials) and [MongoDB credentials](#mongodb-credentials).
244+
1. Ensure that you have completed the sections above about configuring your [NERSC credentials](#nersc-credentials) and [MongoDB credentials](#mongodb-credentials).
245245
2. Obtain a new SSH key from NERSC if you haven't done so in the last 24 hours.
246246
```bash
247247
sshproxy.sh -u $NERSC_USER
@@ -258,8 +258,8 @@ It is recommended to use `127.0.0.1` instead of `localhost` for local developmen
258258
-i ~/.ssh/nersc \
259259
dtn01.nersc.gov
260260
```
261-
> That command will set up SSH port forwarding such that your computer can access the dev MongoDB server at `localhost:37018` and the prod MongoDB server at `localhost:37019`.
262-
261+
> That command will set up SSH port forwarding such that your computer can access the dev MongoDB server at `localhost:37018` and the prod MongoDB server at `localhost:37019`.
262+
263263
> From within a Docker container `host.docker.internal` can be used to access the `localhost` of your computer. When ingesting from the dev or prod MongoDB instances, be sure to set `NMDC_MONGO_HOST=host.docker.internal` in your `.env` file.
264264
265265
> See https://github.com/microbiomedata/infra-admin/blob/main/mongodb/connection-guide.md (internal) for more information on connecting to the MongoDB instances.
@@ -275,7 +275,7 @@ It is recommended to use `127.0.0.1` instead of `localhost` for local developmen
275275
```bash
276276
docker-compose run backend nmdc-server ingest -vv --function-limit 100
277277
```
278-
278+
279279
> **Note**: The `--function-limit` flag is optional. It is used to reduce the time that the ingest takes by limiting the number of certain types of objects loaded. This can be useful for testing purposes. For more information on options run `nmdc-server ingest --help`.
280280
281281
## Testing
@@ -284,6 +284,19 @@ It is recommended to use `127.0.0.1` instead of `localhost` for local developmen
284284
tox
285285
```
286286
287+
In order for the `py312` test suite to run properly, it needs to be able to communicate with a running `postgres` server and the fake GCS service. You can use the docker configuration to get these services up and running:
288+
289+
```bash
290+
docker compose up db storage
291+
```
292+
293+
You'll also need to set environment variables so the tests know where these resources can be found. If you're running the services via `docker compose`, then you can use the following values:
294+
295+
```bash
296+
export NMDC_TESTING_DATABASE_URI=postgresql://postgres:postgres@localhost:5432/nmdc_testing
297+
export NMDC_GCS_FAKE_API_ENDPOINT=http://localhost:4443
298+
```
299+
287300
## Generating new migrations
288301
289302
```bash

0 commit comments

Comments
 (0)