Region aware routing (#135)

* Region aware routing

* update config, fix spacing on commented out lines
This commit is contained in:
David Zhao
2021-10-06 21:40:04 -07:00
committed by GitHub
parent b0eca12ee8
commit c745f0a318
22 changed files with 406 additions and 113 deletions
+30
View File
@@ -0,0 +1,30 @@
package selector_test
import (
"testing"
"time"
"github.com/livekit/livekit-server/pkg/routing/selector"
livekit "github.com/livekit/protocol/proto"
"github.com/stretchr/testify/require"
)
func TestIsAvailable(t *testing.T) {
t.Run("still available", func(t *testing.T) {
n := &livekit.Node{
Stats: &livekit.NodeStats{
UpdatedAt: time.Now().Unix() - 3,
},
}
require.True(t, selector.IsAvailable(n))
})
t.Run("expired", func(t *testing.T) {
n := &livekit.Node{
Stats: &livekit.NodeStats{
UpdatedAt: time.Now().Unix() - 20,
},
}
require.False(t, selector.IsAvailable(n))
})
}