Browse Source

No need to manually close rooms in testing, will be done by hub on client disconnects.

pull/34/head
Joachim Bauch 3 weeks ago
parent
commit
0c53f10fd7
No known key found for this signature in database GPG Key ID: 77C1D22D53E15F02
  1. 25
      backend_server_test.go
  2. 35
      hub_test.go
  3. 4
      room_test.go

25
backend_server_test.go

@ -406,10 +406,6 @@ func TestBackendServer_RoomDisinvite(t *testing.T) {
t.Fatalf("Expected room %s, got %s", roomId, room.Room.RoomId)
}
if hubRoom := hub.getRoom(roomId); hubRoom != nil {
defer hubRoom.Close()
}
// Ignore "join" events.
if err := client.DrainMessages(ctx); err != nil {
t.Error(err)
@ -518,12 +514,6 @@ func TestBackendServer_RoomDisinviteDifferentRooms(t *testing.T) {
if _, err := client2.JoinRoom(ctx, roomId2); err != nil {
t.Fatal(err)
}
if hubRoom := hub.getRoom(roomId1); hubRoom != nil {
defer hubRoom.Close()
}
if hubRoom := hub.getRoom(roomId2); hubRoom != nil {
defer hubRoom.Close()
}
// Ignore "join" events.
if err := client1.DrainMessages(ctx); err != nil {
@ -830,10 +820,6 @@ func TestBackendServer_ParticipantsUpdatePermissions(t *testing.T) {
t.Fatalf("Expected room %s, got %s", roomId, room.Room.RoomId)
}
if hubRoom := hub.getRoom(roomId); hubRoom != nil {
defer hubRoom.Close()
}
// Ignore "join" events.
if err := client1.DrainMessages(ctx); err != nil {
t.Error(err)
@ -927,9 +913,6 @@ func TestBackendServer_ParticipantsUpdateEmptyPermissions(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if hubRoom := hub.getRoom(room.Room.RoomId); hubRoom != nil {
defer hubRoom.Close()
}
if room.Room.RoomId != roomId {
t.Fatalf("Expected room %s, got %s", roomId, room.Room.RoomId)
}
@ -1027,10 +1010,6 @@ func TestBackendServer_ParticipantsUpdateTimeout(t *testing.T) {
t.Fatalf("Expected room %s, got %s", roomId, room.Room.RoomId)
}
if hubRoom := hub.getRoom(roomId); hubRoom != nil {
defer hubRoom.Close()
}
WaitForUsersJoined(ctx, t, client1, hello1, client2, hello2)
var wg sync.WaitGroup
@ -1227,10 +1206,6 @@ func TestBackendServer_RoomMessage(t *testing.T) {
t.Fatalf("Expected room %s, got %s", roomId, room.Room.RoomId)
}
if hubRoom := hub.getRoom(roomId); hubRoom != nil {
defer hubRoom.Close()
}
// Ignore "join" events.
if err := client.DrainMessages(ctx); err != nil {
t.Error(err)

35
hub_test.go

@ -1125,9 +1125,6 @@ func TestClientHelloResumeAndJoin(t *testing.T) {
} else if room.Room.RoomId != roomId {
t.Fatalf("Expected room %s, got %s", roomId, room.Room.RoomId)
}
if hubRoom := hub.getRoom(roomId); hubRoom != nil {
defer hubRoom.Close()
}
}
func TestClientHelloClient(t *testing.T) {
@ -1480,10 +1477,6 @@ func TestClientMessageToRoom(t *testing.T) {
t.Fatalf("Expected room %s, got %s", roomId, room.Room.RoomId)
}
if hubRoom := hub.getRoom(roomId); hubRoom != nil {
defer hubRoom.Close()
}
WaitForUsersJoined(ctx, t, client1, hello1, client2, hello2)
recipient := MessageClientMessageRecipient{
@ -1536,10 +1529,6 @@ func TestJoinRoom(t *testing.T) {
t.Fatalf("Expected room %s, got %s", roomId, room.Room.RoomId)
}
if hubRoom := hub.getRoom(roomId); hubRoom != nil {
defer hubRoom.Close()
}
// We will receive a "joined" event.
if err := client.RunUntilJoined(ctx, hello.Hello); err != nil {
t.Error(err)
@ -1633,10 +1622,6 @@ func TestJoinRoomChange(t *testing.T) {
t.Fatalf("Expected room %s, got %s", roomId, room.Room.RoomId)
}
if hubRoom := hub.getRoom(roomId); hubRoom != nil {
defer hubRoom.Close()
}
// We will receive a "joined" event.
if err := client.RunUntilJoined(ctx, hello.Hello); err != nil {
t.Error(err)
@ -1650,10 +1635,6 @@ func TestJoinRoomChange(t *testing.T) {
t.Fatalf("Expected room %s, got %s", roomId, room.Room.RoomId)
}
if hubRoom := hub.getRoom(roomId); hubRoom != nil {
defer hubRoom.Close()
}
// We will receive a "joined" event.
if err := client.RunUntilJoined(ctx, hello.Hello); err != nil {
t.Error(err)
@ -1706,10 +1687,6 @@ func TestJoinMultiple(t *testing.T) {
t.Fatalf("Expected room %s, got %s", roomId, room.Room.RoomId)
}
if hubRoom := hub.getRoom(roomId); hubRoom != nil {
defer hubRoom.Close()
}
// We will receive a "joined" event.
if err := client1.RunUntilJoined(ctx, hello1.Hello); err != nil {
t.Error(err)
@ -1928,10 +1905,6 @@ func TestRoomParticipantsListUpdateWhileDisconnected(t *testing.T) {
t.Fatalf("Expected room %s, got %s", roomId, room.Room.RoomId)
}
if hubRoom := hub.getRoom(roomId); hubRoom != nil {
defer hubRoom.Close()
}
WaitForUsersJoined(ctx, t, client1, hello1, client2, hello2)
// Simulate request from the backend that somebody joined the call.
@ -2045,9 +2018,7 @@ func TestClientTakeoverRoomSession(t *testing.T) {
t.Fatalf("Expected room %s, got %s", roomId, room.Room.RoomId)
}
if hubRoom := hub.getRoom(roomId); hubRoom != nil {
defer hubRoom.Close()
} else {
if hubRoom := hub.getRoom(roomId); hubRoom == nil {
t.Fatalf("Room %s does not exist", roomId)
}
@ -2207,10 +2178,6 @@ func TestClientSendOfferPermissions(t *testing.T) {
t.Fatalf("Expected room %s, got %s", roomId, room.Room.RoomId)
}
if hubRoom := hub.getRoom(roomId); hubRoom != nil {
defer hubRoom.Close()
}
WaitForUsersJoined(ctx, t, client1, hello1, client2, hello2)
session1 := hub.GetSessionByPublicId(hello1.Hello.SessionId).(*ClientSession)

4
room_test.go

@ -110,10 +110,6 @@ func TestRoom_Update(t *testing.T) {
t.Fatalf("Expected room %s, got %s", roomId, room.Room.RoomId)
}
if hubRoom := hub.getRoom(roomId); hubRoom != nil {
defer hubRoom.Close()
}
// We will receive a "joined" event.
if err := client.RunUntilJoined(ctx, hello.Hello); err != nil {
t.Error(err)

Loading…
Cancel
Save