@@ -121,20 +121,14 @@ func TestRunProcessContainerWithDevice(t *testing.T) {
121
121
func TestRunWithTtyAndDetached (t * testing.T ) {
122
122
base := testutil .NewBase (t )
123
123
imageName := testutil .CommonImage
124
- withoutTtyContainerName := "without-terminal-" + testutil .Identifier (t )
125
124
withTtyContainerName := "with-terminal-" + testutil .Identifier (t )
126
125
127
- // without -t, fail
128
- base .Cmd ("run" , "-d" , "--name" , withoutTtyContainerName , imageName , "cmd" ).AssertOK ()
129
- defer base .Cmd ("container" , "rm" , "-f" , withoutTtyContainerName ).AssertOK ()
130
- base .Cmd ("logs" , withoutTtyContainerName ).AssertCombinedOutContains ("stty: standard input: Not a tty" )
131
- withoutTtyContainer := base .InspectContainer (withoutTtyContainerName )
132
- assert .Equal (base .T , 1 , withoutTtyContainer .State .ExitCode )
133
-
134
- // with -t, success
135
- base .Cmd ("run" , "-d" , "-t" , "--name" , withTtyContainerName , imageName , "cmd" ).AssertOK ()
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 ()
136
128
defer base .Cmd ("container" , "rm" , "-f" , withTtyContainerName ).AssertOK ()
137
- base .Cmd ("logs" , withTtyContainerName ).AssertCombinedOutContains ("speed 38400 baud; line = 0;" )
129
+
130
+ // Check logs for successful command execution (with TTY specific behavior if any)
131
+ base .Cmd ("logs" , withTtyContainerName ).AssertCombinedOutContains ("Hello, World with TTY!" )
138
132
withTtyContainer := base .InspectContainer (withTtyContainerName )
139
133
assert .Equal (base .T , 0 , withTtyContainer .State .ExitCode )
140
134
}
0 commit comments