integration-cli: TestRestartContainer is flaky on GitHub Runner

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2022-05-07 22:28:39 +02:00
parent 890de00f02
commit 440d051ce9
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
2 changed files with 8 additions and 1 deletions

View File

@ -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")

View File

@ -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"
}