Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Document how to see logger output when running the twisted tests - SYNAPSE_TEST_LOG_LEVEL #10148

Merged
merged 3 commits into from
Jun 11, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ was broken. They are slower than the linters but will typically catch more error
```sh
source ./env/bin/activate
trial tests
# The tests can also be run with this longer command
python -m twisted.trial tests
MadLittleMods marked this conversation as resolved.
Show resolved Hide resolved
```

If you wish to only run *some* unit tests, you may specify
Expand All @@ -179,6 +181,14 @@ If your tests fail, you may wish to look at the logs:
less _trial_temp/test.log
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be interesting to add a note to the trial tests output when the tests fail to go checkout the _trial_temp/test.log file. I wonder if we can hook in at all 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks possible if we defined our own reporter but then that requires adding --reporter=ourcustomreporter to the test command.

Anyway, another possible PR ⏩

```

To see always see logger output from the app while the tests run,
set `SYNAPSE_TEST_LOG_LEVEL` and the resulting logs will be in `_trial_temp/test.log`:
MadLittleMods marked this conversation as resolved.
Show resolved Hide resolved

```sh
SYNAPSE_TEST_LOG_LEVEL=DEBUG trial tests
```


## Run the integration tests.

The integration tests are a more comprehensive suite of tests. They
Expand Down
29 changes: 17 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -293,18 +293,6 @@ try installing the failing modules individually::

pip install -e "module-name"

Once this is done, you may wish to run Synapse's unit tests to
check that everything is installed correctly::

python -m twisted.trial tests

This should end with a 'PASSED' result (note that exact numbers will
differ)::

Ran 1337 tests in 716.064s

PASSED (skips=15, successes=1322)

We recommend using the demo which starts 3 federated instances running on ports `8080` - `8082`

./demo/start.sh
Expand All @@ -324,6 +312,23 @@ If you just want to start a single instance of the app and run it directly::
python -m synapse.app.homeserver --config-path homeserver.yaml


Running the unit tests
======================

After getting up and running, you may wish to run Synapse's unit tests to
check that everything is installed correctly::

python -m twisted.trial tests

This should end with a 'PASSED' result (note that exact numbers will
differ)::

Ran 1337 tests in 716.064s

PASSED (skips=15, successes=1322)

For more tips on running the unit tests, like running a specific test or
show the logger output of the app, see the `CONTRIBUTING doc <CONTRIBUTING.md#run-the-unit-tests>`_.
richvdh marked this conversation as resolved.
Show resolved Hide resolved
MadLittleMods marked this conversation as resolved.
Show resolved Hide resolved


Running the Integration Tests
Expand Down
1 change: 1 addition & 0 deletions changelog.d/10148.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Document `SYNAPSE_TEST_LOG_LEVEL` to see the logger output when running tests.