1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2024-12-22 18:32:19 +00:00

Skip stream tests if ffmpeg is not installed

This commit is contained in:
Yohann D'ANELLO 2020-09-30 19:28:30 +02:00
parent 3c21f744e8
commit e8b145550e
2 changed files with 14 additions and 1 deletions

View File

@ -6,7 +6,7 @@ unit_tests:
image: golang:1.15-alpine image: golang:1.15-alpine
stage: test stage: test
before_script: before_script:
- apk add --no-cache build-base ffmpeg gcc - apk add --no-cache build-base gcc
- apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing libsrt-dev - apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing libsrt-dev
script: script:
- go test -v -covermode=count -coverprofile cover.cov ./... - go test -v -covermode=count -coverprofile cover.cov ./...

View File

@ -23,6 +23,19 @@ func TestSplitHostPort(t *testing.T) {
// TestServeSRT Serve a SRT server, stream content during 5 seconds and ensure that it is well received // TestServeSRT Serve a SRT server, stream content during 5 seconds and ensure that it is well received
func TestServeSRT(t *testing.T) { func TestServeSRT(t *testing.T) {
which := exec.Command("which", "ffmpeg")
if err := which.Start(); err != nil {
t.Fatal("Error while checking if ffmpeg got installed:", err)
}
state, err := which.Process.Wait()
if err != nil {
t.Fatal("Error while checking if ffmpeg got installed:", err)
}
if state.ExitCode() != 0 {
// FFMPEG is not installed
t.Skip("WARNING: FFMPEG is not installed. Skipping stream test")
}
go Serve(&Options{ListenAddress: ":9711", MaxClients: 2}) go Serve(&Options{ListenAddress: ":9711", MaxClients: 2})
ffmpeg := exec.Command("ffmpeg", ffmpeg := exec.Command("ffmpeg",