@@ -46,7 +46,7 @@ public void afterMethod(ITestResult result) {
46
46
super .afterMethod (result );
47
47
}
48
48
49
- @ Test (groups = "ignoreInCircleCi" )
49
+ @ Test ()
50
50
public void execStart () throws Exception {
51
51
String containerName = "generated_" + new SecureRandom ().nextInt ();
52
52
@@ -58,9 +58,14 @@ public void execStart() throws Exception {
58
58
dockerClient .startContainerCmd (container .getId ()).exec ();
59
59
60
60
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 ();
64
69
65
70
InputStream response = dockerClient .copyArchiveFromContainerCmd (container .getId (), "/execStartTest.log" ).exec ();
66
71
@@ -73,7 +78,7 @@ public void execStart() throws Exception {
73
78
assertTrue (responseAsString .length () > 0 );
74
79
}
75
80
76
- @ Test (groups = "ignoreInCircleCi" )
81
+ @ Test ()
77
82
public void execStartAttached () throws Exception {
78
83
String containerName = "generated_" + new SecureRandom ().nextInt ();
79
84
@@ -85,9 +90,14 @@ public void execStartAttached() throws Exception {
85
90
dockerClient .startContainerCmd (container .getId ()).exec ();
86
91
87
92
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 ();
91
101
92
102
InputStream response = dockerClient .copyArchiveFromContainerCmd (container .getId (), "/execStartTest.log" ).exec ();
93
103
Boolean bytesAvailable = response .available () > 0 ;
@@ -99,7 +109,7 @@ public void execStartAttached() throws Exception {
99
109
assertTrue (responseAsString .length () > 0 );
100
110
}
101
111
102
- @ Test (groups = "ignoreInCircleCi" )
112
+ @ Test ()
103
113
public void execStartAttachStdin () throws Exception {
104
114
String containerName = "generated_" + new SecureRandom ().nextInt ();
105
115
@@ -115,14 +125,23 @@ public void execStartAttachStdin() throws Exception {
115
125
ByteArrayOutputStream stdout = new ByteArrayOutputStream ();
116
126
117
127
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 );
121
139
122
140
assertTrue (completed , "The process was not finished." );
123
141
assertEquals (stdout .toString ("UTF-8" ), "STDIN\n " );
124
142
}
125
143
144
+ @ Test ()
126
145
public void execStartAttachStdinToShell () throws Exception {
127
146
String containerName = "generated_" + new SecureRandom ().nextInt ();
128
147
@@ -156,7 +175,7 @@ public void execStartAttachStdinToShell() throws Exception {
156
175
assertThat (stdout .toString (), containsString ("etc\n " ));
157
176
}
158
177
159
- @ Test (groups = "ignoreInCircleCi" )
178
+ @ Test ()
160
179
public void execStartNotAttachedStdin () throws Exception {
161
180
String containerName = "generated_" + new SecureRandom ().nextInt ();
162
181
@@ -172,11 +191,18 @@ public void execStartNotAttachedStdin() throws Exception {
172
191
ByteArrayOutputStream stdout = new ByteArrayOutputStream ();
173
192
174
193
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 ( );
178
197
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." );
180
206
assertEquals (stdout .toString (), "" );
181
207
}
182
208
}
0 commit comments