@@ -194,18 +194,26 @@ func TestLogsWithRunningContainer(t *testing.T) {
194
194
}
195
195
196
196
func TestLogsWithoutNewlineOrEOF (t * testing.T ) {
197
- if runtime .GOOS != "linux" {
198
- t .Skip ("FIXME: test does not work on Windows yet because containerd doesn't send an exit event appropriately after task exit on Windows" )
197
+ testCase := nerdtest .Setup ()
198
+ // FIXME: test does not work on Windows yet because containerd doesn't send an exit event appropriately after task exit on Windows")
199
+ // FIXME: nerdctl behavior does not match docker - test disabled for nerdctl until we fix
200
+ testCase .Require = require .All (
201
+ require .Linux ,
202
+ nerdtest .NerdctlNeedsFixing ("https://github.com/containerd/nerdctl/issues/4201" ),
203
+ )
204
+ testCase .Setup = func (data test.Data , helpers test.Helpers ) {
205
+ helpers .Ensure ("run" , "-d" , "--name" , data .Identifier (), testutil .CommonImage , "printf" , "'Hello World!\n There is no newline'" )
199
206
}
200
- t .Parallel ()
201
- base := testutil .NewBase (t )
202
- containerName := testutil .Identifier (t )
203
- defer base .Cmd ("rm" , "-f" , containerName ).Run ()
204
- expected := []string {"Hello World!" , "There is no newline" }
205
- base .Cmd ("run" , "-d" , "--name" , containerName , testutil .CommonImage ,
206
- "printf" , "'Hello World!\n There is no newline'" ).AssertOK ()
207
- time .Sleep (3 * time .Second )
208
- base .Cmd ("logs" , "-f" , containerName ).AssertOutContainsAll (expected ... )
207
+ testCase .Cleanup = func (data test.Data , helpers test.Helpers ) {
208
+ helpers .Anyhow ("rm" , "-f" , data .Identifier ())
209
+ }
210
+ testCase .Command = func (data test.Data , helpers test.Helpers ) test.TestableCommand {
211
+ // FIXME: arbitrary timeouts are by nature a problem.
212
+ time .Sleep (5 * time .Second )
213
+ return helpers .Command ("logs" , "-f" , data .Identifier ())
214
+ }
215
+ testCase .Expected = test .Expects (0 , nil , expect .Equals ("'Hello World!\n There is no newline'" ))
216
+ testCase .Run (t )
209
217
}
210
218
211
219
func TestLogsAfterRestartingContainer (t * testing.T ) {
0 commit comments