@@ -20,6 +20,11 @@ import (
2020)
2121
2222func empty () IOCreation {
23+ // TODO (@mlaventure) windows searches for pipes
24+ // when none are provided
25+ if runtime .GOOS == "windows" {
26+ return Stdio
27+ }
2328 return NullIO
2429}
2530
@@ -117,7 +122,7 @@ func TestContainerStart(t *testing.T) {
117122 }
118123 defer container .Delete (ctx , WithSnapshotCleanup )
119124
120- task , err := container .NewTask (ctx , Stdio )
125+ task , err := container .NewTask (ctx , empty () )
121126 if err != nil {
122127 t .Error (err )
123128 return
@@ -471,32 +476,12 @@ func TestContainerCloseIO(t *testing.T) {
471476 t .Error (err )
472477 return
473478 }
474-
475- if _ , err := fmt .Fprint (w , expected ); err != nil {
476- t .Error (err )
477- }
478479 w .Close ()
479480 if err := task .CloseIO (ctx , WithStdinCloser ); err != nil {
480481 t .Error (err )
481482 }
482483
483484 <- statusC
484-
485- if _ , err := task .Delete (ctx ); err != nil {
486- t .Error (err )
487- }
488-
489- output := stdout .String ()
490-
491- if runtime .GOOS == "windows" {
492- // On windows we use more and it always adds an extra newline
493- // remove it here
494- output = strings .TrimSuffix (output , newLine )
495- }
496-
497- if output != expected {
498- t .Errorf ("expected output %q but received %q" , expected , output )
499- }
500485}
501486
502487func TestContainerAttach (t * testing.T ) {
@@ -727,7 +712,7 @@ func TestContainerKill(t *testing.T) {
727712 }
728713 }
729714
730- spec , err := generateSpec (withImageConfig (ctx , image ), withCat ( ))
715+ spec , err := generateSpec (withImageConfig (ctx , image ), withProcessArgs ( "sleep" , "10" ))
731716 if err != nil {
732717 t .Error (err )
733718 return
@@ -739,7 +724,7 @@ func TestContainerKill(t *testing.T) {
739724 }
740725 defer container .Delete (ctx )
741726
742- task , err := container .NewTask (ctx , Stdio )
727+ task , err := container .NewTask (ctx , empty () )
743728 if err != nil {
744729 t .Error (err )
745730 return
@@ -808,7 +793,7 @@ func TestContainerNoBinaryExists(t *testing.T) {
808793 }
809794 defer container .Delete (ctx , WithSnapshotCleanup )
810795
811- task , err := container .NewTask (ctx , Stdio )
796+ task , err := container .NewTask (ctx , empty () )
812797 switch runtime .GOOS {
813798 case "windows" :
814799 if err != nil {
@@ -942,7 +927,7 @@ func TestUserNamespaces(t *testing.T) {
942927 }
943928 defer container .Delete (ctx , WithSnapshotCleanup )
944929
945- task , err := container .NewTask (ctx , Stdio )
930+ task , err := container .NewTask (ctx , empty () )
946931 if err != nil {
947932 t .Error (err )
948933 return
@@ -1018,7 +1003,7 @@ func TestWaitStoppedTask(t *testing.T) {
10181003 }
10191004 defer container .Delete (ctx , WithSnapshotCleanup )
10201005
1021- task , err := container .NewTask (ctx , Stdio )
1006+ task , err := container .NewTask (ctx , empty () )
10221007 if err != nil {
10231008 t .Error (err )
10241009 return
@@ -1193,7 +1178,7 @@ func TestTaskForceDelete(t *testing.T) {
11931178 }
11941179 defer container .Delete (ctx , WithSnapshotCleanup )
11951180
1196- task , err := container .NewTask (ctx , Stdio )
1181+ task , err := container .NewTask (ctx , empty () )
11971182 if err != nil {
11981183 t .Error (err )
11991184 return
@@ -1246,7 +1231,7 @@ func TestProcessForceDelete(t *testing.T) {
12461231 }
12471232 defer container .Delete (ctx , WithSnapshotCleanup )
12481233
1249- task , err := container .NewTask (ctx , Stdio )
1234+ task , err := container .NewTask (ctx , empty () )
12501235 if err != nil {
12511236 t .Error (err )
12521237 return
0 commit comments