From 440d051ce99ce658654361f015e5dc445fca64b8 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Sat, 7 May 2022 22:28:39 +0200 Subject: [PATCH] integration-cli: TestRestartContainer is flaky on GitHub Runner Signed-off-by: CrazyMax --- integration-cli/docker_cli_restart_test.go | 4 +++- testutil/environment/environment.go | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/integration-cli/docker_cli_restart_test.go b/integration-cli/docker_cli_restart_test.go index 465afc6b27..95c145a484 100644 --- a/integration-cli/docker_cli_restart_test.go +++ b/integration-cli/docker_cli_restart_test.go @@ -11,6 +11,7 @@ import ( "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" "gotest.tools/v3/poll" + "gotest.tools/v3/skip" ) func (s *DockerSuite) TestRestartStoppedContainer(c *testing.T) { @@ -171,6 +172,7 @@ func (s *DockerSuite) TestRestartContainerSuccess(c *testing.T) { // such that it assumes there is a host process to kill. In Hyper-V // containers, the process is inside the utility VM, not on the host. if DaemonIsWindows() { + skip.If(c, testEnv.GitHubActions()) testRequires(c, testEnv.DaemonInfo.Isolation.IsProcess) } @@ -247,7 +249,7 @@ func (s *DockerSuite) TestRestartPolicyAfterRestart(c *testing.T) { // such that it assumes there is a host process to kill. In Hyper-V // containers, the process is inside the utility VM, not on the host. if DaemonIsWindows() { - testRequires(c, testEnv.DaemonInfo.Isolation.IsProcess) + testRequires(c, testEnv.DaemonInfo.Isolation.IsProcess, testEnv.NotGitHubActions) } out := runSleepingContainer(c, "-d", "--restart=always") diff --git a/testutil/environment/environment.go b/testutil/environment/environment.go index ea08d97181..88a9a7cf27 100644 --- a/testutil/environment/environment.go +++ b/testutil/environment/environment.go @@ -221,3 +221,8 @@ func EnsureFrozenImagesLinux(testEnv *Execution) error { } return nil } + +// GitHubActions is true if test is executed on a GitHub Runner. +func (e *Execution) GitHubActions() bool { + return os.Getenv("GITHUB_ACTIONS") == "true" +}