Skip to content

Commit

Permalink
Fix running tests with tox-docker 5.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hluk committed May 29, 2024
1 parent 62a8b3f commit 3efe1f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion resultsdb/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


def db_uri_for_testing():
postgres_port = os.getenv("POSTGRES_5432_TCP")
postgres_port = os.getenv("RESULTSDB_POSTGRES_PORT")
if postgres_port:
return f"postgresql+psycopg2://resultsdb:resultsdb@localhost:{postgres_port}/resultsdb"

Expand Down
10 changes: 3 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ envlist = py3,mypy
requires =
poetry
tox-docker
# requests-2.32.0 breaks docker
# https://github.com/docker/docker-py/issues/3256
requests<2.32.0

[pytest]
minversion=2.0
Expand Down Expand Up @@ -40,20 +37,19 @@ setenv =
docker = resultsdb-postgres
commands =
poetry run python -m pytest {posargs}
setenv =
POSTGRES_5432_TCP = 15432
passenv =
DOCKER_HOST
NO_CAN_HAS_POSTGRES
POSTGRES_5432_TCP
RESULTSDB_POSTGRES_PORT

[docker:resultsdb-postgres]
image = docker.io/library/postgres:14.7-alpine
environment =
POSTGRES_USER=resultsdb
POSTGRES_DB=resultsdb
POSTGRES_PASSWORD=resultsdb
ports = 15432:5432/tcp
expose =
RESULTSDB_POSTGRES_PORT=5432/tcp
healthcheck_cmd = pg_isready --username postgres
healthcheck_retries = 30
healthcheck_timeout = 1
Expand Down

0 comments on commit 3efe1f4

Please sign in to comment.