Browse code

Merge pull request #23802 from inercia/fix_docker_cli_run_test

Make sure we compare string with the same capitalization

Brian Goff authored on 2016/06/24 23:27:29
Showing 1 changed files
... ...
@@ -757,7 +757,7 @@ func (s *DockerSuite) TestRunUserByIDBig(c *check.C) {
757 757
 	if err == nil {
758 758
 		c.Fatal("No error, but must be.", out)
759 759
 	}
760
-	if !strings.Contains(out, libcontainerUser.ErrRange.Error()) {
760
+	if !strings.Contains(strings.ToUpper(out), strings.ToUpper(libcontainerUser.ErrRange.Error())) {
761 761
 		c.Fatalf("expected error about uids range, got %s", out)
762 762
 	}
763 763
 }
... ...
@@ -770,7 +770,7 @@ func (s *DockerSuite) TestRunUserByIDNegative(c *check.C) {
770 770
 	if err == nil {
771 771
 		c.Fatal("No error, but must be.", out)
772 772
 	}
773
-	if !strings.Contains(out, libcontainerUser.ErrRange.Error()) {
773
+	if !strings.Contains(strings.ToUpper(out), strings.ToUpper(libcontainerUser.ErrRange.Error())) {
774 774
 		c.Fatalf("expected error about uids range, got %s", out)
775 775
 	}
776 776
 }
... ...
@@ -1454,10 +1454,16 @@ func (s *DockerSuite) TestRunResolvconfUpdate(c *check.C) {
1454 1454
 	// This test case is meant to test monitoring resolv.conf when it is
1455 1455
 	// a regular file not a bind mounc. So we unmount resolv.conf and replace
1456 1456
 	// it with a file containing the original settings.
1457
-	cmd := exec.Command("umount", "/etc/resolv.conf")
1458
-	if _, err = runCommand(cmd); err != nil {
1457
+	mounted, err := mount.Mounted("/etc/resolv.conf")
1458
+	if err != nil {
1459 1459
 		c.Fatal(err)
1460 1460
 	}
1461
+	if mounted {
1462
+		cmd := exec.Command("umount", "/etc/resolv.conf")
1463
+		if _, err = runCommand(cmd); err != nil {
1464
+			c.Fatal(err)
1465
+		}
1466
+	}
1461 1467
 
1462 1468
 	//cleanup
1463 1469
 	defer func() {