From b689febd869ba777f167e6e95190ff8f01a059c3 Mon Sep 17 00:00:00 2001 From: clokep Date: Tue, 27 Jul 2021 19:28:49 +0000 Subject: deploy: 048968301278aa6ece0a694d7554b7d7d5f7e9ae --- develop/development/contributing_guide.html | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'develop/development') diff --git a/develop/development/contributing_guide.html b/develop/development/contributing_guide.html index 75e16c29b6..42bc8566c5 100644 --- a/develop/development/contributing_guide.html +++ b/develop/development/contributing_guide.html @@ -307,7 +307,7 @@ Make sure that you have saved all your files.

source ./env/bin/activate
 ./scripts-dev/lint.sh path/to/file1.py path/to/file2.py path/to/folder
 
-

Run the unit tests.

+

Run the unit tests (Twisted trial).

The unit tests run parts of Synapse, including your changes, to see if anything was broken. They are slower than the linters but will typically catch more errors.

source ./env/bin/activate
@@ -324,7 +324,7 @@ trial tests.rest.admin.test_room tests.handlers.test_admin.ExfiltrateData.test_i
 

To increase the log level for the tests, set SYNAPSE_TEST_LOG_LEVEL:

SYNAPSE_TEST_LOG_LEVEL=DEBUG trial tests
 
-

Run the integration tests.

+

Run the integration tests (Sytest).

The integration tests are a more comprehensive suite of tests. They run a full version of Synapse, including your changes, to check if anything was broken. They are slower than the unit tests but will @@ -334,6 +334,29 @@ configuration:

$ docker run --rm -it -v /path/where/you/have/cloned/the/repository\:/src:ro -v /path/to/where/you/want/logs\:/logs matrixdotorg/sytest-synapse:py37
 

This configuration should generally cover your needs. For more details about other configurations, see documentation in the SyTest repo.

+

Run the integration tests (Complement).

+

Complement is a suite of black box tests that can be run on any homeserver implementation. It can also be thought of as end-to-end (e2e) tests.

+

It's often nice to develop on Synapse and write Complement tests at the same time. +Here is how to run your local Synapse checkout against your local Complement checkout.

+

(checkout complement alongside your synapse checkout)

+
COMPLEMENT_DIR=../complement ./scripts-dev/complement.sh
+
+

To run a specific test file, you can pass the test name at the end of the command. The name passed comes from the naming structure in your Complement tests. If you're unsure of the name, you can do a full run and copy it from the test output:

+
COMPLEMENT_DIR=../complement ./scripts-dev/complement.sh TestBackfillingHistory
+
+

To run a specific test, you can specify the whole name structure:

+
COMPLEMENT_DIR=../complement ./scripts-dev/complement.sh TestBackfillingHistory/parallel/Backfilled_historical_events_resolve_with_proper_state_in_correct_order
+
+

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:

+
    +
  1. In your Complement 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
  2. +
  3. Start the Complement tests
  4. +
  5. Find the name of the container, docker ps -f name=complement_ (this will filter for just the Compelement related Docker containers)
  6. +
  7. 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
  8. +
  9. Install sqlite (database driver), apt-get update && apt-get install -y sqlite3
  10. +
  11. Then run sqlite3 and open the database .open /conf/homeserver.db (this db path comes from the Synapse homeserver.yaml)
  12. +

9. Submit your patch.

Once you're happy with your patch, it's time to prepare a Pull Request.

To prepare a Pull Request, please:

-- cgit 1.5.1