@@ -51,7 +51,7 @@ func TestCreateWithLabel(t *testing.T) {
5151 }
5252 testCase .Expected = func (data test.Data , helpers test.Helpers ) * test.Expected {
5353 return & test.Expected {
54- ExitCode : 0 ,
54+ ExitCode : expect . ExitCodeSuccess ,
5555 Output : func (stdout string , t tig.T ) {
5656 fooLabel := strings .TrimSpace (helpers .Capture ("inspect" , "--format" , `{{index .Config.Labels "foo"}}` , data .Identifier ()))
5757 assert .Equal (t , "bar" , fooLabel )
@@ -126,7 +126,7 @@ func TestCreateWithMACAddress(t *testing.T) {
126126 Command : makeCreateCommand ("host" ),
127127 Expected : func (data test.Data , helpers test.Helpers ) * test.Expected {
128128 return & test.Expected {
129- ExitCode : 0 ,
129+ ExitCode : expect . ExitCodeSuccess ,
130130 Output : func (stdout string , t tig.T ) {
131131 startOut := helpers .Capture ("start" , "-a" , data .Identifier ())
132132 assert .Assert (t , strings .Contains (startOut , data .Labels ().Get (defaultMacKey )),
@@ -144,7 +144,7 @@ func TestCreateWithMACAddress(t *testing.T) {
144144 Command : makeCreateCommand ("none" ),
145145 Expected : func (data test.Data , helpers test.Helpers ) * test.Expected {
146146 return & test.Expected {
147- ExitCode : 0 ,
147+ ExitCode : expect . ExitCodeSuccess ,
148148 Output : func (stdout string , t tig.T ) {
149149 helpers .Ensure ("start" , "-a" , data .Identifier ())
150150 },
@@ -162,18 +162,18 @@ func TestCreateWithMACAddress(t *testing.T) {
162162 if nerdtest .IsDocker () {
163163 // Docker delays the failure to start time
164164 return & test.Expected {
165- ExitCode : 0 ,
165+ ExitCode : expect . ExitCodeSuccess ,
166166 Output : func (stdout string , t tig.T ) {
167167 helpers .Command ("start" , "-i" , "-a" , data .Identifier ()).
168168 Run (& test.Expected {
169- ExitCode : 1 ,
169+ ExitCode : expect . ExitCodeGenericFail ,
170170 Errors : []error {errors .New ("container" )},
171171 })
172172 },
173173 }
174174 }
175175 return & test.Expected {
176- ExitCode : 1 ,
176+ ExitCode : expect . ExitCodeGenericFail ,
177177 Errors : []error {errors .New ("container" )},
178178 }
179179 },
@@ -187,7 +187,7 @@ func TestCreateWithMACAddress(t *testing.T) {
187187 Command : makeCreateCommand ("bridge" ),
188188 Expected : func (data test.Data , helpers test.Helpers ) * test.Expected {
189189 return & test.Expected {
190- ExitCode : 0 ,
190+ ExitCode : expect . ExitCodeSuccess ,
191191 Output : func (stdout string , t tig.T ) {
192192 startOut := helpers .Capture ("start" , "-a" , data .Identifier ())
193193 assert .Assert (t , strings .Contains (startOut , data .Labels ().Get (macAddressKey )),
@@ -205,7 +205,7 @@ func TestCreateWithMACAddress(t *testing.T) {
205205 Command : makeDynamicCreateCommand (networkBridgeKey ),
206206 Expected : func (data test.Data , helpers test.Helpers ) * test.Expected {
207207 return & test.Expected {
208- ExitCode : 0 ,
208+ ExitCode : expect . ExitCodeSuccess ,
209209 Output : func (stdout string , t tig.T ) {
210210 startOut := helpers .Capture ("start" , "-a" , data .Identifier ())
211211 assert .Assert (t , strings .Contains (startOut , data .Labels ().Get (macAddressKey )),
@@ -223,7 +223,7 @@ func TestCreateWithMACAddress(t *testing.T) {
223223 Command : makeDynamicCreateCommand (networkMACvlanKey ),
224224 Expected : func (data test.Data , helpers test.Helpers ) * test.Expected {
225225 return & test.Expected {
226- ExitCode : 0 ,
226+ ExitCode : expect . ExitCodeSuccess ,
227227 Output : func (stdout string , t tig.T ) {
228228 startOut := helpers .Capture ("start" , "-a" , data .Identifier ())
229229 assert .Assert (t , strings .Contains (startOut , data .Labels ().Get (macAddressKey )),
@@ -243,18 +243,18 @@ func TestCreateWithMACAddress(t *testing.T) {
243243 if nerdtest .IsDocker () {
244244 // Docker delays the failure to start time
245245 return & test.Expected {
246- ExitCode : 0 ,
246+ ExitCode : expect . ExitCodeSuccess ,
247247 Output : func (stdout string , t tig.T ) {
248248 helpers .Command ("start" , "-i" , "-a" , data .Identifier ()).
249249 Run (& test.Expected {
250- ExitCode : 1 ,
250+ ExitCode : expect . ExitCodeGenericFail ,
251251 Errors : []error {errors .New ("not support" )},
252252 })
253253 },
254254 }
255255 }
256256 return & test.Expected {
257- ExitCode : 1 ,
257+ ExitCode : expect . ExitCodeGenericFail ,
258258 Errors : []error {errors .New ("not support" )},
259259 }
260260 },
@@ -279,7 +279,7 @@ func TestCreateWithTty(t *testing.T) {
279279 },
280280 Expected : func (data test.Data , helpers test.Helpers ) * test.Expected {
281281 return & test.Expected {
282- ExitCode : 1 ,
282+ ExitCode : expect . ExitCodeGenericFail ,
283283 Errors : []error {errors .New ("stty: standard input: Not a tty" )},
284284 }
285285 },
@@ -363,7 +363,7 @@ func TestIssue2993(t *testing.T) {
363363 },
364364 Expected : func (data test.Data , helpers test.Helpers ) * test.Expected {
365365 return & test.Expected {
366- ExitCode : 1 ,
366+ ExitCode : expect . ExitCodeGenericFail ,
367367 Errors : []error {errors .New ("is already used by ID" )},
368368 Output : func (stdout string , t tig.T ) {
369369 containersDirs , err := os .ReadDir (data .Labels ().Get (containersPathKey ))
@@ -410,7 +410,7 @@ func TestIssue2993(t *testing.T) {
410410 },
411411 Expected : func (data test.Data , helpers test.Helpers ) * test.Expected {
412412 return & test.Expected {
413- ExitCode : 0 ,
413+ ExitCode : expect . ExitCodeSuccess ,
414414 Errors : []error {},
415415 Output : func (stdout string , t tig.T ) {
416416 containersDirs , err := os .ReadDir (data .Labels ().Get (containersPathKey ))
@@ -464,7 +464,7 @@ func TestCreateFromOCIArchive(t *testing.T) {
464464 }
465465 testCase .Expected = func (data test.Data , helpers test.Helpers ) * test.Expected {
466466 return & test.Expected {
467- ExitCode : 0 ,
467+ ExitCode : expect . ExitCodeSuccess ,
468468 Output : func (stdout string , t tig.T ) {
469469 assert .Assert (t , strings .Contains (stdout , sentinel ),
470470 fmt .Sprintf ("expected stdout to contain %q: %q" , sentinel , stdout ))
@@ -504,7 +504,7 @@ func TestUsernsMappingCreateCmd(t *testing.T) {
504504 },
505505 Expected : func (data test.Data , helpers test.Helpers ) * test.Expected {
506506 return & test.Expected {
507- ExitCode : 0 ,
507+ ExitCode : expect . ExitCodeSuccess ,
508508 Output : func (stdout string , t tig.T ) {
509509 actualHostUID , err := getContainerHostUID (helpers , data .Identifier ())
510510 assert .NilError (t , err , "Failed to get container host UID" )
@@ -528,7 +528,7 @@ func TestUsernsMappingCreateCmd(t *testing.T) {
528528 },
529529 Expected : func (data test.Data , helpers test.Helpers ) * test.Expected {
530530 return & test.Expected {
531- ExitCode : 1 ,
531+ ExitCode : expect . ExitCodeGenericFail ,
532532 }
533533 },
534534 },
@@ -543,7 +543,7 @@ func TestUsernsMappingCreateCmd(t *testing.T) {
543543 },
544544 Expected : func (data test.Data , helpers test.Helpers ) * test.Expected {
545545 return & test.Expected {
546- ExitCode : 1 ,
546+ ExitCode : expect . ExitCodeGenericFail ,
547547 }
548548 },
549549 },
@@ -608,9 +608,9 @@ func appendUsernsConfig(userns string, hostUID string, helpers test.Helpers) err
608608
609609func addUser (username string , hostID string , helpers test.Helpers ) {
610610 helpers .Custom ("groupadd" , "-g" , hostID , username ).Run (& test.Expected {
611- ExitCode : 0 })
611+ ExitCode : expect . ExitCodeSuccess })
612612 helpers .Custom ("useradd" , "-u" , hostID , "-g" , hostID , "-s" , "/bin/false" , username ).Run (& test.Expected {
613- ExitCode : 0 })
613+ ExitCode : expect . ExitCodeSuccess })
614614}
615615
616616func removeUsernsConfig (t tig.T , userns string , helpers test.Helpers ) {
0 commit comments