@@ -19,17 +19,17 @@ import (
19
19
)
20
20
21
21
func (s * DockerSuite ) TestPsListContainersBase (c * check.C ) {
22
- out , _ := runSleepingContainer (c , "-d" )
22
+ out := runSleepingContainer (c , "-d" )
23
23
firstID := strings .TrimSpace (out )
24
24
25
- out , _ = runSleepingContainer (c , "-d" )
25
+ out = runSleepingContainer (c , "-d" )
26
26
secondID := strings .TrimSpace (out )
27
27
28
28
// not long running
29
29
out , _ = dockerCmd (c , "run" , "-d" , "busybox" , "true" )
30
30
thirdID := strings .TrimSpace (out )
31
31
32
- out , _ = runSleepingContainer (c , "-d" )
32
+ out = runSleepingContainer (c , "-d" )
33
33
fourthID := strings .TrimSpace (out )
34
34
35
35
// make sure the second is running
@@ -228,7 +228,7 @@ func (s *DockerSuite) TestPsListContainersFilterStatus(c *check.C) {
228
228
229
229
func (s * DockerSuite ) TestPsListContainersFilterHealth (c * check.C ) {
230
230
// Test legacy no health check
231
- out , _ := runSleepingContainer (c , "--name=none_legacy" )
231
+ out := runSleepingContainer (c , "--name=none_legacy" )
232
232
containerID := strings .TrimSpace (out )
233
233
234
234
cli .WaitRun (c , containerID )
@@ -238,7 +238,7 @@ func (s *DockerSuite) TestPsListContainersFilterHealth(c *check.C) {
238
238
c .Assert (containerOut , checker .Equals , containerID , check .Commentf ("Expected id %s, got %s for legacy none filter, output: %q" , containerID , containerOut , out ))
239
239
240
240
// Test no health check specified explicitly
241
- out , _ = runSleepingContainer (c , "--name=none" , "--no-healthcheck" )
241
+ out = runSleepingContainer (c , "--name=none" , "--no-healthcheck" )
242
242
containerID = strings .TrimSpace (out )
243
243
244
244
cli .WaitRun (c , containerID )
@@ -248,7 +248,7 @@ func (s *DockerSuite) TestPsListContainersFilterHealth(c *check.C) {
248
248
c .Assert (containerOut , checker .Equals , containerID , check .Commentf ("Expected id %s, got %s for none filter, output: %q" , containerID , containerOut , out ))
249
249
250
250
// Test failing health check
251
- out , _ = runSleepingContainer (c , "--name=failing_container" , "--health-cmd=exit 1" , "--health-interval=1s" )
251
+ out = runSleepingContainer (c , "--name=failing_container" , "--health-cmd=exit 1" , "--health-interval=1s" )
252
252
containerID = strings .TrimSpace (out )
253
253
254
254
waitForHealthStatus (c , "failing_container" , "starting" , "unhealthy" )
@@ -258,7 +258,7 @@ func (s *DockerSuite) TestPsListContainersFilterHealth(c *check.C) {
258
258
c .Assert (containerOut , checker .Equals , containerID , check .Commentf ("Expected containerID %s, got %s for unhealthy filter, output: %q" , containerID , containerOut , out ))
259
259
260
260
// Check passing healthcheck
261
- out , _ = runSleepingContainer (c , "--name=passing_container" , "--health-cmd=exit 0" , "--health-interval=1s" )
261
+ out = runSleepingContainer (c , "--name=passing_container" , "--health-cmd=exit 0" , "--health-interval=1s" )
262
262
containerID = strings .TrimSpace (out )
263
263
264
264
waitForHealthStatus (c , "passing_container" , "starting" , "healthy" )
@@ -473,19 +473,19 @@ func (s *DockerSuite) TestPsRightTagName(c *check.C) {
473
473
dockerCmd (c , "tag" , "busybox" , tag )
474
474
475
475
var id1 string
476
- out , _ := runSleepingContainer (c )
476
+ out := runSleepingContainer (c )
477
477
id1 = strings .TrimSpace (string (out ))
478
478
479
479
var id2 string
480
- out , _ = runSleepingContainerInImage (c , tag )
480
+ out = runSleepingContainerInImage (c , tag )
481
481
id2 = strings .TrimSpace (string (out ))
482
482
483
483
var imageID string
484
484
out = inspectField (c , "busybox" , "Id" )
485
485
imageID = strings .TrimSpace (string (out ))
486
486
487
487
var id3 string
488
- out , _ = runSleepingContainerInImage (c , imageID )
488
+ out = runSleepingContainerInImage (c , imageID )
489
489
id3 = strings .TrimSpace (string (out ))
490
490
491
491
out , _ = dockerCmd (c , "ps" , "--no-trunc" )
@@ -638,7 +638,7 @@ func (s *DockerSuite) TestPsDefaultFormatAndQuiet(c *check.C) {
638
638
err = ioutil .WriteFile (filepath .Join (d , "config.json" ), []byte (config ), 0644 )
639
639
c .Assert (err , checker .IsNil )
640
640
641
- out , _ := runSleepingContainer (c , "--name=test" )
641
+ out := runSleepingContainer (c , "--name=test" )
642
642
id := strings .TrimSpace (out )
643
643
644
644
out , _ = dockerCmd (c , "--config" , d , "ps" , "-q" )
@@ -898,35 +898,25 @@ func (s *DockerSuite) TestPsListContainersFilterNetwork(c *check.C) {
898
898
899
899
func (s * DockerSuite ) TestPsByOrder (c * check.C ) {
900
900
name1 := "xyz-abc"
901
- out , err := runSleepingContainer (c , "--name" , name1 )
902
- c .Assert (err , checker .NotNil )
903
- c .Assert (strings .TrimSpace (out ), checker .Not (checker .Equals ), "" )
901
+ out := runSleepingContainer (c , "--name" , name1 )
904
902
container1 := strings .TrimSpace (out )
905
903
906
904
name2 := "xyz-123"
907
- out , err = runSleepingContainer (c , "--name" , name2 )
908
- c .Assert (err , checker .NotNil )
909
- c .Assert (strings .TrimSpace (out ), checker .Not (checker .Equals ), "" )
905
+ out = runSleepingContainer (c , "--name" , name2 )
910
906
container2 := strings .TrimSpace (out )
911
907
912
908
name3 := "789-abc"
913
- out , err = runSleepingContainer (c , "--name" , name3 )
914
- c .Assert (err , checker .NotNil )
915
- c .Assert (strings .TrimSpace (out ), checker .Not (checker .Equals ), "" )
909
+ out = runSleepingContainer (c , "--name" , name3 )
916
910
917
911
name4 := "789-123"
918
- out , err = runSleepingContainer (c , "--name" , name4 )
919
- c .Assert (err , checker .NotNil )
920
- c .Assert (strings .TrimSpace (out ), checker .Not (checker .Equals ), "" )
912
+ out = runSleepingContainer (c , "--name" , name4 )
921
913
922
914
// Run multiple time should have the same result
923
- out , err = dockerCmd (c , "ps" , "--no-trunc" , "-q" , "-f" , "name=xyz" )
924
- c .Assert (err , checker .NotNil )
915
+ out = cli .DockerCmd (c , "ps" , "--no-trunc" , "-q" , "-f" , "name=xyz" ).Combined ()
925
916
c .Assert (strings .TrimSpace (out ), checker .Equals , fmt .Sprintf ("%s\n %s" , container2 , container1 ))
926
917
927
918
// Run multiple time should have the same result
928
- out , err = dockerCmd (c , "ps" , "--no-trunc" , "-q" , "-f" , "name=xyz" )
929
- c .Assert (err , checker .NotNil )
919
+ out = cli .DockerCmd (c , "ps" , "--no-trunc" , "-q" , "-f" , "name=xyz" ).Combined ()
930
920
c .Assert (strings .TrimSpace (out ), checker .Equals , fmt .Sprintf ("%s\n %s" , container2 , container1 ))
931
921
}
932
922
0 commit comments