Browse code

integration-cli: TestRestartContainer is flaky on GitHub Runner

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>

CrazyMax authored on 2022/05/08 05:28:39
Showing 2 changed files
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"gotest.tools/v3/assert"
12 12
 	is "gotest.tools/v3/assert/cmp"
13 13
 	"gotest.tools/v3/poll"
14
+	"gotest.tools/v3/skip"
14 15
 )
15 16
 
16 17
 func (s *DockerSuite) TestRestartStoppedContainer(c *testing.T) {
... ...
@@ -171,6 +172,7 @@ func (s *DockerSuite) TestRestartContainerSuccess(c *testing.T) {
171 171
 	// such that it assumes there is a host process to kill. In Hyper-V
172 172
 	// containers, the process is inside the utility VM, not on the host.
173 173
 	if DaemonIsWindows() {
174
+		skip.If(c, testEnv.GitHubActions())
174 175
 		testRequires(c, testEnv.DaemonInfo.Isolation.IsProcess)
175 176
 	}
176 177
 
... ...
@@ -247,7 +249,7 @@ func (s *DockerSuite) TestRestartPolicyAfterRestart(c *testing.T) {
247 247
 	// such that it assumes there is a host process to kill. In Hyper-V
248 248
 	// containers, the process is inside the utility VM, not on the host.
249 249
 	if DaemonIsWindows() {
250
-		testRequires(c, testEnv.DaemonInfo.Isolation.IsProcess)
250
+		testRequires(c, testEnv.DaemonInfo.Isolation.IsProcess, testEnv.NotGitHubActions)
251 251
 	}
252 252
 
253 253
 	out := runSleepingContainer(c, "-d", "--restart=always")
... ...
@@ -221,3 +221,8 @@ func EnsureFrozenImagesLinux(testEnv *Execution) error {
221 221
 	}
222 222
 	return nil
223 223
 }
224
+
225
+// GitHubActions is true if test is executed on a GitHub Runner.
226
+func (e *Execution) GitHubActions() bool {
227
+	return os.Getenv("GITHUB_ACTIONS") == "true"
228
+}