Skip to content

Commit e09dab6

Browse files
authored
[chore] cmd/opampsupervisor: fix flaky test (open-telemetry#43887)
#### Description The status may not be set by the time the test first checks it, so check that rather than panicking. #### Link to tracking issue Fixes open-telemetry#43849 #### Testing Adding a sleep before https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/2dd76008043a199cb539d398ae12156d5db0032d/cmd/opampsupervisor/e2e_test.go#L2074 triggers the bug reliably. The test passes with a sleep there with change in this PR. #### Documentation N/A
1 parent 260e450 commit e09dab6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cmd/opampsupervisor/e2e_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2118,7 +2118,9 @@ func TestSupervisorRemoteConfigApplyStatus(t *testing.T) {
21182118

21192119
// Check that the status is set to APPLYING
21202120
require.EventuallyWithT(t, func(c *assert.CollectT) {
2121-
status := remoteConfigStatus.Load().(*protobufs.RemoteConfigStatus)
2121+
statusVal := remoteConfigStatus.Load()
2122+
require.NotNil(c, statusVal) // not set yet
2123+
status := statusVal.(*protobufs.RemoteConfigStatus)
21222124
t.Log("status", status.Status)
21232125
assert.Equal(c, protobufs.RemoteConfigStatuses_RemoteConfigStatuses_APPLYING, status.Status)
21242126
}, 5*time.Second, 100*time.Millisecond)

0 commit comments

Comments
 (0)