mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 12:06:08 -04:00
Optionally use an on-disk sqlite db in tests (#11702)
* Optionally use an on-disk sqlite db in tests When debugging a test it is sometimes useful to inspect the state of the DB. This is not easy when the db is in-memory: one cannot attach the sqlite CLI to another process's DB. With this change, if SYNAPSE_TEST_PERSIST_SQLITE_DB is set, we use `_trial_temp/test.db` as our sqlite database. One can then use `sqlite3 _trial_temp/test.db` and query to your heart's content. The DB is destroyed and recreated between different test cases. Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
This commit is contained in:
parent
2bb4bd1269
commit
d3cf0730f8
3 changed files with 23 additions and 1 deletions
|
@ -42,6 +42,10 @@ POSTGRES_HOST = os.environ.get("SYNAPSE_POSTGRES_HOST", None)
|
|||
POSTGRES_PASSWORD = os.environ.get("SYNAPSE_POSTGRES_PASSWORD", None)
|
||||
POSTGRES_BASE_DB = "_synapse_unit_tests_base_%s" % (os.getpid(),)
|
||||
|
||||
# When debugging a specific test, it's occasionally useful to write the
|
||||
# DB to disk and query it with the sqlite CLI.
|
||||
SQLITE_PERSIST_DB = os.environ.get("SYNAPSE_TEST_PERSIST_SQLITE_DB") is not None
|
||||
|
||||
# the dbname we will connect to in order to create the base database.
|
||||
POSTGRES_DBNAME_FOR_INITIAL_CREATE = "postgres"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue