Check participant SID also while removing a participant. (#1237)

This commit is contained in:
Raja Subramanian
2022-12-19 22:53:11 +05:30
committed by GitHub
parent e6bbf07089
commit 50e39b9985
6 changed files with 30 additions and 21 deletions
+4 -4
View File
@@ -55,14 +55,14 @@ func TestJoinedState(t *testing.T) {
rm := newRoomWithParticipants(t, testRoomOpts{num: 1})
p0 := rm.GetParticipants()[0]
s := time.Now().Unix()
rm.RemoveParticipant(p0.Identity(), types.ParticipantCloseReasonClientRequestLeave)
rm.RemoveParticipant(p0.Identity(), p0.ID(), types.ParticipantCloseReasonClientRequestLeave)
require.LessOrEqual(t, s, rm.LastLeftAt())
})
t.Run("LastLeftAt should not be set when there are still participants in the room", func(t *testing.T) {
rm := newRoomWithParticipants(t, testRoomOpts{num: 2})
p0 := rm.GetParticipants()[0]
rm.RemoveParticipant(p0.Identity(), types.ParticipantCloseReasonClientRequestLeave)
rm.RemoveParticipant(p0.Identity(), p0.ID(), types.ParticipantCloseReasonClientRequestLeave)
require.EqualValues(t, 0, rm.LastLeftAt())
})
}
@@ -120,7 +120,7 @@ func TestRoomJoin(t *testing.T) {
disconnectedParticipant := participants[1].(*typesfakes.FakeLocalParticipant)
disconnectedParticipant.StateReturns(livekit.ParticipantInfo_DISCONNECTED)
rm.RemoveParticipant(p.Identity(), types.ParticipantCloseReasonStateDisconnected)
rm.RemoveParticipant(p.Identity(), p.ID(), types.ParticipantCloseReasonStateDisconnected)
time.Sleep(defaultDelay)
require.Equal(t, p, changedParticipant)
@@ -333,7 +333,7 @@ func TestRoomClosure(t *testing.T) {
p := rm.GetParticipants()[0]
// allows immediate close after
rm.protoRoom.EmptyTimeout = 0
rm.RemoveParticipant(p.Identity(), types.ParticipantCloseReasonClientRequestLeave)
rm.RemoveParticipant(p.Identity(), p.ID(), types.ParticipantCloseReasonClientRequestLeave)
time.Sleep(defaultDelay)