From ad002bb5e5001347caac0cd53575837c4929d0c4 Mon Sep 17 00:00:00 2001 From: David Colburn Date: Mon, 25 Nov 2024 21:15:47 -0800 Subject: [PATCH] fix test collision with media-mtx, downgrade sdk errors --- pkg/config/base.go | 10 +++++++++- test/edge.go | 8 ++++---- test/multi.go | 6 +++--- test/stream.go | 8 +++++++- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/pkg/config/base.go b/pkg/config/base.go index bfac0703..7c13e3e3 100644 --- a/pkg/config/base.go +++ b/pkg/config/base.go @@ -98,6 +98,14 @@ func (c *BaseConfig) initLogger(values ...interface{}) error { l := zl.WithValues(values...) logger.SetLogger(l, "egress") - lksdk.SetLogger(l) + lksdk.SetLogger(&downgradeLogger{Logger: l}) return nil } + +type downgradeLogger struct { + logger.Logger +} + +func (d *downgradeLogger) Errorw(msg string, err error, keysAndValues ...interface{}) { + d.Logger.Warnw(msg, err, keysAndValues...) +} diff --git a/test/edge.go b/test/edge.go index 6f14b8e0..1c3b6001 100644 --- a/test/edge.go +++ b/test/edge.go @@ -110,7 +110,7 @@ func (r *Runner) testEdgeCases(t *testing.T) { videoCodec: types.MimeTypeVP8, }, streamOptions: &streamOptions{ - streamUrls: []string{rtmpUrl1, badRtmpUrl1}, + streamUrls: []string{rtmpUrl4, badRtmpUrl1}, outputType: types.OutputTypeRTMP, }, segmentOptions: &segmentOptions{ @@ -247,16 +247,16 @@ func (r *Runner) testEmptyStreamBin(t *testing.T, test *testCase) { require.NoError(t, err) r.checkStreamUpdate(t, egressID, map[string]livekit.StreamInfo_Status{ - rtmpUrl1Redacted: livekit.StreamInfo_ACTIVE, + rtmpUrl4Redacted: livekit.StreamInfo_ACTIVE, badRtmpUrl1Redacted: livekit.StreamInfo_FAILED, }) _, err = r.client.UpdateStream(context.Background(), egressID, &livekit.UpdateStreamRequest{ EgressId: egressID, - RemoveOutputUrls: []string{rtmpUrl1}, + RemoveOutputUrls: []string{rtmpUrl4}, }) require.NoError(t, err) r.checkStreamUpdate(t, egressID, map[string]livekit.StreamInfo_Status{ - rtmpUrl1Redacted: livekit.StreamInfo_FINISHED, + rtmpUrl4Redacted: livekit.StreamInfo_FINISHED, badRtmpUrl1Redacted: livekit.StreamInfo_FAILED, }) diff --git a/test/multi.go b/test/multi.go index 5a3b16d6..69bef45c 100644 --- a/test/multi.go +++ b/test/multi.go @@ -125,14 +125,14 @@ func (r *Runner) runMultiTest(t *testing.T, test *testCase) { if test.streamOptions != nil { _, err = r.client.UpdateStream(context.Background(), egressID, &livekit.UpdateStreamRequest{ EgressId: egressID, - AddOutputUrls: []string{rtmpUrl1}, + AddOutputUrls: []string{rtmpUrl3}, }) require.NoError(t, err) time.Sleep(time.Second * 10) - r.verifyStreams(t, p, rtmpUrl1) + r.verifyStreams(t, p, rtmpUrl3) r.checkStreamUpdate(t, egressID, map[string]livekit.StreamInfo_Status{ - rtmpUrl1Redacted: livekit.StreamInfo_ACTIVE, + rtmpUrl3Redacted: livekit.StreamInfo_ACTIVE, }) time.Sleep(time.Second * 10) } else { diff --git a/test/stream.go b/test/stream.go index e66772a6..563c94eb 100644 --- a/test/stream.go +++ b/test/stream.go @@ -49,10 +49,16 @@ const ( var ( streamKey1 = utils.NewGuid("") streamKey2 = utils.NewGuid("") + streamKey3 = utils.NewGuid("") + streamKey4 = utils.NewGuid("") rtmpUrl1 = fmt.Sprintf("rtmp://localhost:1935/live/%s", streamKey1) - rtmpUrl1Redacted, _ = utils.RedactStreamKey(rtmpUrl1) rtmpUrl2 = fmt.Sprintf("rtmp://localhost:1935/live/%s", streamKey2) + rtmpUrl3 = fmt.Sprintf("rtmp://localhost:1935/live/%s", streamKey3) + rtmpUrl4 = fmt.Sprintf("rtmp://localhost:1935/live/%s", streamKey4) + rtmpUrl1Redacted, _ = utils.RedactStreamKey(rtmpUrl1) rtmpUrl2Redacted, _ = utils.RedactStreamKey(rtmpUrl2) + rtmpUrl3Redacted, _ = utils.RedactStreamKey(rtmpUrl3) + rtmpUrl4Redacted, _ = utils.RedactStreamKey(rtmpUrl4) srtPublishUrl1 = fmt.Sprintf("srt://localhost:8890?streamid=publish:%s&pkt_size=1316", streamKey1) srtReadUrl1 = fmt.Sprintf("srt://localhost:8890?streamid=read:%s", streamKey1) srtPublishUrl2 = fmt.Sprintf("srt://localhost:8890?streamid=publish:%s&pkt_size=1316", streamKey2)