153 Commits

Author SHA1 Message Date
Kegan Dougal
7ea0b711db Check for lower 2024-06-04 17:22:43 +01:00
Kegan Dougal
17cb5f0376 Check the returned next_batch 2024-06-04 17:00:31 +01:00
Kegan Dougal
91a1a56f64 Add test 2024-06-04 16:57:57 +01:00
Kegan Dougal
451f6fb9c8 Add regression test 2024-05-20 14:02:29 +01:00
Kegan Dougal
c5b0afb2be bugfix: ensure we send back device list updates at the correct time
Otherwise we can cause lost device list updates if the client resets
the connection (as the device list update won't be in any in-memory cache).
2024-05-09 12:36:18 +01:00
Kegan Dougal
0af85096aa Check for unstable prefix in MSC4115 2024-04-25 15:15:42 +01:00
Kegan Dougal
c4f2617a2d Remove MSC4115 unsigned.membership field
With integration tests. This is required because this field
is scoped per-v2-user, but because the proxy deduplicates events
it means we might see the membership value for a different user.
We can't set this field correctly as we lack that information, so
rather than lie to clients instead just delete the field.

Fixes https://github.com/matrix-org/sliding-sync/issues/421
2024-04-24 16:20:07 +01:00
Kegan Dougal
c7dd361ca6 Use atomic.Bool rather than bool in tests to fix race detector issues 2024-03-11 10:22:18 +00:00
Kegan Dougal
6d6a2d6c08 Add a sensible timeline_limit cap
To avoid pathological cases where large timeline limits are requested.
2024-02-21 13:22:20 +00:00
David Robertson
cbd3c3c5c0
Merge pull request #363 from matrix-org/dmr/resnapshot-3 2023-11-10 11:38:12 +00:00
Kegan Dougal
c868e540db bugfix: handle malformed state/timeline responses
Specifically, look for the create event in the timeline as this
has been seen in the wild on Synapse. Fixes #367.
2023-11-08 10:36:36 +00:00
David Robertson
e872b18fe6
New test cases 2023-11-03 15:39:47 +00:00
David Robertson
81f06d1591
Update existing test cases 2023-11-03 15:39:23 +00:00
David Robertson
5e65210cc4
Ensure invalidateTokenImmediately acquires mutex 2023-11-02 13:53:44 +00:00
David Robertson
c94670eea7
Prevent a test from writing to a closed v2 server 2023-10-19 19:03:19 +01:00
David Robertson
7172fda846
Stop waiting for data when closing v2 servers
This makes integration tests about twice as fast for me, according to

```sh
time go test -count=1 ./tests-integration/ -v
```

Before:

real 2m4.053s
user 0m4.187s
sys  0m1.495s

After:

real 1m7.415s
user 0m3.093s
sys  0m1.347s
2023-10-19 19:01:39 +01:00
David Robertson
1079ec6aed
Return a dummy /versions response in tests
Otherwise every integration test logs a warning that isn't useful.
2023-09-28 12:20:10 +01:00
David Robertson
e75a462d4c
Merge pull request #300 from matrix-org/dmr/invalidate-timelines 2023-09-20 14:29:55 +01:00
David Robertson
507b2622b9
Assert we fetch the correct prev batch 2023-09-20 13:56:03 +01:00
David Robertson
4da081374c
Integration test 2023-09-19 16:39:55 +01:00
kegsay
94a4789287
Merge branch 'main' into kegan/poll-retry-loop-bad-create-event 2023-09-19 13:48:40 +01:00
Kegan Dougal
84c976e8e8 Additional tests; linting 2023-09-19 13:47:58 +01:00
David Robertson
d3ba1f1c30
Move TimelineResponse back to sync2 2023-09-19 12:41:25 +01:00
David Robertson
957bdee9d2
Merge branch 'main' into dmr/invalidate-timelines 2023-09-19 12:40:13 +01:00
Kegan Dougal
17beb00389 Add regression test 2023-09-14 16:48:26 +01:00
David Robertson
df01e50438
Pass TimelineResponse struct around 2023-09-13 19:17:53 +01:00
Kegan Dougal
471bb8c898 bugfix: don't wedge pollers when they get bad state blocks
We returned an error in Initialise when there is no create event
in the state block. If this happens, the poller automatically retries
the same request, tightlooping as the data is always going to cause
the same error. Instead, return an `internal.DataError` which is a way
of expressly telling the pollers to continue and advance the since token.

With regression test.

NB: This regression test also caught a potential bug which this PR could
have introduced. This PR lets the since token skip over bad responses, but
we want to make damn sure we process EVERYTHING ELSE in that response. In
particular, we could have skipped over large sections of `parseRoomsResponse`
as we would bail early on errors. This is now fixed to bail only after processing
the entire joined rooms map.
2023-09-12 14:16:21 +01:00
David Robertson
70030ec4fb
Tweak test assertions 2023-09-06 12:09:27 +01:00
David Robertson
7914980449
log the naughty response body 2023-09-05 19:27:44 +01:00
David Robertson
cd9f68e54a
Tweak logging 2023-09-05 19:25:25 +01:00
David Robertson
b9ca1ba5ee
Make the test fail 2023-09-05 19:24:07 +01:00
David Robertson
eb4c152952
Don't faff about with waiting 2023-09-05 19:22:03 +01:00
David Robertson
e67a945a5e
Attempt to reproduce problem 2023-09-05 18:41:55 +01:00
David Robertson
cb3b588d3b
Call checkRequest earlier 2023-09-05 18:16:27 +01:00
David Robertson
e152ce9ae7
Make checkRequest only accept a token
After all, we're only going to make a request using a token.
2023-09-05 18:16:23 +01:00
David Robertson
8e9bb4f842
Make checkRequest private
to encourage you to use the setter, which grabs the mutex
2023-09-05 18:16:23 +01:00
Kegan Dougal
d3285a39f1
Always ensure integ tests send a timeline event when sending state 2023-08-22 16:10:52 +01:00
David Robertson
e68ec09628
Fix test to provide m.room.create state after join 2023-08-18 13:29:53 +01:00
David Robertson
29f6cd0a1c
Test debug 2023-08-18 13:29:53 +01:00
David Robertson
ff7120245a
Merge pull request #242 from matrix-org/dmr/purge-inactive-pollers 2023-08-16 13:43:46 +01:00
Kegan Dougal
4d82c9dbd3 Do this as an e2e test instead 2023-08-15 14:55:00 +01:00
Kegan Dougal
540310ba5e Return M_UNKNOWN_TOKEN for unknown tokens 2023-08-15 14:33:48 +01:00
David Robertson
ff9063182f
Polish off integration test 2023-08-15 11:56:52 +01:00
David Robertson
00a9e31ed1
Integration test 2023-08-10 13:11:58 +01:00
David Robertson
c3b7ace31f
Test message ignoring for new conns
Not going to test room subs separately to lists; afaics they both use LazyLoadTimelines
2023-08-03 19:00:20 +01:00
David Robertson
4814087240
Make a new conn when testing room subscription 2023-08-03 15:34:38 +01:00
David Robertson
31cabe9dd4
Test explicit room subscriptions 2023-08-03 15:08:07 +01:00
David Robertson
7175c2e148
Integration test 2023-08-03 14:11:35 +01:00
Till Faelligen
2ced1986b4
Wait for responses to be processed 2023-08-02 14:04:32 +02:00
Till Faelligen
d357aa234f
Update test again to validate that we don't see Charlie typing 2023-08-02 10:57:22 +02:00