Kegan Dougal 7e06813fe2 Fix #365: only return the last joined range
If we returned multiple distinct ranges, we always assumed that
the history visibility was "joined", so we would never return
events in the invite/shared state. This would be fine if the client
had a way to fetch those events sent before they were joined, but
they did not have a way as the prev_batch token would not be set
correctly. We now only return a single range of events and the prev
batch for /that/ range only, and defer to the upstream HS for
history visibility calculations.

Add end-to-end test to assert this new behaviour works.
2023-11-06 11:54:15 +00:00
..
2023-10-11 17:14:49 +01:00
2023-10-26 17:02:16 +01:00
2023-10-11 12:23:46 +01:00
2023-10-11 12:23:46 +01:00
2023-10-11 12:23:46 +01:00
2023-04-28 12:35:04 +01:00
2023-10-11 12:23:46 +01:00
2023-10-11 12:23:46 +01:00
2023-10-11 12:23:46 +01:00
2023-10-11 12:23:46 +01:00

End-to-End Tests

This directory contains end-to-end tests, running against a real Synapse server, and a real Proxy binary.

End-to-End tests meet the following criteria:

  • The test exclusively uses the public sliding sync API for test assertions.
  • The test exclusively uses the public sync v2 API for configuring the test.

Some examples of this include testing core functionality of the API like room subscriptions, multiple lists, filters, extensions, etc.

Counter examples include testing restarts of the proxy, testing out-of-order responses and testing connection handling. These should be integration tests.

Development

Run a Synapse in a separate terminal:

docker run --rm -e "SYNAPSE_COMPLEMENT_DATABASE=sqlite" -e "SERVER_NAME=synapse" -p 8008:8008 ghcr.io/matrix-org/synapse-service:v1.72.0

(You will need to docker login to the GitHub container registry to pull that image.)

Keep it running. Then run the tests on a fresh postgres database (run in the root of this repository):

export SYNCV3_SERVER=http://localhost:8008
export SYNCV3_DB="user=$(whoami) dbname=syncv3_test sslmode=disable"
export SYNCV3_SECRET=secret
(dropdb syncv3_test && createdb syncv3_test && cd tests-e2e && ./run-tests.sh .)

All args after run-test.sh are passed to go test so you can set timeouts/run individual tests that way, hence the . in the above example as that translated to go test ..