Log reason for participant close (#776)

* Log reason for participant close

Please suggest better naming for different scenarios if something comes
to mind.

* group service requests

* incorporate feedback

* Change names in tests
This commit is contained in:
Raja Subramanian
2022-06-22 10:32:22 +05:30
committed by GitHub
parent 87c8ec25b9
commit 47b89c155f
9 changed files with 122 additions and 51 deletions
+4 -4
View File
@@ -54,14 +54,14 @@ func TestJoinedState(t *testing.T) {
rm := newRoomWithParticipants(t, testRoomOpts{num: 1})
p0 := rm.GetParticipants()[0]
s := time.Now().Unix()
rm.RemoveParticipant(p0.Identity())
rm.RemoveParticipant(p0.Identity(), types.ParticipantCloseReasonClientRequestLeave)
require.Equal(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())
rm.RemoveParticipant(p0.Identity(), types.ParticipantCloseReasonClientRequestLeave)
require.EqualValues(t, 0, rm.LastLeftAt())
})
}
@@ -119,7 +119,7 @@ func TestRoomJoin(t *testing.T) {
disconnectedParticipant := participants[1].(*typesfakes.FakeLocalParticipant)
disconnectedParticipant.StateReturns(livekit.ParticipantInfo_DISCONNECTED)
rm.RemoveParticipant(p.Identity())
rm.RemoveParticipant(p.Identity(), types.ParticipantCloseReasonStateDisconnected)
time.Sleep(defaultDelay)
require.Equal(t, p, changedParticipant)
@@ -332,7 +332,7 @@ func TestRoomClosure(t *testing.T) {
p := rm.GetParticipants()[0]
// allows immediate close after
rm.protoRoom.EmptyTimeout = 0
rm.RemoveParticipant(p.Identity())
rm.RemoveParticipant(p.Identity(), types.ParticipantCloseReasonClientRequestLeave)
time.Sleep(defaultDelay)