blob: e932a3d4bc17a0d4f465668ba3c66d59d3f76aad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
# gn-integration-tests
Integration and end-to-end tests for the GeneNetwork stack
([gn2](https://github.com/genenetwork/genenetwork2),
[gn3](https://git.genenetwork.org/genenetwork3),
[gn-auth](https://git.genenetwork.org/gn-auth)).
Tests run against a live deployment (CD or production) — no mocking, no
local stack required for the smoke suite.
## Quick start
```sh
pip install -e . # or: pip install requests pytest
pytest -m "smoke" # run all smoke tests (no credentials needed)
```
By default tests target **CD** (`cd.genenetwork.org` / `auth-cd.genenetwork.org`).
Override with environment variables:
| Variable | Default | Description |
|---|---|---|
| `GN2_BASE_URL` | `https://cd.genenetwork.org` | genenetwork2 root |
| `GN3_BASE_URL` | `https://cd.genenetwork.org/api3` | gn3 API proxy path |
| `GN_AUTH_BASE_URL` | `https://auth-cd.genenetwork.org` | gn-auth server |
To target **production**:
```sh
GN2_BASE_URL=https://genenetwork.org \
GN3_BASE_URL=https://genenetwork.org/api3 \
GN_AUTH_BASE_URL=https://auth.genenetwork.org \
pytest -m "smoke"
```
The three variables work for **any deployment** — CD, production, or a
personal/feature instance. To run against an arbitrary stack, just point
the variables at it:
```sh
GN2_BASE_URL=https://gn2-fred.genenetwork.org \
GN3_BASE_URL=https://gn2-fred.genenetwork.org/api3 \
GN_AUTH_BASE_URL=https://gn2-fred-auth.genenetwork.org \
pytest -m "smoke"
```
No test-code changes are needed — all URL configuration lives in `conftest.py`.
## Test marks
| Mark | Description |
|---|---|
| `smoke` | Public endpoints, no credentials, fast |
| `gn2` | Tests targeting genenetwork2 |
| `gn3` | Tests targeting the gn3 REST API |
| `gn_auth` | Tests targeting gn-auth |
| `auth_flow` | Requires valid test-user credentials (see below) |
Run a specific service:
```sh
pytest -m "gn_auth and smoke"
pytest -m "gn3 and smoke"
pytest -m "gn2 and smoke"
```
## Auth-flow tests (Phase 2)
Set the following environment variables to enable credential-backed tests:
```sh
export GN_TEST_EMAIL=testuser@example.com
export GN_TEST_PASSWORD=secret
export GN_OAUTH2_CLIENT_ID=<uuid>
export GN_OAUTH2_CLIENT_SECRET=<secret>
pytest -m "auth_flow"
```
Without these variables the `auth_flow` tests are automatically skipped.
## CI integration (planned)
Each component repo's CI triggers only its relevant mark after a successful
per-repo build:
- genenetwork2 CI → `pytest -m gn2`
- genenetwork3 CI → `pytest -m gn3`
- gn-auth CI → `pytest -m gn_auth`
Target: `cd.genenetwork.org` before merges; nightly against production.
## URL structure notes
nginx on the deployment host rewrites `/api3/<path>` → `/api/<path>` before
proxying to gn3, and gn-auth lives on a separate subdomain:
```
https://cd.genenetwork.org/ → gn2
https://cd.genenetwork.org/api3/ → gn3 (/api3/foo → gn3's /api/foo)
https://auth-cd.genenetwork.org/ → gn-auth
https://genenetwork.org/ → gn2 (production)
https://genenetwork.org/api3/ → gn3 (production)
https://auth.genenetwork.org/ → gn-auth (production)
```
|