Improve test CI (#262)

* minimal change

* Better test format for GH CI

* Give server a bit longer to startup, to improve GH test
This commit is contained in:
David Zhao
2021-12-14 17:15:08 -08:00
committed by GitHub
parent 0d0a275101
commit c08d1e9d72
4 changed files with 45 additions and 33 deletions
+15 -4
View File
@@ -30,6 +30,9 @@ jobs:
with: with:
go-version: 1.17 go-version: 1.17
- name: Set up gotestfmt
run: go install github.com/haveyoudebuggedit/gotestfmt/v2/cmd/gotestfmt@latest
- name: Download Go modules - name: Download Go modules
run: go mod download run: go mod download
@@ -39,8 +42,16 @@ jobs:
version: latest version: latest
args: build args: build
- name: Mage Test - name: Test
uses: magefile/mage-action@v1 run: |
set -euo pipefail
go test -json -v ./... 2>&1 | tee /tmp/gotest.log | gotestfmt
# Upload the original go test log as an artifact for later review.
- name: Upload test log
uses: actions/upload-artifact@v2
if: always()
with: with:
version: latest name: test-log
args: testall path: /tmp/gotest.log
if-no-files-found: error
+2 -2
View File
@@ -117,7 +117,7 @@ func PublishDocker() error {
// run unit tests, skipping integration // run unit tests, skipping integration
func Test() error { func Test() error {
mg.Deps(generateWire) mg.Deps(generateWire)
cmd := exec.Command("go", "test", "-short", "./...") cmd := exec.Command("go", "test", "-v", "-short", "./...")
connectStd(cmd) connectStd(cmd)
return cmd.Run() return cmd.Run()
} }
@@ -126,7 +126,7 @@ func Test() error {
func TestAll() error { func TestAll() error {
mg.Deps(generateWire) mg.Deps(generateWire)
// "-v", "-race", // "-v", "-race",
cmd := exec.Command("go", "test", "./...", "-count=1", "-timeout=4m") cmd := exec.Command("go", "test", "-v", "./...", "-count=1", "-timeout=4m")
connectStd(cmd) connectStd(cmd)
return cmd.Run() return cmd.Run()
} }
+1
View File
@@ -241,6 +241,7 @@ func (r *RoomManager) StartSession(ctx context.Context, roomName string, pi rout
Hidden: pi.Hidden, Hidden: pi.Hidden,
Logger: pLogger, Logger: pLogger,
}) })
if err != nil { if err != nil {
logger.Errorw("could not create participant", err) logger.Errorw("could not create participant", err)
return return
+2 -2
View File
@@ -11,7 +11,7 @@ import (
"time" "time"
"github.com/livekit/protocol/auth" "github.com/livekit/protocol/auth"
livekit "github.com/livekit/protocol/livekit" "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger" "github.com/livekit/protocol/logger"
"github.com/livekit/protocol/utils" "github.com/livekit/protocol/utils"
"github.com/pion/turn/v2" "github.com/pion/turn/v2"
@@ -183,7 +183,7 @@ func (s *LivekitServer) Start() error {
go s.backgroundWorker() go s.backgroundWorker()
// give time for Serve goroutine to start // give time for Serve goroutine to start
time.Sleep(10 * time.Millisecond) time.Sleep(100 * time.Millisecond)
s.running.TrySet(true) s.running.TrySet(true)