cleanup room state, proper participant termination

This commit is contained in:
David Zhao
2021-01-18 23:44:59 -08:00
parent d83a1b1af3
commit 71b4673a0a
22 changed files with 374 additions and 101 deletions
+31
View File
@@ -0,0 +1,31 @@
package routing_test
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/livekit/livekit-server/pkg/routing"
"github.com/livekit/livekit-server/proto/livekit"
)
func TestIsAvailable(t *testing.T) {
t.Run("still available", func(t *testing.T) {
n := &livekit.Node{
Stats: &livekit.NodeStats{
UpdatedAt: time.Now().Unix() - 10,
},
}
assert.True(t, routing.IsAvailable(n))
})
t.Run("expired", func(t *testing.T) {
n := &livekit.Node{
Stats: &livekit.NodeStats{
UpdatedAt: time.Now().Unix() - 20,
},
}
assert.False(t, routing.IsAvailable(n))
})
}