Skip to content

refactor: use configurable running service for Python integration tests#2186

Open
chenba wants to merge 1 commit intomasterfrom
refactor/no-conftest-servers-stor-511
Open

refactor: use configurable running service for Python integration tests#2186
chenba wants to merge 1 commit intomasterfrom
refactor/no-conftest-servers-stor-511

Conversation

@chenba
Copy link
Copy Markdown
Collaborator

@chenba chenba commented Apr 2, 2026

Instead of configuring and starting server instances within Python as test fixtures, simply testing against a running server. A mix of make target and docker-compose changes is used to achieve the same level of test coverage that previously relied on the (re-)configure and (re-)start of the services in conftest.py.

A new make target, 'run_local_e2e_tests', can be used to run the integration tests locally. However, the stage FxA JWT validation tests in test_e2e.py are excluded. Those tests rely on the JWK configuration of the Token Server and the stage FxA API, making them less "local". Anyone working on that specific integration can certainly invoke those tests themselves.

This patch also:

  • deletes some duplicate docs
  • moves the docker-compose yamls into a dir named 'docker'

Closes STOR-511

-f docker-compose.e2e.mysql.yaml \
-f docker/docker-compose.mysql.yaml \
-f docker/docker-compose.e2e.mysql.yaml \
-f docker/docker-compose.e2e.mysql.no-jwk-cache.yaml \
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we cannot unset env vars with docker-compose, the order here matters, which is why we unset JWK env vars from the invoking shell and run the tests with no local JWKs, and then set the JWK env vars for the tests that follow.

SYNC_TOKENSERVER__FXA_OAUTH_SERVER_URL=$${SYNC_TOKENSERVER__FXA_OAUTH_SERVER_URL:-http://localhost:6000} \
TOKENSERVER_HOST=$${TOKENSERVER_HOST:-http://localhost:8000} \
poetry -C tools/integration_tests \
run pytest . --ignore=tokenserver/test_e2e.py
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming is hard. e2e for the make target here is consistent with the docker-compose based tests but kinda amusing we are skipping a file named test_e2e.

PYTHONPATH=$(PWD)/tools \
SYNC_MASTER_SECRET=$${SYNC_MASTER_SECRET:-secret0} \
SYNC_TOKENSERVER__FXA_OAUTH_SERVER_URL=$${SYNC_TOKENSERVER__FXA_OAUTH_SERVER_URL:-http://localhost:6000} \
TOKENSERVER_HOST=$${TOKENSERVER_HOST:-http://localhost:8000} \
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we support multiple db backends, I did not include default db urls here.

@chenba chenba force-pushed the refactor/no-conftest-servers-stor-511 branch 3 times, most recently from 5e89100 to 639b79e Compare April 2, 2026 21:13
Instead of configuring and starting server instances within Python as
test fixtures, simply testing against a running server.  A mix of make
target and docker-compose changes is used to achieve the same level of
test coverage that previously relied on the (re-)configure and
(re-)start of the services in conftest.py.

A new `make` target, 'run_local_e2e_tests', can be used to run the
integration tests locally.  However, the stage FxA JWT validation tests
in test_e2e.py are excluded.  Those tests rely on the JWK configuration
of the Token Server and the stage FxA API, making them less "local".
Anyone working on that specific integration can certainly invoke those
tests themselves.

This patch also:
 - deletes some duplicate docs
 - moves the docker-compose yamls into a dir name 'docker'
@chenba chenba force-pushed the refactor/no-conftest-servers-stor-511 branch from 639b79e to 00698c2 Compare April 2, 2026 22:44
@chenba chenba requested review from pjenvey and taddes April 2, 2026 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant