test: fix TestEgressStore updating the wrong egress info (#5078)

The test mutates info2 (room "another-egress-test") to COMPLETE with an
EndedAt 24h in the past, then persists `info` instead of `info2`. So info2
stays STARTING forever, CleanEndedEgress never removes it, and the record
leaks into whatever Redis the suite ran against.

The leak is invisible because the final assertion only lists the primary
room. It surfaces on the NEXT run: utils_test.go:49 prefers a reachable
localhost:6379 over an ephemeral dockertest container, so against a
persistent Redis the list-all assertion grows by one record per run and
TestEgressStore starts failing with "should have 2 item(s), but has 3".

With info2 persisted, CleanEndedEgress removes both records and the test
cleans up after itself. Verified: 3 consecutive runs green, zero keys left.
This commit is contained in:
Elliot Morales Solé authored and GitHub committed 2026-10-27 16:27:34 +01:00
1 parent 37901309a3
commit 6db4a7ab8c
1 file changed
+1 -1
+1 -1
View File
@@ -209,7 +209,7 @@ func TestEgressStore(t *testing.T) {
// update
info2.Status = livekit.EgressStatus_EGRESS_COMPLETE
info2.EndedAt = time.Now().Add(-24 * time.Hour).UnixNano()
require.NoError(t, rs.UpdateEgress(ctx, info))
require.NoError(t, rs.UpdateEgress(ctx, info2))
// list
list, err := rs.ListEgress(ctx, "", false)