Skip to content

Commit

Permalink
Merge pull request #3355 from amogh09/fix-win-integ-test-exec-command
Browse files Browse the repository at this point in the history
Reduce the flakiness of a windows integration test TestExecCommandAgent
  • Loading branch information
fierlion authored Aug 25, 2022
2 parents 3cf8d8a + 1a89c36 commit 619cd21
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions agent/engine/engine_windows_integ_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,10 @@ func verifyMockExecCommandAgentStatus(t *testing.T, client *sdkClient.Client, co
require.NotEqual(t, -1, pidPos, "PID title not found in the container top response")
for _, proc := range top.Processes {
matched, _ := regexp.MatchString(execCmdAgentProcessRegex, proc[cmdPos])
if matched {
// Process we are checking to be stopped might still be running.
// expectedPid matches the pid of the process in that case, so wait if that's
// the case.
if matched && (checkIsRunning || expectedPid != proc[pidPos]) {
res <- proc[pidPos]
return
}
Expand All @@ -846,7 +849,7 @@ func verifyMockExecCommandAgentStatus(t *testing.T, client *sdkClient.Client, co
select {
case <-ctx.Done():
return
case <-time.After(time.Second * 4):
case <-time.After(time.Second * 1):
}
}
}()
Expand Down Expand Up @@ -887,7 +890,4 @@ func killMockExecCommandAgent(t *testing.T, client *sdkClient.Client, containerI
Detach: true,
})
require.NoError(t, err)

// Windows docker exec takes longer than Linux
time.Sleep(4 * time.Second)
}

0 comments on commit 619cd21

Please sign in to comment.