Skip to content

Commit 399fdd5

Browse files
echlebektommyers-elastic
authored andcommitted
[chore][sumologicextension]: fix flaky test (open-telemetry#43319)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description A test was flaky due to depending on timing and an exact count of a periodic condition. By asserting instead that a minimum count was achieved instead, the problem can be sidestepped. <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes open-telemetry#42867 <!--Describe what testing was performed and which tests were added.--> #### Testing `go test -count 100 -run TestStoreCredentials_PreexistingCredentialsAreUsed` will fail before this change is applied, and succeed after. Signed-off-by: Eric Chlebek <[email protected]>
1 parent 28a0dd6 commit 399fdd5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

extension/sumologicextension/extension_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,10 @@ func TestStoreCredentials_PreexistingCredentialsAreUsed(t *testing.T) {
372372
require.NoError(t, se.Shutdown(t.Context()))
373373
require.FileExists(t, credsPath)
374374

375-
require.EqualValues(t, 2, atomic.LoadInt32(&reqCount))
375+
// Depending on timing, the periodic heartbeat can result in more than
376+
// two requests being made. Testing that at least two requests were made
377+
// should be sufficient to satisfy this test.
378+
require.GreaterOrEqual(t, atomic.LoadInt32(&reqCount), int32(2))
376379
}
377380

378381
func TestStoreCredentials_V2CredentialsAreUsed(t *testing.T) {

0 commit comments

Comments
 (0)