working CI test workflow, more reliable transport_test

This commit is contained in:
David Zhao
2021-06-03 22:35:39 -07:00
parent 8f46e0f4da
commit 24919d8ccb
4 changed files with 31 additions and 8 deletions
+26 -6
View File
@@ -1,4 +1,4 @@
name: Build and Test name: Test
on: on:
push: push:
@@ -7,7 +7,6 @@ on:
branches: [ master ] branches: [ master ]
jobs: jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@@ -17,16 +16,37 @@ jobs:
path: | path: |
~/go/pkg/mod ~/go/pkg/mod
~/go/bin ~/go/bin
~/bin/protoc
~/.cache ~/.cache
key: ${{ runner.os }}-amd64-go-${{ hashFiles('**/go.sum') }} key: livekit-server
restore-keys: | - uses: shogo82148/actions-setup-redis@v1.10.3
${{ runner.os }}-amd64-go- with:
redis-version: '6.x'
auto-start: true
- run: redis-cli ping
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: 1.16 go-version: 1.16
- name: Download Go modules
run: go mod download
- name: Download protoc
run: curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protoc-3.15.8-linux-x86_64.zip
- name: Install protoc
run: sudo unzip protoc-3.15.8-linux-x86_64.zip -d /usr
- run: sudo chmod 755 /usr/bin/protoc
- name: Install protoc-gen-twirp
run: go install github.com/twitchtv/twirp/protoc-gen-twirp
- name: Install protoc-gen-go
run: go install google.golang.org/protobuf/cmd/protoc-gen-go
- name: Mage Build - name: Mage Build
uses: magefile/mage-action@v1 uses: magefile/mage-action@v1
with: with:
+1 -1
View File
@@ -45,7 +45,7 @@ func TestMissingAnswerDuringICERestart(t *testing.T) {
require.NoError(t, transportA.CreateAndSendOffer(nil)) require.NoError(t, transportA.CreateAndSendOffer(nil))
// ensure we are connected the first time // ensure we are connected the first time
time.Sleep(10 * time.Millisecond) time.Sleep(100 * time.Millisecond)
require.Equal(t, webrtc.ICEConnectionStateConnected, transportA.pc.ICEConnectionState()) require.Equal(t, webrtc.ICEConnectionStateConnected, transportA.pc.ICEConnectionState())
require.Equal(t, webrtc.ICEConnectionStateConnected, transportB.pc.ICEConnectionState()) require.Equal(t, webrtc.ICEConnectionStateConnected, transportB.pc.ICEConnectionState())
-1
View File
@@ -340,7 +340,6 @@ func (c *RTCClient) ReadResponse() (*livekit.SignalResponse, error) {
} }
} }
// TODO: this function is not thread safe, need to cleanup
func (c *RTCClient) SubscribedTracks() map[string][]*webrtc.TrackRemote { func (c *RTCClient) SubscribedTracks() map[string][]*webrtc.TrackRemote {
// create a copy of this // create a copy of this
c.lock.Lock() c.lock.Lock()
+4
View File
@@ -5,6 +5,7 @@ import (
"testing" "testing"
"time" "time"
"github.com/livekit/livekit-server/pkg/logger"
testclient "github.com/livekit/livekit-server/test/client" testclient "github.com/livekit/livekit-server/test/client"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@@ -40,6 +41,9 @@ func TestSinglePublisher(t *testing.T) {
return return
} }
logger.Infow("\n\n---Starting TestSinglePublisher---")
defer logger.Infow("---Finishing TestSinglePublisher---")
s := setupSingleNodeTest(testRoom) s := setupSingleNodeTest(testRoom)
defer func() { defer func() {
teardownTest(s, testRoom) teardownTest(s, testRoom)