@@ -33,18 +33,17 @@ func TestPs(t *testing.T) {
3333 const projectName = "e2e-ps"
3434
3535 res := c .RunDockerComposeCmd (t , "-f" , "./fixtures/ps-test/compose.yaml" , "--project-name" , projectName , "up" , "-d" )
36- if assert .NoError (t , res .Error ) {
37- t .Cleanup (func () {
38- _ = c .RunDockerComposeCmd (t , "--project-name" , projectName , "down" )
39- })
40- }
36+ require .NoError (t , res .Error )
37+ t .Cleanup (func () {
38+ _ = c .RunDockerComposeCmd (t , "--project-name" , projectName , "down" )
39+ })
4140
4241 assert .Contains (t , res .Combined (), "Container e2e-ps-busybox-1 Started" , res .Combined ())
4342
4443 t .Run ("table" , func (t * testing.T ) {
4544 res = c .RunDockerComposeCmd (t , "-f" , "./fixtures/ps-test/compose.yaml" , "--project-name" , projectName , "ps" )
4645 lines := strings .Split (res .Stdout (), "\n " )
47- assert .Equal (t , 4 , len ( lines ) )
46+ assert .Len (t , lines , 4 )
4847 count := 0
4948 for _ , line := range lines [1 :3 ] {
5049 if strings .Contains (line , "e2e-ps-busybox-1" ) {
@@ -77,12 +76,12 @@ func TestPs(t *testing.T) {
7776 }
7877
7978 count := 0
80- assert .Equal (t , 2 , len ( output ) )
79+ assert .Len (t , output , 2 )
8180 for _ , service := range output {
8281 assert .Equal (t , projectName , service .Project )
8382 publishers := service .Publishers
8483 if service .Name == "e2e-ps-busybox-1" {
85- assert .Equal (t , 1 , len ( publishers ) )
84+ assert .Len (t , publishers , 1 )
8685 assert .Equal (t , api.PortPublishers {
8786 {
8887 URL : "127.0.0.1" ,
@@ -94,7 +93,7 @@ func TestPs(t *testing.T) {
9493 count ++
9594 }
9695 if service .Name == "e2e-ps-nginx-1" {
97- assert .Equal (t , 3 , len ( publishers ) )
96+ assert .Len (t , publishers , 3 )
9897 assert .Equal (t , api.PortPublishers {
9998 {TargetPort : 80 , Protocol : "tcp" },
10099 {TargetPort : 443 , Protocol : "tcp" },
@@ -109,20 +108,20 @@ func TestPs(t *testing.T) {
109108
110109 t .Run ("ps --all" , func (t * testing.T ) {
111110 res := c .RunDockerComposeCmd (t , "--project-name" , projectName , "stop" )
112- assert .NoError (t , res .Error )
111+ require .NoError (t , res .Error )
113112
114113 res = c .RunDockerComposeCmd (t , "-f" , "./fixtures/ps-test/compose.yaml" , "--project-name" , projectName , "ps" )
115114 lines := strings .Split (res .Stdout (), "\n " )
116- assert .Equal (t , 2 , len ( lines ) )
115+ assert .Len (t , lines , 2 )
117116
118117 res = c .RunDockerComposeCmd (t , "-f" , "./fixtures/ps-test/compose.yaml" , "--project-name" , projectName , "ps" , "--all" )
119118 lines = strings .Split (res .Stdout (), "\n " )
120- assert .Equal (t , 4 , len ( lines ) )
119+ assert .Len (t , lines , 4 )
121120 })
122121
123122 t .Run ("ps unknown" , func (t * testing.T ) {
124123 res := c .RunDockerComposeCmd (t , "--project-name" , projectName , "stop" )
125- assert .NoError (t , res .Error )
124+ require .NoError (t , res .Error )
126125
127126 res = c .RunDockerComposeCmd (t , "-f" , "./fixtures/ps-test/compose.yaml" , "--project-name" , projectName , "ps" , "nginx" )
128127 res .Assert (t , icmd .Success )
0 commit comments