@@ -46,7 +46,7 @@ public void afterMethod(ITestResult result) {
4646 super .afterMethod (result );
4747 }
4848
49- @ Test (groups = "ignoreInCircleCi" )
49+ @ Test ()
5050 public void execStart () throws Exception {
5151 String containerName = "generated_" + new SecureRandom ().nextInt ();
5252
@@ -58,9 +58,14 @@ public void execStart() throws Exception {
5858 dockerClient .startContainerCmd (container .getId ()).exec ();
5959
6060 ExecCreateCmdResponse execCreateCmdResponse = dockerClient .execCreateCmd (container .getId ())
61- .withAttachStdout (true ).withCmd ("touch" , "/execStartTest.log" ).exec ();
62- dockerClient .execStartCmd (execCreateCmdResponse .getId ()).withDetach (false )
63- .exec (new ExecStartResultCallback (System .out , System .err )).awaitCompletion ();
61+ .withAttachStdout (true )
62+ .withCmd ("touch" , "/execStartTest.log" )
63+ .exec ();
64+
65+ dockerClient .execStartCmd (execCreateCmdResponse .getId ())
66+ .withDetach (false )
67+ .exec (new ExecStartResultCallback (System .out , System .err ))
68+ .awaitCompletion ();
6469
6570 InputStream response = dockerClient .copyArchiveFromContainerCmd (container .getId (), "/execStartTest.log" ).exec ();
6671
@@ -73,7 +78,7 @@ public void execStart() throws Exception {
7378 assertTrue (responseAsString .length () > 0 );
7479 }
7580
76- @ Test (groups = "ignoreInCircleCi" )
81+ @ Test ()
7782 public void execStartAttached () throws Exception {
7883 String containerName = "generated_" + new SecureRandom ().nextInt ();
7984
@@ -85,9 +90,14 @@ public void execStartAttached() throws Exception {
8590 dockerClient .startContainerCmd (container .getId ()).exec ();
8691
8792 ExecCreateCmdResponse execCreateCmdResponse = dockerClient .execCreateCmd (container .getId ())
88- .withAttachStdout (true ).withCmd ("touch" , "/execStartTest.log" ).exec ();
89- dockerClient .execStartCmd (execCreateCmdResponse .getId ()).withDetach (false )
90- .exec (new ExecStartResultCallback (System .out , System .err )).awaitCompletion ();
93+ .withAttachStdout (true )
94+ .withCmd ("touch" , "/execStartTest.log" )
95+ .exec ();
96+
97+ dockerClient .execStartCmd (execCreateCmdResponse .getId ())
98+ .withDetach (false )
99+ .exec (new ExecStartResultCallback (System .out , System .err ))
100+ .awaitCompletion ();
91101
92102 InputStream response = dockerClient .copyArchiveFromContainerCmd (container .getId (), "/execStartTest.log" ).exec ();
93103 Boolean bytesAvailable = response .available () > 0 ;
@@ -99,7 +109,7 @@ public void execStartAttached() throws Exception {
99109 assertTrue (responseAsString .length () > 0 );
100110 }
101111
102- @ Test (groups = "ignoreInCircleCi" )
112+ @ Test ()
103113 public void execStartAttachStdin () throws Exception {
104114 String containerName = "generated_" + new SecureRandom ().nextInt ();
105115
@@ -115,14 +125,23 @@ public void execStartAttachStdin() throws Exception {
115125 ByteArrayOutputStream stdout = new ByteArrayOutputStream ();
116126
117127 ExecCreateCmdResponse execCreateCmdResponse = dockerClient .execCreateCmd (container .getId ())
118- .withAttachStdout (true ).withAttachStdin (true ).withCmd ("cat" ).exec ();
119- boolean completed = dockerClient .execStartCmd (execCreateCmdResponse .getId ()).withDetach (false ).withTty (true ).withStdIn (stdin )
120- .exec (new ExecStartResultCallback (stdout , System .err )).awaitCompletion (5 , TimeUnit .SECONDS );
128+ .withAttachStdout (true )
129+ .withAttachStdin (true )
130+ .withCmd ("cat" )
131+ .exec ();
132+
133+ boolean completed = dockerClient .execStartCmd (execCreateCmdResponse .getId ())
134+ .withDetach (false )
135+ .withTty (true )
136+ .withStdIn (stdin )
137+ .exec (new ExecStartResultCallback (stdout , System .err ))
138+ .awaitCompletion (5 , TimeUnit .SECONDS );
121139
122140 assertTrue (completed , "The process was not finished." );
123141 assertEquals (stdout .toString ("UTF-8" ), "STDIN\n " );
124142 }
125143
144+ @ Test ()
126145 public void execStartAttachStdinToShell () throws Exception {
127146 String containerName = "generated_" + new SecureRandom ().nextInt ();
128147
@@ -156,7 +175,7 @@ public void execStartAttachStdinToShell() throws Exception {
156175 assertThat (stdout .toString (), containsString ("etc\n " ));
157176 }
158177
159- @ Test (groups = "ignoreInCircleCi" )
178+ @ Test ()
160179 public void execStartNotAttachedStdin () throws Exception {
161180 String containerName = "generated_" + new SecureRandom ().nextInt ();
162181
@@ -172,11 +191,18 @@ public void execStartNotAttachedStdin() throws Exception {
172191 ByteArrayOutputStream stdout = new ByteArrayOutputStream ();
173192
174193 ExecCreateCmdResponse execCreateCmdResponse = dockerClient .execCreateCmd (container .getId ())
175- .withAttachStdout (true ). withAttachStdin ( false ). withCmd ( "/bin/sh" ). exec ();
176- boolean completed = dockerClient . execStartCmd ( execCreateCmdResponse . getId ()). withDetach ( false ). withStdIn ( stdin )
177- .exec ( new ExecStartResultCallback ( stdout , System . err )). awaitCompletion ( 5 , TimeUnit . SECONDS );
194+ .withAttachStdout (true )
195+ . withAttachStdin ( false )
196+ .withCmd ( "/bin/sh" ). exec ( );
178197
179- assertTrue (completed , "The process was not finished." );
198+ boolean completed = dockerClient .execStartCmd (execCreateCmdResponse .getId ())
199+ .withDetach (false )
200+ .withStdIn (stdin )
201+ .exec (new ExecStartResultCallback (stdout , System .err ))
202+ .awaitCompletion (5 , TimeUnit .SECONDS );
203+
204+ // with v1.22 of the remote api the server closed the connection when no stdin was attached while exec create, so completed was true
205+ assertFalse (completed , "The process was not finished." );
180206 assertEquals (stdout .toString (), "" );
181207 }
182208}
0 commit comments