Merge pull request #6515 from gabriel-samfira/enable-restart-monitor

[Windows][Integration] Enable TestRestartMonitor
This commit is contained in:
Phil Estes 2022-02-16 10:37:29 -05:00 committed by GitHub
commit 39afc6fd47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -125,13 +125,6 @@ func newDaemonWithConfig(t *testing.T, configTOML string) (*Client, *daemon, fun
// TestRestartMonitor tests restarting containers // TestRestartMonitor tests restarting containers
// with the restart monitor service plugin // with the restart monitor service plugin
func TestRestartMonitor(t *testing.T) { 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 ( const (
interval = 10 * time.Second interval = 10 * time.Second
epsilon = 1 * time.Second epsilon = 1 * time.Second
@ -188,10 +181,24 @@ version = 2
t.Fatal(err) t.Fatal(err)
} }
statusC, err := task.Wait(ctx)
if err != nil {
t.Fatal(err)
}
if err := task.Kill(ctx, syscall.SIGKILL); err != nil { if err := task.Kill(ctx, syscall.SIGKILL); err != nil {
t.Fatal(err) 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() begin := time.Now()
lastCheck := begin lastCheck := begin