single publisher integration test

This commit is contained in:
David Zhao
2021-01-13 17:38:40 -08:00
parent 233306d83a
commit 9a10a57b30
5 changed files with 166 additions and 48 deletions
+16 -2
View File
@@ -4,13 +4,15 @@ import (
"context"
"fmt"
"net/http"
"sync"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/livekit/livekit-server/cmd/cli/client"
"github.com/livekit/livekit-server/pkg/auth"
"github.com/livekit/livekit-server/pkg/config"
"github.com/livekit/livekit-server/pkg/logger"
"github.com/livekit/livekit-server/pkg/service"
"github.com/livekit/livekit-server/proto/livekit"
)
@@ -55,6 +57,19 @@ func withTimeout(t *testing.T, f func() bool) {
}
}
func waitUntilConnected(t *testing.T, clients ...*client.RTCClient) {
wg := sync.WaitGroup{}
for i := range clients {
c := clients[i]
wg.Add(1)
go func() {
assert.NoError(t, c.WaitUntilConnected())
wg.Done()
}()
}
wg.Wait()
}
func createServer() *service.LivekitServer {
var err error
serverConfig, err = config.NewConfig("")
@@ -119,7 +134,6 @@ func (p *StaticKeyProvider) NumKeys() int {
func (p *StaticKeyProvider) GetSecret(key string) string {
if key == testApiKey {
logger.GetLogger().Debugf("returning secret: %s", testApiSecret)
return testApiSecret
}
return ""