Skip to content

Commit 2c43bda

Browse files
authored
fix: remove racy syncTimeCh length assertions in big segment sync tests (#624)
The `len(storeMock.syncTimeCh) == 0` checks race with the sync goroutine which, after writing to patchCh, can complete remaining polls, connect the stream, and call setSynced() before the test checks the channel length. The meaningful behaviors are already covered by patch, poll request, and sync time assertions.
1 parent 61a1eeb commit 2c43bda

1 file changed

Lines changed: 0 additions & 4 deletions

File tree

internal/bigsegments/sync_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ func TestSyncSendsUpdates(t *testing.T) {
226226
pollReq1 := helpers.RequireValue(t, requestsCh, time.Second)
227227
assertPollRequest(t, pollReq1, "")
228228
requirePatch(t, storeMock, poll1Patch1)
229-
require.Equal(t, 0, len(storeMock.syncTimeCh))
230229

231230
pollReq2 := helpers.RequireValue(t, requestsCh, time.Second)
232231
assertPollRequest(t, pollReq2, poll1Patch1.Version)
@@ -305,7 +304,6 @@ func TestSyncSkipsOutOfOrderUpdateFromPoll(t *testing.T) {
305304
pollReq1 := helpers.RequireValue(t, requestsCh, time.Second)
306305
assertPollRequest(t, pollReq1, "")
307306
requirePatch(t, storeMock, patch1)
308-
require.Equal(t, 0, len(storeMock.syncTimeCh))
309307

310308
pollReq2 := helpers.RequireValue(t, requestsCh, time.Second)
311309
assertPollRequest(t, pollReq2, patch1.Version)
@@ -382,7 +380,6 @@ func TestSyncSkipsOutOfOrderUpdateFromStreamAndRestartsStream(t *testing.T) {
382380
pollReq1 := helpers.RequireValue(t, requestsCh, time.Second)
383381
assertPollRequest(t, pollReq1, "")
384382
requirePatch(t, storeMock, patch1)
385-
require.Equal(t, 0, len(storeMock.syncTimeCh))
386383

387384
pollReq2 := helpers.RequireValue(t, requestsCh, time.Second)
388385
assertPollRequest(t, pollReq2, patch1.Version)
@@ -471,7 +468,6 @@ func TestSyncRetryIfStreamFails(t *testing.T) {
471468
pollReq1 := helpers.RequireValue(t, requestsCh, time.Second)
472469
assertPollRequest(t, pollReq1, "")
473470
requirePatch(t, storeMock, patch1)
474-
require.Equal(t, 0, len(storeMock.syncTimeCh))
475471

476472
pollReq2 := helpers.RequireValue(t, requestsCh, time.Second)
477473
assertPollRequest(t, pollReq2, patch1.Version)

0 commit comments

Comments
 (0)