reuse the same Participant ID within the same room/session

This commit is contained in:
David Zhao
2021-01-28 01:14:06 -08:00
parent 0e48711e4b
commit fe83baa662
10 changed files with 232 additions and 17 deletions
+31
View File
@@ -0,0 +1,31 @@
package service_test
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/livekit/livekit-server/pkg/service"
)
func TestLocalRoomStore_GetParticipantId(t *testing.T) {
s := service.NewLocalRoomStore()
id, _ := s.GetParticipantId("room1", "p1")
assert.NotEmpty(t, id)
t.Run("diff room, same name returns a new ID", func(t *testing.T) {
id2, _ := s.GetParticipantId("room2", "p1")
assert.NotEmpty(t, id2)
assert.NotEqual(t, id, id2)
})
t.Run("same room returns identical id", func(t *testing.T) {
id2, _ := s.GetParticipantId("room1", "p1")
assert.Equal(t, id, id2)
})
t.Run("same room with different name", func(t *testing.T) {
id2, _ := s.GetParticipantId("room1", "p2")
assert.NotEqual(t, id, id2)
})
}