From 74615cecc94f16760cb466526405473f876a56bd Mon Sep 17 00:00:00 2001 From: Dan Lindholm Date: Mon, 21 Oct 2024 10:10:27 +0200 Subject: [PATCH] use host after all, map service ports to host --- .github/workflows/test.yml | 3 ++- tests/db/conftest.py | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3f591b1..d8a7900 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,6 +29,8 @@ jobs: image: postgres:${{ matrix.postgres-version }} env: POSTGRES_PASSWORD: "1234" + ports: + - "5432:5432" options: >- --health-cmd pg_isready --health-interval 10s @@ -52,5 +54,4 @@ jobs: - name: Run tests run: hatch test --python ${{ matrix.python-version }} --cover --randomize --parallel --retries 2 --retry-delay 1 env: - POSTGRES_HOSTADDR: "postgres" POSTGRES_DB: "postgres" diff --git a/tests/db/conftest.py b/tests/db/conftest.py index 5aed3a8..26f06d6 100644 --- a/tests/db/conftest.py +++ b/tests/db/conftest.py @@ -14,8 +14,8 @@ def namespace() -> str: @pytest.fixture(scope="session") -def hostaddr() -> str: - return os.getenv("POSTGRES_HOSTADDR", "127.0.0.1") +def host() -> str: + return os.getenv("POSTGRES_HOST", "127.0.0.1") @pytest.fixture(scope="session") @@ -35,13 +35,13 @@ def password() -> str: @pytest.fixture(scope="session") def conninfo( - hostaddr: str, + host: str, dbname: str, username: str, password: str, ) -> str: return config.ConnectionInfo( - hostaddr=hostaddr, + host=host, dbname=dbname, username=username, password=password,