From 4c77b092fa5e3acb0e5acf99bef4d529774306cc Mon Sep 17 00:00:00 2001 From: Daniel Jaglowski Date: Fri, 13 Sep 2024 12:13:04 -0500 Subject: [PATCH] [chore] Force require.EventuallyWithT to fail properly (#35032) I noticed on #34720 and #35026 that execution of the test continued beyond a failure of `require.EventuallyWithT`. Based on the description alone, I would expect that using `assert` within `require.EventuallyWithT` should cause execution to stop if the assertion fails, but it appears this may not be the case. However, this change apparently works as intended. --- receiver/windowseventlogreceiver/receiver_windows_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/receiver/windowseventlogreceiver/receiver_windows_test.go b/receiver/windowseventlogreceiver/receiver_windows_test.go index a97abdb06c30..fd000ac0922e 100644 --- a/receiver/windowseventlogreceiver/receiver_windows_test.go +++ b/receiver/windowseventlogreceiver/receiver_windows_test.go @@ -327,7 +327,7 @@ func requireExpectedLogRecords(t *testing.T, sink *consumertest.LogsSink, expect // logs sometimes take a while to be written, so a substantial wait buffer is needed require.EventuallyWithT(t, func(c *assert.CollectT) { actualLogRecords = filterAllLogRecordsBySource(t, sink, expectedEventSrc) - assert.Len(c, actualLogRecords, expectedEventCount) + require.Len(c, actualLogRecords, expectedEventCount) }, 10*time.Second, 250*time.Millisecond) return actualLogRecords