mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-03 04:56:11 -04:00
Allow specifying the Postgres database's port when running unit tests with Postgres. (#12376)
This commit is contained in:
parent
efdbcfd6af
commit
708d88b1a2
4 changed files with 24 additions and 3 deletions
|
@ -76,6 +76,7 @@ from tests.utils import (
|
|||
POSTGRES_BASE_DB,
|
||||
POSTGRES_HOST,
|
||||
POSTGRES_PASSWORD,
|
||||
POSTGRES_PORT,
|
||||
POSTGRES_USER,
|
||||
SQLITE_PERSIST_DB,
|
||||
USE_POSTGRES_FOR_TESTS,
|
||||
|
@ -747,6 +748,7 @@ def setup_test_homeserver(
|
|||
"host": POSTGRES_HOST,
|
||||
"password": POSTGRES_PASSWORD,
|
||||
"user": POSTGRES_USER,
|
||||
"port": POSTGRES_PORT,
|
||||
"cp_min": 1,
|
||||
"cp_max": 5,
|
||||
},
|
||||
|
@ -786,6 +788,7 @@ def setup_test_homeserver(
|
|||
database=POSTGRES_BASE_DB,
|
||||
user=POSTGRES_USER,
|
||||
host=POSTGRES_HOST,
|
||||
port=POSTGRES_PORT,
|
||||
password=POSTGRES_PASSWORD,
|
||||
)
|
||||
db_conn.autocommit = True
|
||||
|
@ -833,6 +836,7 @@ def setup_test_homeserver(
|
|||
database=POSTGRES_BASE_DB,
|
||||
user=POSTGRES_USER,
|
||||
host=POSTGRES_HOST,
|
||||
port=POSTGRES_PORT,
|
||||
password=POSTGRES_PASSWORD,
|
||||
)
|
||||
db_conn.autocommit = True
|
||||
|
|
|
@ -35,6 +35,11 @@ LEAVE_DB = os.environ.get("SYNAPSE_LEAVE_DB", False)
|
|||
POSTGRES_USER = os.environ.get("SYNAPSE_POSTGRES_USER", None)
|
||||
POSTGRES_HOST = os.environ.get("SYNAPSE_POSTGRES_HOST", None)
|
||||
POSTGRES_PASSWORD = os.environ.get("SYNAPSE_POSTGRES_PASSWORD", None)
|
||||
POSTGRES_PORT = (
|
||||
int(os.environ["SYNAPSE_POSTGRES_PORT"])
|
||||
if "SYNAPSE_POSTGRES_PORT" in os.environ
|
||||
else None
|
||||
)
|
||||
POSTGRES_BASE_DB = "_synapse_unit_tests_base_%s" % (os.getpid(),)
|
||||
|
||||
# When debugging a specific test, it's occasionally useful to write the
|
||||
|
@ -55,6 +60,7 @@ def setupdb():
|
|||
db_conn = db_engine.module.connect(
|
||||
user=POSTGRES_USER,
|
||||
host=POSTGRES_HOST,
|
||||
port=POSTGRES_PORT,
|
||||
password=POSTGRES_PASSWORD,
|
||||
dbname=POSTGRES_DBNAME_FOR_INITIAL_CREATE,
|
||||
)
|
||||
|
@ -73,6 +79,7 @@ def setupdb():
|
|||
database=POSTGRES_BASE_DB,
|
||||
user=POSTGRES_USER,
|
||||
host=POSTGRES_HOST,
|
||||
port=POSTGRES_PORT,
|
||||
password=POSTGRES_PASSWORD,
|
||||
)
|
||||
db_conn = LoggingDatabaseConnection(db_conn, db_engine, "tests")
|
||||
|
@ -83,6 +90,7 @@ def setupdb():
|
|||
db_conn = db_engine.module.connect(
|
||||
user=POSTGRES_USER,
|
||||
host=POSTGRES_HOST,
|
||||
port=POSTGRES_PORT,
|
||||
password=POSTGRES_PASSWORD,
|
||||
dbname=POSTGRES_DBNAME_FOR_INITIAL_CREATE,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue