Skip to content

Commit

Permalink
Revert "Set the expected room name in ListRooms requests in the integ…
Browse files Browse the repository at this point in the history
…ration test (#214)" (#215)

This reverts commit 1266354.
  • Loading branch information
biglittlebigben authored Oct 28, 2024
1 parent 1266354 commit 994e0d4
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions test/lktest/livekit.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,8 @@ type LiveKit struct {
WsUrl string
}

func (lk *LiveKit) ListRooms(t TB, names []string) []*livekit.Room {
resp, err := lk.Rooms.ListRooms(context.Background(), &livekit.ListRoomsRequest{
Names: names,
})
func (lk *LiveKit) ListRooms(t TB) []*livekit.Room {
resp, err := lk.Rooms.ListRooms(context.Background(), &livekit.ListRoomsRequest{})
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -433,12 +431,12 @@ wait:
}
}

func (lk *LiveKit) waitRooms(t TB, ctx context.Context, none bool, filter func(r *livekit.Room) bool, names []string) []*livekit.Room {
func (lk *LiveKit) waitRooms(t TB, ctx context.Context, none bool, filter func(r *livekit.Room) bool) []*livekit.Room {
var rooms []*livekit.Room
ticker := time.NewTicker(time.Second / 4)
defer ticker.Stop()
for {
rooms = lk.ListRooms(t, names)
rooms = lk.ListRooms(t)
if filter != nil {
var out []*livekit.Room
for _, r := range rooms {
Expand Down Expand Up @@ -469,7 +467,7 @@ func (lk *LiveKit) ExpectRoomWithParticipants(t TB, ctx context.Context, room st
filter := func(r *livekit.Room) bool {
return r.Name == room
}
rooms := lk.waitRooms(t, ctx, len(participants) == 0, filter, []string{room})
rooms := lk.waitRooms(t, ctx, len(participants) == 0, filter)
if len(participants) == 0 && len(rooms) == 0 {
return
}
Expand All @@ -483,7 +481,7 @@ func (lk *LiveKit) ExpectRoomPref(t TB, ctx context.Context, pref, number string
filter := func(r *livekit.Room) bool {
return r.Name != pref && strings.HasPrefix(r.Name, pref+"_"+number+"_")
}
rooms := lk.waitRooms(t, ctx, none, filter, nil)
rooms := lk.waitRooms(t, ctx, none, filter)
require.Len(t, rooms, 1)
require.True(t, filter(rooms[0]))
t.Log("Room:", rooms[0].Name)
Expand Down

0 comments on commit 994e0d4

Please sign in to comment.