@@ -26,7 +26,7 @@ var _ = Describe("Podman restart", func() {
2626
2727session := podmanTest .Podman ([]string {"restart" , "test1" })
2828session .WaitWithDefaultTimeout ()
29- Expect (session ).Should (Exit ( 0 ))
29+ Expect (session ).Should (ExitCleanly ( ))
3030restartTime := podmanTest .Podman ([]string {"inspect" , "--format='{{.State.StartedAt}}'" , "test1" })
3131restartTime .WaitWithDefaultTimeout ()
3232Expect (restartTime .OutputToString ()).To (Not (Equal (startTime .OutputToString ())))
@@ -35,18 +35,18 @@ var _ = Describe("Podman restart", func() {
3535It ("podman restart stopped container by ID" , func () {
3636session := podmanTest .Podman ([]string {"create" , ALPINE , "ls" })
3737session .WaitWithDefaultTimeout ()
38- Expect (session ).Should (Exit ( 0 ))
38+ Expect (session ).Should (ExitCleanly ( ))
3939cid := session .OutputToString ()
4040startTime := podmanTest .Podman ([]string {"inspect" , "--format='{{.State.StartedAt}}'" , cid })
4141startTime .WaitWithDefaultTimeout ()
4242
4343startSession := podmanTest .Podman ([]string {"start" , "--attach" , cid })
4444startSession .WaitWithDefaultTimeout ()
45- Expect (startSession ).Should (Exit ( 0 ))
45+ Expect (startSession ).Should (ExitCleanly ( ))
4646
4747session2 := podmanTest .Podman ([]string {"restart" , cid })
4848session2 .WaitWithDefaultTimeout ()
49- Expect (session2 ).Should (Exit ( 0 ))
49+ Expect (session2 ).Should (ExitCleanly ( ))
5050restartTime := podmanTest .Podman ([]string {"inspect" , "--format='{{.State.StartedAt}}'" , cid })
5151restartTime .WaitWithDefaultTimeout ()
5252Expect (restartTime .OutputToString ()).To (Not (Equal (startTime .OutputToString ())))
@@ -61,7 +61,7 @@ var _ = Describe("Podman restart", func() {
6161
6262session := podmanTest .Podman ([]string {"restart" , "test1" })
6363session .WaitWithDefaultTimeout ()
64- Expect (session ).Should (Exit ( 0 ))
64+ Expect (session ).Should (ExitCleanly ( ))
6565restartTime := podmanTest .Podman ([]string {"inspect" , "--format='{{.State.StartedAt}}'" , "test1" })
6666restartTime .WaitWithDefaultTimeout ()
6767Expect (restartTime .OutputToString ()).To (Not (Equal (startTime .OutputToString ())))
@@ -76,7 +76,7 @@ var _ = Describe("Podman restart", func() {
7676
7777session := podmanTest .Podman ([]string {"container" , "restart" , "test1" })
7878session .WaitWithDefaultTimeout ()
79- Expect (session ).Should (Exit ( 0 ))
79+ Expect (session ).Should (ExitCleanly ( ))
8080restartTime := podmanTest .Podman ([]string {"container" , "inspect" , "--format='{{.State.StartedAt}}'" , "test1" })
8181restartTime .WaitWithDefaultTimeout ()
8282Expect (restartTime .OutputToString ()).To (Not (Equal (startTime .OutputToString ())))
@@ -93,7 +93,7 @@ var _ = Describe("Podman restart", func() {
9393
9494session := podmanTest .Podman ([]string {"restart" , "test1" , "test2" })
9595session .WaitWithDefaultTimeout ()
96- Expect (session ).Should (Exit ( 0 ))
96+ Expect (session ).Should (ExitCleanly ( ))
9797restartTime := podmanTest .Podman ([]string {"inspect" , "--format='{{.State.StartedAt}}'" , "test1" , "test2" })
9898restartTime .WaitWithDefaultTimeout ()
9999Expect (restartTime .OutputToStringArray ()[0 ]).To (Not (Equal (startTime .OutputToStringArray ()[0 ])))
@@ -116,7 +116,7 @@ var _ = Describe("Podman restart", func() {
116116}
117117session := podmanTest .Podman ([]string {"restart" , cid })
118118session .WaitWithDefaultTimeout ()
119- Expect (session ).Should (Exit ( 0 ))
119+ Expect (session ).Should (ExitCleanly ( ))
120120restartTime := podmanTest .Podman ([]string {"inspect" , "--format='{{.State.StartedAt}}'" , "test1" , "test2" })
121121restartTime .WaitWithDefaultTimeout ()
122122Expect (restartTime .OutputToStringArray ()[0 ]).To (Equal (startTime .OutputToStringArray ()[0 ]))
@@ -126,14 +126,20 @@ var _ = Describe("Podman restart", func() {
126126It ("podman restart non-stop container with short timeout" , func () {
127127session := podmanTest .Podman ([]string {"run" , "-d" , "--name" , "test1" , "--env" , "STOPSIGNAL=SIGKILL" , ALPINE , "sleep" , "999" })
128128session .WaitWithDefaultTimeout ()
129- Expect (session ).Should (Exit ( 0 ))
129+ Expect (session ).Should (ExitCleanly ( ))
130130startTime := time .Now ()
131131session = podmanTest .Podman ([]string {"restart" , "-t" , "2" , "test1" })
132132session .WaitWithDefaultTimeout ()
133133Expect (session ).Should (Exit (0 ))
134134timeSince := time .Since (startTime )
135135Expect (timeSince ).To (BeNumerically ("<" , 10 * time .Second ))
136136Expect (timeSince ).To (BeNumerically (">" , 2 * time .Second ))
137+ stderr := session .ErrorToString ()
138+ if IsRemote () {
139+ Expect (stderr ).To (BeEmpty ())
140+ } else {
141+ Expect (stderr ).To (ContainSubstring ("StopSignal SIGTERM failed to stop container test1 in 2 seconds, resorting to SIGKILL" ))
142+ }
137143})
138144
139145It ("podman restart --all" , func () {
@@ -142,14 +148,14 @@ var _ = Describe("Podman restart", func() {
142148
143149test2 := podmanTest .RunTopContainer ("test2" )
144150test2 .WaitWithDefaultTimeout ()
145- Expect (test2 ).Should (Exit ( 0 ))
151+ Expect (test2 ).Should (ExitCleanly ( ))
146152
147153startTime := podmanTest .Podman ([]string {"inspect" , "--format='{{.State.StartedAt}}'" , "test1" , "test2" })
148154startTime .WaitWithDefaultTimeout ()
149155
150156session := podmanTest .Podman ([]string {"restart" , "--all" })
151157session .WaitWithDefaultTimeout ()
152- Expect (session ).Should (Exit ( 0 ))
158+ Expect (session ).Should (ExitCleanly ( ))
153159restartTime := podmanTest .Podman ([]string {"inspect" , "--format='{{.State.StartedAt}}'" , "test1" , "test2" })
154160restartTime .WaitWithDefaultTimeout ()
155161Expect (restartTime .OutputToStringArray ()[0 ]).To (Not (Equal (startTime .OutputToStringArray ()[0 ])))
@@ -162,14 +168,14 @@ var _ = Describe("Podman restart", func() {
162168
163169test2 := podmanTest .RunTopContainer ("test2" )
164170test2 .WaitWithDefaultTimeout ()
165- Expect (test2 ).Should (Exit ( 0 ))
171+ Expect (test2 ).Should (ExitCleanly ( ))
166172
167173startTime := podmanTest .Podman ([]string {"inspect" , "--format='{{.State.StartedAt}}'" , "test1" , "test2" })
168174startTime .WaitWithDefaultTimeout ()
169175
170176session := podmanTest .Podman ([]string {"restart" , "-a" , "--running" })
171177session .WaitWithDefaultTimeout ()
172- Expect (session ).Should (Exit ( 0 ))
178+ Expect (session ).Should (ExitCleanly ( ))
173179restartTime := podmanTest .Podman ([]string {"inspect" , "--format='{{.State.StartedAt}}'" , "test1" , "test2" })
174180restartTime .WaitWithDefaultTimeout ()
175181Expect (restartTime .OutputToStringArray ()[0 ]).To (Equal (startTime .OutputToStringArray ()[0 ]))
@@ -184,22 +190,22 @@ var _ = Describe("Podman restart", func() {
184190
185191session := podmanTest .RunTopContainerInPod ("host-restart-test" , "foobar99" )
186192session .WaitWithDefaultTimeout ()
187- Expect (session ).Should (Exit ( 0 ))
193+ Expect (session ).Should (ExitCleanly ( ))
188194
189195testCmd := []string {"exec" , "host-restart-test" , "sh" , "-c" , "wc -l < /etc/hosts" }
190196
191197// before restart
192198beforeRestart := podmanTest .Podman (testCmd )
193199beforeRestart .WaitWithDefaultTimeout ()
194- Expect (beforeRestart ).Should (Exit ( 0 ))
200+ Expect (beforeRestart ).Should (ExitCleanly ( ))
195201
196202session = podmanTest .Podman ([]string {"restart" , "host-restart-test" })
197203session .WaitWithDefaultTimeout ()
198- Expect (session ).Should (Exit ( 0 ))
204+ Expect (session ).Should (ExitCleanly ( ))
199205
200206afterRestart := podmanTest .Podman (testCmd )
201207afterRestart .WaitWithDefaultTimeout ()
202- Expect (afterRestart ).Should (Exit ( 0 ))
208+ Expect (afterRestart ).Should (ExitCleanly ( ))
203209
204210// line count should be equal
205211Expect (beforeRestart .OutputToString ()).To (Equal (afterRestart .OutputToString ()))
@@ -208,22 +214,22 @@ var _ = Describe("Podman restart", func() {
208214It ("podman restart all stopped containers with --all" , func () {
209215session := podmanTest .RunTopContainer ("" )
210216session .WaitWithDefaultTimeout ()
211- Expect (session ).Should (Exit ( 0 ))
217+ Expect (session ).Should (ExitCleanly ( ))
212218Expect (podmanTest .NumberOfContainersRunning ()).To (Equal (1 ))
213219
214220session = podmanTest .RunTopContainer ("" )
215221session .WaitWithDefaultTimeout ()
216- Expect (session ).Should (Exit ( 0 ))
222+ Expect (session ).Should (ExitCleanly ( ))
217223Expect (podmanTest .NumberOfContainersRunning ()).To (Equal (2 ))
218224
219225session = podmanTest .Podman ([]string {"stop" , "--all" })
220226session .WaitWithDefaultTimeout ()
221- Expect (session ).Should (Exit ( 0 ))
227+ Expect (session ).Should (ExitCleanly ( ))
222228Expect (podmanTest .NumberOfContainersRunning ()).To (Equal (0 ))
223229
224230session = podmanTest .Podman ([]string {"restart" , "--all" })
225231session .WaitWithDefaultTimeout ()
226- Expect (session ).Should (Exit ( 0 ))
232+ Expect (session ).Should (ExitCleanly ( ))
227233Expect (podmanTest .NumberOfContainersRunning ()).To (Equal (2 ))
228234})
229235
@@ -233,16 +239,16 @@ var _ = Describe("Podman restart", func() {
233239
234240session := podmanTest .Podman ([]string {"create" , "--cidfile" , tmpFile , ALPINE , "top" })
235241session .WaitWithDefaultTimeout ()
236- Expect (session ).Should (Exit ( 0 ))
242+ Expect (session ).Should (ExitCleanly ( ))
237243cid := session .OutputToStringArray ()[0 ]
238244
239245session = podmanTest .Podman ([]string {"start" , cid })
240246session .WaitWithDefaultTimeout ()
241- Expect (session ).Should (Exit ( 0 ))
247+ Expect (session ).Should (ExitCleanly ( ))
242248
243249result := podmanTest .Podman ([]string {"restart" , "--cidfile" , tmpFile })
244250result .WaitWithDefaultTimeout ()
245- Expect (result ).Should (Exit ( 0 ))
251+ Expect (result ).Should (ExitCleanly ( ))
246252output := result .OutputToString ()
247253Expect (output ).To (ContainSubstring (cid ))
248254})
@@ -254,19 +260,19 @@ var _ = Describe("Podman restart", func() {
254260
255261session := podmanTest .Podman ([]string {"run" , "--cidfile" , tmpFile1 , "-d" , ALPINE , "top" })
256262session .WaitWithDefaultTimeout ()
257- Expect (session ).Should (Exit ( 0 ))
263+ Expect (session ).Should (ExitCleanly ( ))
258264cid1 := session .OutputToStringArray ()[0 ]
259265Expect (podmanTest .NumberOfContainers ()).To (Equal (1 ))
260266
261267session = podmanTest .Podman ([]string {"run" , "--cidfile" , tmpFile2 , "-d" , ALPINE , "top" })
262268session .WaitWithDefaultTimeout ()
263- Expect (session ).Should (Exit ( 0 ))
269+ Expect (session ).Should (ExitCleanly ( ))
264270cid2 := session .OutputToStringArray ()[0 ]
265271Expect (podmanTest .NumberOfContainers ()).To (Equal (2 ))
266272
267273result := podmanTest .Podman ([]string {"restart" , "--cidfile" , tmpFile1 , "--cidfile" , tmpFile2 })
268274result .WaitWithDefaultTimeout ()
269- Expect (result ).Should (Exit ( 0 ))
275+ Expect (result ).Should (ExitCleanly ( ))
270276output := result .OutputToString ()
271277Expect (output ).To (ContainSubstring (cid1 ))
272278Expect (output ).To (ContainSubstring (cid2 ))
@@ -296,17 +302,17 @@ var _ = Describe("Podman restart", func() {
296302It ("podman restart --filter" , func () {
297303session1 := podmanTest .RunTopContainer ("" )
298304session1 .WaitWithDefaultTimeout ()
299- Expect (session1 ).Should (Exit ( 0 ))
305+ Expect (session1 ).Should (ExitCleanly ( ))
300306cid1 := session1 .OutputToString ()
301307
302308session1 = podmanTest .RunTopContainer ("" )
303309session1 .WaitWithDefaultTimeout ()
304- Expect (session1 ).Should (Exit ( 0 ))
310+ Expect (session1 ).Should (ExitCleanly ( ))
305311cid2 := session1 .OutputToString ()
306312
307313session1 = podmanTest .RunTopContainerWithArgs ("" , []string {"--label" , "test=with,comma" })
308314session1 .WaitWithDefaultTimeout ()
309- Expect (session1 ).Should (Exit ( 0 ))
315+ Expect (session1 ).Should (ExitCleanly ( ))
310316cid3 := session1 .OutputToString ()
311317shortCid3 := cid3 [0 :5 ]
312318
@@ -316,22 +322,22 @@ var _ = Describe("Podman restart", func() {
316322
317323session1 = podmanTest .Podman ([]string {"restart" , "-a" , "--filter" , fmt .Sprintf ("id=%swrongid" , shortCid3 )})
318324session1 .WaitWithDefaultTimeout ()
319- Expect (session1 ).Should (Exit ( 0 ))
325+ Expect (session1 ).Should (ExitCleanly ( ))
320326Expect (session1 .OutputToString ()).To (BeEmpty ())
321327
322328session1 = podmanTest .Podman ([]string {"restart" , "-a" , "--filter" , fmt .Sprintf ("id=%s" , shortCid3 )})
323329session1 .WaitWithDefaultTimeout ()
324- Expect (session1 ).Should (Exit ( 0 ))
330+ Expect (session1 ).Should (ExitCleanly ( ))
325331Expect (session1 .OutputToString ()).To (BeEquivalentTo (cid3 ))
326332
327333session1 = podmanTest .Podman ([]string {"restart" , "-a" , "--filter" , "label=test=with,comma" })
328334session1 .WaitWithDefaultTimeout ()
329- Expect (session1 ).Should (Exit ( 0 ))
335+ Expect (session1 ).Should (ExitCleanly ( ))
330336Expect (session1 .OutputToString ()).To (BeEquivalentTo (cid3 ))
331337
332338session1 = podmanTest .Podman ([]string {"restart" , "-f" , fmt .Sprintf ("id=%s" , cid2 )})
333339session1 .WaitWithDefaultTimeout ()
334- Expect (session1 ).Should (Exit ( 0 ))
340+ Expect (session1 ).Should (ExitCleanly ( ))
335341Expect (session1 .OutputToString ()).To (BeEquivalentTo (cid2 ))
336342})
337343})
0 commit comments