Merge pull request #31 from strukturag/ci-flaky-fixes

Fix flaky CI test runs
This commit is contained in:
Joachim Bauch 2020-07-31 14:03:10 +02:00 committed by GitHub
commit 2d21c98928
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 47 deletions

View file

@ -31,6 +31,10 @@ ifneq ($(TEST),)
TESTARGS := $(TESTARGS) -run $(TEST)
endif
ifneq ($(COUNT),)
TESTARGS := $(TESTARGS) -count $(COUNT)
endif
hook:
[ ! -d "$(CURDIR)/.git/hooks" ] || ln -sf "$(CURDIR)/scripts/pre-commit.hook" "$(CURDIR)/.git/hooks/pre-commit"

View file

@ -936,6 +936,10 @@ func TestBackendServer_ParticipantsUpdateTimeout(t *testing.T) {
} else if room.Room.RoomId != roomId {
t.Fatalf("Expected room %s, got %s", roomId, room.Room.RoomId)
}
// Give message processing some time.
time.Sleep(10 * time.Millisecond)
if room, err := client2.JoinRoom(ctx, roomId); err != nil {
t.Fatal(err)
} else if room.Room.RoomId != roomId {
@ -946,53 +950,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

View file

@ -1221,6 +1221,10 @@ func TestClientMessageToRoom(t *testing.T) {
} else if room.Room.RoomId != roomId {
t.Fatalf("Expected room %s, got %s", roomId, room.Room.RoomId)
}
// Give message processing some time.
time.Sleep(10 * time.Millisecond)
if room, err := client2.JoinRoom(ctx, roomId); err != nil {
t.Fatal(err)
} else if room.Room.RoomId != roomId {
@ -1665,6 +1669,10 @@ func TestRoomParticipantsListUpdateWhileDisconnected(t *testing.T) {
} else if room.Room.RoomId != roomId {
t.Fatalf("Expected room %s, got %s", roomId, room.Room.RoomId)
}
// Give message processing some time.
time.Sleep(10 * time.Millisecond)
if room, err := client2.JoinRoom(ctx, roomId); err != nil {
t.Fatal(err)
} else if room.Room.RoomId != roomId {
@ -1940,6 +1948,10 @@ func TestClientSendOfferPermissions(t *testing.T) {
} else if room.Room.RoomId != roomId {
t.Fatalf("Expected room %s, got %s", roomId, room.Room.RoomId)
}
// Give message processing some time.
time.Sleep(10 * time.Millisecond)
if room, err := client2.JoinRoom(ctx, roomId); err != nil {
t.Fatal(err)
} else if room.Room.RoomId != roomId {