Skip to content

Commit 60402da

Browse files
fix: define the mandatory POSTGRES_PASSWORD environment variable (#720)
* feat: grab Docker containers logs * fix: define the mandatory POSTGRES_PASSWORD environment variable * fix: add missing parameter
1 parent e8d528a commit 60402da

File tree

7 files changed

+9
-2
lines changed

7 files changed

+9
-2
lines changed

tests/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ services:
99
environment:
1010
POSTGRES_USER: 'postgres'
1111
POSTGRES_DB: 'elasticapm_test'
12+
POSTGRES_PASSWORD: 'postgres'
1213
volumes:
1314
- pypgdata:/var/lib/postgresql/data
1415
healthcheck:

tests/instrumentation/asyncio/aiopg_tests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@
5151

5252

5353
def dsn():
54-
return "dbname={database} user={user} host={host} port={port}".format(
54+
return "dbname={database} user={user} password={password} host={host} port={port}".format(
5555
**{
5656
"database": os.environ.get("POSTGRES_DB", "elasticapm_test"),
5757
"user": os.environ.get("POSTGRES_USER", "postgres"),
58+
"password": os.environ.get("POSTGRES_PASSWORD", "postgres"),
5859
"host": os.environ.get("POSTGRES_HOST", "localhost"),
5960
"port": os.environ.get("POSTGRES_PORT", "5432"),
6061
}

tests/instrumentation/psycopg2_tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def connect_kwargs():
6363
return {
6464
"database": os.environ.get("POSTGRES_DB", "elasticapm_test"),
6565
"user": os.environ.get("POSTGRES_USER", "postgres"),
66+
"password": os.environ.get("POSTGRES_PASSWORD", "postgres"),
6667
"host": os.environ.get("POSTGRES_HOST", None),
6768
"port": os.environ.get("POSTGRES_PORT", None),
6869
}

tests/instrumentation/pyodbc_tests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@
4545

4646
@pytest.yield_fixture(scope="function")
4747
def pyodbc_postgres_connection(request):
48-
conn_str = ("DRIVER={PostgreSQL Unicode};" "DATABASE=%s;" "UID=%s;" "SERVER=%s;" "PORT=%s;") % (
48+
conn_str = ("DRIVER={PostgreSQL Unicode};" "DATABASE=%s;" "UID=%s;" "PASSWORD=%s;" "SERVER=%s;" "PORT=%s;") % (
4949
os.environ.get("POSTGRES_DB", "elasticapm_test"),
5050
os.environ.get("POSTGRES_USER", "postgres"),
51+
os.environ.get("POSTGRES_PASSWORD", "postgres"),
5152
os.environ.get("POSTGRES_HOST", None),
5253
os.environ.get("POSTGRES_PORT", None),
5354
)

tests/scripts/envs/aiopg.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export PYTEST_MARKER="-m aiopg"
22
export DOCKER_DEPS="postgres"
33
export POSTGRES_HOST="postgres"
44
export POSTGRES_USER="postgres"
5+
export POSTGRES_PASSWORD="postgres"
56
export POSTGRES_DB="elasticapm_test"
67
export POSTGRES_HOST="postgres"
78
export POSTGRES_PORT="5432"

tests/scripts/envs/psycopg2.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export PYTEST_MARKER="-m psycopg2"
22
export DOCKER_DEPS="postgres"
33
export POSTGRES_HOST="postgres"
44
export POSTGRES_USER="postgres"
5+
export POSTGRES_PASSWORD="postgres"
56
export POSTGRES_DB="elasticapm_test"
67
export POSTGRES_HOST="postgres"
78
export POSTGRES_PORT="5432"

tests/scripts/envs/pyodbc.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export PYTEST_MARKER="-m pyodbc"
22
export DOCKER_DEPS="postgres"
33
export POSTGRES_HOST="postgres"
44
export POSTGRES_USER="postgres"
5+
export POSTGRES_PASSWORD="postgres"
56
export POSTGRES_DB="elasticapm_test"
67
export POSTGRES_HOST="postgres"
78
export POSTGRES_PORT="5432"

0 commit comments

Comments
 (0)