From a472550d2087a0043acd78da80c71eb3d27f3836 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Mon, 4 Sep 2023 09:25:49 +0100 Subject: [PATCH] Fix flakey 'query remote device keys' test --- tests/federation_upload_keys_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/federation_upload_keys_test.go b/tests/federation_upload_keys_test.go index b87220fc..4202bdbe 100644 --- a/tests/federation_upload_keys_test.go +++ b/tests/federation_upload_keys_test.go @@ -80,13 +80,17 @@ func TestFederationKeyUploadQuery(t *testing.T) { // sytest: Can query remote device keys using POST t.Run("Can query remote device keys using POST", func(t *testing.T) { + // Device list changes only come down incremental syncs, so we do an + // initial sync up front. + _, nextBatch := bob.MustSync(t, client.SyncReq{}) + displayName := "My new displayname" body := client.WithJSONBody(t, map[string]interface{}{ "display_name": displayName, }) alice.MustDoFunc(t, http.MethodPut, []string{"_matrix", "client", "v3", "devices", alice.DeviceID}, body) // wait for bob to receive the displayname change - bob.MustSyncUntil(t, client.SyncReq{}, func(clientUserID string, topLevelSyncJSON gjson.Result) error { + bob.MustSyncUntil(t, client.SyncReq{Since: nextBatch}, func(clientUserID string, topLevelSyncJSON gjson.Result) error { devicesChanged := topLevelSyncJSON.Get("device_lists.changed") if devicesChanged.Exists() { for _, userID := range devicesChanged.Array() {