From 3952efdaee2f06fb302ced24dfb238f6c8e5daa4 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Fri, 16 Jul 2021 00:03:04 -0500 Subject: [PATCH 1/2] Document how to access the database for a homeserver after Complement runs Spawned from https://github.com/matrix-org/complement/pull/68 --- ONBOARDING.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ONBOARDING.md b/ONBOARDING.md index 0e073f85..f34790b2 100644 --- a/ONBOARDING.md +++ b/ONBOARDING.md @@ -188,6 +188,25 @@ For Goland: * Under "Run"->"Edit Configurations..."->"Templates"->"Go Test", add `COMPLEMENT_BASE_IMAGE=complement-dendrite:latest` * Then you can right-click on any test file or test case and "Run ". + + +### Access database for homeserver after Complement test runs + + +For Synapse: + +``` +# You can use `docker ps -f name=complement_` to just filter to the Complement containers +$ docker ps +$ docker exec -it complement_1_hs_with_application_service.hs1_2 /bin/bash + +$ apt-get update && apt-get install -y sqlite3 + +$ sqlite3 +> .open /conf/homeserver.db +``` + + ### What do I need to know if I'm coming from sytest? Sytest has a concept of a `fixture` to configure the homeserver or test in a particular way, these are replaced with a `Blueprint` in Complement. From a6e79b90b9418b6b75687ad8d101ec684cbb4bb0 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Fri, 16 Jul 2021 00:07:35 -0500 Subject: [PATCH 2/2] Move to step by step based db access --- ONBOARDING.md | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/ONBOARDING.md b/ONBOARDING.md index f34790b2..45b87f88 100644 --- a/ONBOARDING.md +++ b/ONBOARDING.md @@ -189,22 +189,16 @@ For Goland: * Then you can right-click on any test file or test case and "Run ". - ### Access database for homeserver after Complement test runs +If you're curious what the database looks like after you run some tests, here are some steps to get you going in Synapse: -For Synapse: - -``` -# You can use `docker ps -f name=complement_` to just filter to the Complement containers -$ docker ps -$ docker exec -it complement_1_hs_with_application_service.hs1_2 /bin/bash - -$ apt-get update && apt-get install -y sqlite3 - -$ sqlite3 -> .open /conf/homeserver.db -``` + 1. In your test comment out `defer deployment.Destroy(t)` and replace with `defer time.Sleep(2 * time.Hour)` to keep the homeserver running after the tests complete + 1. Start the Complement tests + 1. Find the name of the container, `docker ps -f name=complement_` (this will filter for just the Compelement related Docker containers) + 1. Access the container replacing the name with what you found in the previous step: `docker exec -it complement_1_hs_with_application_service.hs1_2 /bin/bash` + 1. Install sqlite (database driver), `apt-get update && apt-get install -y sqlite3` + 1. Then run `sqlite3` and open the database `.open /conf/homeserver.db` (this db path comes from the Synapse homeserver.yaml) ### What do I need to know if I'm coming from sytest?