From b63000c65de9ad1ca256459ad60485629718434a Mon Sep 17 00:00:00 2001 From: Gabriel Adrian Samfira Date: Fri, 4 Feb 2022 17:27:14 +0200 Subject: [PATCH] [Windows][Integration] Enable TestRestartMonitor With the release of hcsshim v0.9.2, this test should pass without issues on Windows. Signed-off-by: Gabriel Adrian Samfira --- integration/client/restart_monitor_test.go | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/integration/client/restart_monitor_test.go b/integration/client/restart_monitor_test.go index 77c8b5f5966d..af04ff64caed 100644 --- a/integration/client/restart_monitor_test.go +++ b/integration/client/restart_monitor_test.go @@ -125,13 +125,6 @@ func newDaemonWithConfig(t *testing.T, configTOML string) (*Client, *daemon, fun // TestRestartMonitor tests restarting containers // with the restart monitor service plugin func TestRestartMonitor(t *testing.T) { - if runtime.GOOS == "windows" { - // This test on Windows encounters the following error in some environments: - // "The process cannot access the file because it is being used by another process. (0x20)" - // Skip this test until this error can be evaluated and the appropriate - // test fix or environment configuration can be determined. - t.Skip("Skipping flaky test on Windows") - } const ( interval = 10 * time.Second epsilon = 1 * time.Second @@ -188,10 +181,24 @@ version = 2 t.Fatal(err) } + statusC, err := task.Wait(ctx) + if err != nil { + t.Fatal(err) + } + if err := task.Kill(ctx, syscall.SIGKILL); err != nil { t.Fatal(err) } + // Wait for task exit. If the task takes longer to exit, we risc + // wrongfully determining that the task has been restarted when we + // check the status in the for loop bellow and find that it's still + // running. + select { + case <-statusC: + case <-time.After(30 * time.Second): + } + begin := time.Now() lastCheck := begin