mirror of
https://github.com/mozilla-services/syncstorage-rs.git
synced 2026-05-16 01:56:38 +02:00
* refactor: use configurable running service for Python integration tests 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' * Apply suggestion from @pjenvey Co-authored-by: Philip Jenvey <pjenvey@underboss.org> * Apply suggestion from @pjenvey Co-authored-by: Philip Jenvey <pjenvey@underboss.org> * Clean-up based on feedback. * Remove integration_tests/conftest.py * Prune yamls --------- Co-authored-by: Philip Jenvey <pjenvey@underboss.org>
88 lines
2.9 KiB
YAML
88 lines
2.9 KiB
YAML
services:
|
|
sync-db:
|
|
# Getting sporadic errors in spanner.
|
|
# These errors are "INTERNAL: ZETASQL_RET_CHECK failure"
|
|
# in the `backend/query/query_engine.cc` file for spanner.
|
|
# These result in a 500 error, which causes the test to fail.
|
|
# I believe come from the SQL parser, but am not sure. I am
|
|
# unable to produce these errors locally, and am using the cited
|
|
# version.
|
|
image: gcr.io/cloud-spanner-emulator/emulator:1.5.13
|
|
ports:
|
|
- "9010:9010"
|
|
- "9020:9020"
|
|
environment:
|
|
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
sync-db-setup:
|
|
image: app:build
|
|
depends_on:
|
|
- sync-db
|
|
restart: "no"
|
|
entrypoint:
|
|
- /bin/sh
|
|
- -c
|
|
- /app/scripts/prepare-spanner.sh && sleep infinity
|
|
environment:
|
|
SYNC_SYNCSTORAGE__SPANNER_EMULATOR_HOST: sync-db:9020
|
|
tokenserver-db:
|
|
image: docker.io/library/mysql:8.0
|
|
volumes:
|
|
- tokenserver_db_data:/var/lib/mysql
|
|
restart: always
|
|
ports:
|
|
- "3306"
|
|
environment:
|
|
#MYSQL_RANDOM_ROOT_PASSWORD: yes
|
|
MYSQL_ROOT_PASSWORD: random
|
|
MYSQL_DATABASE: tokenserver
|
|
MYSQL_USER: test
|
|
MYSQL_PASSWORD: test
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "mysqladmin -uroot -p$${MYSQL_ROOT_PASSWORD} version"]
|
|
interval: 2s
|
|
retries: 10
|
|
start_period: 20s
|
|
timeout: 2s
|
|
mock-fxa-server:
|
|
image: app:build
|
|
restart: "no"
|
|
entrypoint: "sh /app/scripts/start_mock_fxa_server.sh"
|
|
environment:
|
|
MOCK_FXA_SERVER_HOST: 0.0.0.0
|
|
MOCK_FXA_SERVER_PORT: 6000
|
|
syncserver:
|
|
# NOTE: The naming in the rest of this repository has been updated to reflect the fact
|
|
# that Syncstorage and Tokenserver are now part of one repository/server called
|
|
# "Syncserver" (updated from "syncstorage-rs"). We keep the legacy naming below for
|
|
# backwards compatibility with previous Docker images.
|
|
image: ${SYNCSTORAGE_RS_IMAGE:-syncstorage-rs:latest}
|
|
restart: always
|
|
ports:
|
|
- "8000:8000"
|
|
depends_on:
|
|
sync-db-setup:
|
|
condition: service_started
|
|
tokenserver-db:
|
|
condition: service_healthy
|
|
environment:
|
|
SYNC_HOST: 0.0.0.0
|
|
SYNC_MASTER_SECRET: secret0
|
|
SYNC_SYNCSTORAGE__DATABASE_URL: spanner://projects/test-project/instances/test-instance/databases/test-database
|
|
SYNC_SYNCSTORAGE__SPANNER_EMULATOR_HOST: sync-db:9010
|
|
SYNC_TOKENSERVER__DATABASE_URL: mysql://test:test@tokenserver-db:3306/tokenserver
|
|
SYNC_TOKENSERVER__NODE_TYPE: spanner
|
|
SYNC_TOKENSERVER__RUN_MIGRATIONS: "true"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "curl -f http://localhost:8000/__heartbeat__ || exit 1"]
|
|
interval: 2s
|
|
retries: 5
|
|
start_period: 30s
|
|
timeout: 3s
|
|
|
|
volumes:
|
|
tokenserver_db_data:
|
|
|
|
# Application runs off of port 8000.
|
|
# you can test if it's available with
|
|
# curl "http://localhost:8000/__heartbeat__"
|