Browse Source

integration-cli: TestRestartContainer is flaky on GitHub Runner

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
CrazyMax 3 years ago
parent
commit
440d051ce9

+ 3 - 1
integration-cli/docker_cli_restart_test.go

@@ -11,6 +11,7 @@ import (
 	"gotest.tools/v3/assert"
 	"gotest.tools/v3/assert"
 	is "gotest.tools/v3/assert/cmp"
 	is "gotest.tools/v3/assert/cmp"
 	"gotest.tools/v3/poll"
 	"gotest.tools/v3/poll"
+	"gotest.tools/v3/skip"
 )
 )
 
 
 func (s *DockerSuite) TestRestartStoppedContainer(c *testing.T) {
 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
 	// 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.
 	// containers, the process is inside the utility VM, not on the host.
 	if DaemonIsWindows() {
 	if DaemonIsWindows() {
+		skip.If(c, testEnv.GitHubActions())
 		testRequires(c, testEnv.DaemonInfo.Isolation.IsProcess)
 		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
 	// 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.
 	// containers, the process is inside the utility VM, not on the host.
 	if DaemonIsWindows() {
 	if DaemonIsWindows() {
-		testRequires(c, testEnv.DaemonInfo.Isolation.IsProcess)
+		testRequires(c, testEnv.DaemonInfo.Isolation.IsProcess, testEnv.NotGitHubActions)
 	}
 	}
 
 
 	out := runSleepingContainer(c, "-d", "--restart=always")
 	out := runSleepingContainer(c, "-d", "--restart=always")

+ 5 - 0
testutil/environment/environment.go

@@ -221,3 +221,8 @@ func EnsureFrozenImagesLinux(testEnv *Execution) error {
 	}
 	}
 	return nil
 	return nil
 }
 }
+
+// GitHubActions is true if test is executed on a GitHub Runner.
+func (e *Execution) GitHubActions() bool {
+	return os.Getenv("GITHUB_ACTIONS") == "true"
+}