Skip to content

Commit

Permalink
use hostaddr instead of host
Browse files Browse the repository at this point in the history
  • Loading branch information
xoudini committed Oct 21, 2024
1 parent 4611a5b commit 7405e11
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ jobs:
- name: Run tests
run: hatch test --python ${{ matrix.python-version }} --cover --randomize --parallel --retries 2 --retry-delay 1
env:
POSTGRES_HOST: "postgres"
POSTGRES_HOSTADDR: "postgres"
POSTGRES_DB: "postgres"
2 changes: 2 additions & 0 deletions src/postcar/config/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

class ConnectionInfo(t.NamedTuple):
host: t.Optional[str] = None
hostaddr: t.Optional[str] = None
port: t.Optional[int] = None
dbname: t.Optional[str] = None
username: t.Optional[str] = None
Expand All @@ -14,6 +15,7 @@ def conninfo(self) -> str:

return make_conninfo(
host=self.host,
hostaddr=self.hostaddr,
port=self.port,
dbname=self.dbname,
user=self.username,
Expand Down
13 changes: 9 additions & 4 deletions tests/db/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def namespace() -> str:


@pytest.fixture(scope="session")
def host() -> str:
return os.getenv("POSTGRES_HOST", "127.0.0.1")
def hostaddr() -> str:
return os.getenv("POSTGRES_HOSTADDR", "127.0.0.1")


@pytest.fixture(scope="session")
Expand All @@ -34,9 +34,14 @@ def password() -> str:


@pytest.fixture(scope="session")
def conninfo(host: str, dbname: str, username: str, password: str) -> str:
def conninfo(
hostaddr: str,
dbname: str,
username: str,
password: str,
) -> str:
return config.ConnectionInfo(
host=host,
hostaddr=hostaddr,
dbname=dbname,
username=username,
password=password,
Expand Down

0 comments on commit 7405e11

Please sign in to comment.