[Windows][Integration] Enable TestRestartMonitor
With the release of hcsshim v0.9.2, this test should pass without
issues on Windows.
@@ -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
