Browse Source

speed up tests

pull/474/head
aler9 4 years ago
parent
commit
f225363e7d
  1. 38
      internal/core/core_test.go

38
internal/core/core_test.go

@ -9,6 +9,7 @@ import (
"testing" "testing"
"time" "time"
"github.com/aler9/gortsplib"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -168,15 +169,11 @@ func TestCoreHotReloading(t *testing.T) {
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)
func() { func() {
cnt1, err := newContainer("ffmpeg", "dest", []string{ conn, err := gortsplib.DialRead(
"-i", "rtsp://localhost:8554/test1", "rtsp://localhost:8554/test1",
"-vframes", "1", )
"-f", "image2",
"-y", "/dev/null",
})
require.NoError(t, err) require.NoError(t, err)
defer cnt1.close() defer conn.Close()
require.Equal(t, 0, cnt1.wait())
}() }()
err = ioutil.WriteFile(confPath, []byte("paths:\n"+ err = ioutil.WriteFile(confPath, []byte("paths:\n"+
@ -191,26 +188,17 @@ func TestCoreHotReloading(t *testing.T) {
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)
func() { func() {
cnt1, err := newContainer("ffmpeg", "dest", []string{ _, err := gortsplib.DialRead(
"-i", "rtsp://localhost:8554/test1", "rtsp://localhost:8554/test1",
"-vframes", "1", )
"-f", "image2", require.Equal(t, "invalid status code: 400 (Bad Request)", err.Error())
"-y", "/dev/null",
})
require.NoError(t, err)
defer cnt1.close()
require.Equal(t, 1, cnt1.wait())
}() }()
func() { func() {
cnt1, err := newContainer("ffmpeg", "dest", []string{ conn, err := gortsplib.DialRead(
"-i", "rtsp://localhost:8554/test2", "rtsp://localhost:8554/test2",
"-vframes", "1", )
"-f", "image2",
"-y", "/dev/null",
})
require.NoError(t, err) require.NoError(t, err)
defer cnt1.close() defer conn.Close()
require.Equal(t, 0, cnt1.wait())
}() }()
} }

Loading…
Cancel
Save