Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test for to-device message flush after restart #717

Merged
merged 2 commits into from
Apr 10, 2024
Merged
Changes from all 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
20 changes: 0 additions & 20 deletions tests/federation_to_device_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package tests

import (
"reflect"
"sync/atomic"
"testing"
"time"

Expand Down Expand Up @@ -101,29 +100,10 @@ func TestToDeviceMessagesOverFederation(t *testing.T) {

tc.makeReachable(t)

// servers may need to be poked with another to-device msg. This isn't great.
// See https://github.com/matrix-org/synapse/issues/16680
// bob has a sync timeout of 30s set, so if the test has not yet passed, we are kicking the server
// after 10s to ensure the server processes the previous sent to-device message.
var completed atomic.Bool
go func() {
time.Sleep(10 * time.Second)
if completed.Load() {
return
}
// maybe kicking the server will make things work if we're still waiting after 10s
alice.MustSendToDeviceMessages(t, "kick.type", map[string]map[string]map[string]interface{}{
bob.UserID: {
bob.DeviceID: content,
},
})
}()

bob.MustSyncUntil(t, client.SyncReq{Since: bobSince}, func(clientUserID string, topLevelSyncJSON gjson.Result) error {
t.Logf("%s", topLevelSyncJSON.Raw)
return client.SyncToDeviceHas(alice.UserID, checkEvent)(clientUserID, topLevelSyncJSON)
})
completed.Store(true)
})
}
}
Loading