Skip to content

Commit 5ef3856

Browse files
authored
Merge pull request containerd#3541 from apostasie/disable-3437
Skip TestRunWithTtyAndDetached on Windows
2 parents 62a8286 + bf39542 commit 5ef3856

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

cmd/nerdctl/container/container_run_windows_test.go

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import (
2525
"gotest.tools/v3/assert"
2626

2727
"github.com/containerd/nerdctl/v2/pkg/testutil"
28+
"github.com/containerd/nerdctl/v2/pkg/testutil/nerdtest"
29+
"github.com/containerd/nerdctl/v2/pkg/testutil/test"
2830
)
2931

3032
func TestRunHostProcessContainer(t *testing.T) {
@@ -119,16 +121,27 @@ func TestRunProcessContainerWithDevice(t *testing.T) {
119121
}
120122

121123
func TestRunWithTtyAndDetached(t *testing.T) {
122-
base := testutil.NewBase(t)
123-
imageName := testutil.CommonImage
124-
withTtyContainerName := "with-terminal-" + testutil.Identifier(t)
124+
testCase := nerdtest.Setup()
125+
126+
// This test is currently disabled, as it is failing most of the time.
127+
testCase.Require = nerdtest.NerdctlNeedsFixing("https://github.com/containerd/nerdctl/issues/3437")
128+
129+
testCase.Setup = func(data test.Data, helpers test.Helpers) {
130+
// with -t, success, the container should run with tty support.
131+
helpers.Ensure("run", "-d", "-t", "--name", data.Identifier("with-terminal"), testutil.CommonImage, "cmd", "/c", "echo", "Hello, World with TTY!")
132+
}
133+
134+
testCase.Cleanup = func(data test.Data, helpers test.Helpers) {
135+
helpers.Anyhow("container", "rm", "-f", data.Identifier("with-terminal"))
136+
}
137+
138+
testCase.Command = func(data test.Data, helpers test.Helpers) test.TestableCommand {
139+
withTtyContainer := nerdtest.InspectContainer(helpers, data.Identifier("with-terminal"))
140+
assert.Equal(helpers.T(), 0, withTtyContainer.State.ExitCode)
141+
return helpers.Command("logs", data.Identifier("with-terminal"))
142+
}
125143

126-
// with -t, success, the container should run with tty support.
127-
base.Cmd("run", "-d", "-t", "--name", withTtyContainerName, imageName, "cmd", "/c", "echo", "Hello, World with TTY!").AssertOK()
128-
defer base.Cmd("container", "rm", "-f", withTtyContainerName).AssertOK()
144+
testCase.Expected = test.Expects(0, nil, test.Contains("Hello, World with TTY!"))
129145

130-
// Check logs for successful command execution (with TTY specific behavior if any)
131-
base.Cmd("logs", withTtyContainerName).AssertOutContains("Hello, World with TTY!")
132-
withTtyContainer := base.InspectContainer(withTtyContainerName)
133-
assert.Equal(base.T, 0, withTtyContainer.State.ExitCode)
146+
testCase.Run(t)
134147
}

0 commit comments

Comments
 (0)