diff --git a/scripts/livepeer-nginx b/scripts/livepeer-nginx index e141502e1..a71d92c0c 100755 --- a/scripts/livepeer-nginx +++ b/scripts/livepeer-nginx @@ -104,6 +104,14 @@ http { proxy_pass http://127.0.0.1:9000; } + location /stream/ { + proxy_pass http://127.0.0.1:8935; + } + + location /live/ { + proxy_pass http://127.0.0.1:8935; + } + location / { proxy_pass http://127.0.0.1:3004; } diff --git a/test/e2e/box_record_test.go b/test/e2e/box_record_test.go index d7a2dd6b9..c26a1f929 100644 --- a/test/e2e/box_record_test.go +++ b/test/e2e/box_record_test.go @@ -27,14 +27,36 @@ func TestBoxRecording(t *testing.T) { boxName := randomString("box-") // when - box := startBoxWithEnv(ctx, t, boxName, network.name) + box := startBoxWithEnv(ctx, t, boxName, network.name, []string{}) defer box.Terminate(ctx) err := startRecordTester(ctx) require.NoError(t, err) } -func startBoxWithEnv(ctx context.Context, t *testing.T, hostname, network string) *catalystContainer { +func TestMistSegmentation(t *testing.T) { + if testing.Short() { + t.Skip("skipping testing in short mode") + } + + // given + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + network := createNetwork(ctx, t) + defer network.Remove(ctx) + + boxName := randomString("box-") + + // when + box := startBoxWithEnv(ctx, t, boxName, network.name, []string{"Transcode failed"}) + defer box.Terminate(ctx) + + err := streamMissingHeaders(ctx) + require.NoError(t, err) +} + +func startBoxWithEnv(ctx context.Context, t *testing.T, hostname, network string, failLogs []string) *catalystContainer { req := testcontainers.ContainerRequest{ Image: "livepeer/in-a-box", Hostname: hostname, @@ -51,7 +73,11 @@ func startBoxWithEnv(ctx context.Context, t *testing.T, hostname, network string require.NoError(t, err) // Redirect container logs to the standard logger - lc := logConsumer{name: hostname} + lc := logConsumer{ + name: hostname, + t: t, + failLogs: failLogs, + } err = container.StartLogProducer(ctx) require.NoError(t, err) container.FollowOutput(&lc) @@ -102,6 +128,26 @@ func startRecordTester(ctx context.Context) error { return nil } +func streamMissingHeaders(ctx context.Context) error { + err := run( + ctx, + "ffmpeg", + "-re", + "-i", + "https://storage.googleapis.com/lp_testharness_assets/missing-ts-headers.mkv", + "-c", + "copy", + "-f", + "flv", + "rtmp://127.0.0.1/live/4444-4444-4444-4444", + ) + if err != nil { + return fmt.Errorf("error running ffmpeg: %w", err) + } + + return nil +} + func run(ctx context.Context, prog string, args ...string) error { cmd := exec.CommandContext(ctx, prog, args...) cmd.Stdin = os.Stdin diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index 4ee3570d1..6afa5a04a 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -131,10 +131,18 @@ func mistConfigConnectTo(host string, connectToHost string) mistConfig { } type logConsumer struct { - name string + name string + failLogs []string + t *testing.T } func (lc *logConsumer) Accept(l testcontainers.Log) { + content := string(l.Content) + for _, failLog := range lc.failLogs { + if strings.Contains(content, failLog) { + require.Fail(lc.t, fmt.Sprintf(`Found the phrase "%s" in this log line, indicating failure: %s`, failLog, content)) + } + } glog.Infof("[%s] %s", lc.name, string(l.Content)) }