Skip to content

Commit

Permalink
fix flaky TestHandleEBSAckTimeout test for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
mye956 committed Sep 12, 2023
1 parent e7e9eca commit e8599e1
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions agent/ebs/watcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,17 @@ func TestHandleEBSAckTimeout(t *testing.T) {
watcher := newTestEBSWatcher(ctx, taskEngineState, eventChannel, mockDiscoveryClient)

watcher.HandleResourceAttachment(ebsAttachment)
time.Sleep(10 * time.Millisecond)
assert.Len(t, taskEngineState.(*dockerstate.DockerTaskEngineState).GetAllEBSAttachments(), 0)
ebsAttachment, ok := taskEngineState.(*dockerstate.DockerTaskEngineState).GetEBSByVolumeId(volumeID)
assert.False(t, ok)

for {
time.Sleep(time.Millisecond * 5)
if len(taskEngineState.(*dockerstate.DockerTaskEngineState).GetAllEBSAttachments()) == 0 {
// TODO Include a data client check. This will be introduced in a near future PR
_, ok := taskEngineState.(*dockerstate.DockerTaskEngineState).GetEBSByVolumeId(volumeID)
assert.False(t, ok)
break
}
}

}

// TestHandleMismatchEBSAttachment tests handling an EBS attachment but found a different volume attached
Expand Down

0 comments on commit e8599e1

Please sign in to comment.