Reuse existing "WaitForUsersJoined" for test.

This commit is contained in:
Joachim Bauch 2020-07-31 13:50:15 +02:00
parent a3718a4664
commit b165c44080
Failed to extract signature
1 changed files with 1 additions and 47 deletions

View File

@ -946,53 +946,7 @@ func TestBackendServer_ParticipantsUpdateTimeout(t *testing.T) {
defer hubRoom.Close()
}
// We will receive "joined" events for all clients. The ordering is not
// defined as messages are processed and sent by asynchronous NATS handlers.
msg1_1, err := client1.RunUntilMessage(ctx)
if err != nil {
t.Error(err)
}
msg1_2, err := client1.RunUntilMessage(ctx)
if err != nil {
t.Error(err)
}
msg2_1, err := client2.RunUntilMessage(ctx)
if err != nil {
t.Error(err)
}
msg2_2, err := client2.RunUntilMessage(ctx)
if err != nil {
t.Error(err)
}
if err := client1.checkMessageJoined(msg1_1, hello1.Hello); err != nil {
// Ordering is "joined" from client 2, then from client 1
if err := client1.checkMessageJoined(msg1_1, hello2.Hello); err != nil {
t.Error(err)
}
if err := client1.checkMessageJoined(msg1_2, hello1.Hello); err != nil {
t.Error(err)
}
} else {
// Ordering is "joined" from client 1, then from client 2
if err := client1.checkMessageJoined(msg1_2, hello2.Hello); err != nil {
t.Error(err)
}
}
if err := client2.checkMessageJoined(msg2_1, hello1.Hello); err != nil {
// Ordering is "joined" from client 2, then from client 1
if err := client2.checkMessageJoined(msg2_1, hello2.Hello); err != nil {
t.Error(err)
}
if err := client2.checkMessageJoined(msg2_2, hello1.Hello); err != nil {
t.Error(err)
}
} else {
// Ordering is "joined" from client 1, then from client 2
if err := client2.checkMessageJoined(msg2_2, hello2.Hello); err != nil {
t.Error(err)
}
}
WaitForUsersJoined(ctx, t, client1, hello1, client2, hello2)
var wg sync.WaitGroup