Browse code

run as user tests: Check the exit codes

Andrea Luzzardi authored on 2013/02/16 05:17:58
Showing 1 changed files
... ...
@@ -311,7 +311,7 @@ func TestUser(t *testing.T) {
311 311
 	}
312 312
 	defer docker.Destroy(container)
313 313
 	output, err = container.Output()
314
-	if err != nil {
314
+	if err != nil || container.State.ExitCode != 0 {
315 315
 		t.Fatal(err)
316 316
 	}
317 317
 	if !strings.Contains(string(output), "uid=0(root) gid=0(root)") {
... ...
@@ -328,12 +328,12 @@ func TestUser(t *testing.T) {
328 328
 			User: "0",
329 329
 		},
330 330
 	)
331
-	if err != nil {
331
+	if err != nil || container.State.ExitCode != 0 {
332 332
 		t.Fatal(err)
333 333
 	}
334 334
 	defer docker.Destroy(container)
335 335
 	output, err = container.Output()
336
-	if err != nil {
336
+	if err != nil || container.State.ExitCode != 0 {
337 337
 		t.Fatal(err)
338 338
 	}
339 339
 	if !strings.Contains(string(output), "uid=0(root) gid=0(root)") {
... ...
@@ -355,7 +355,7 @@ func TestUser(t *testing.T) {
355 355
 	}
356 356
 	defer docker.Destroy(container)
357 357
 	output, err = container.Output()
358
-	if err != nil {
358
+	if err != nil || container.State.ExitCode != 0 {
359 359
 		t.Fatal(err)
360 360
 	}
361 361
 	if !strings.Contains(string(output), "uid=1(daemon) gid=1(daemon)") {
... ...
@@ -377,7 +377,7 @@ func TestUser(t *testing.T) {
377 377
 	}
378 378
 	defer docker.Destroy(container)
379 379
 	output, err = container.Output()
380
-	if err != nil {
380
+	if err != nil || container.State.ExitCode != 0 {
381 381
 		t.Fatal(err)
382 382
 	}
383 383
 	if !strings.Contains(string(output), "uid=1(daemon) gid=1(daemon)") {