Browse code

intgration-cli: fix formatting

Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit cc01289792d918856d0c1a0cf38008f32d3d5bc7)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Tibor Vass authored on 2019/09/10 06:35:23
Showing 5 changed files
... ...
@@ -1064,12 +1064,7 @@ func (s *DockerSuite) TestContainerAPICopyResourcePathEmptyPre124(c *testing.T)
1064 1064
 	}
1065 1065
 	b, err := request.ReadBody(body)
1066 1066
 	assert.NilError(c, err)
1067
-	assert.Assert(c, is.Regexp("^"+
1068
-
1069
-		"Path cannot be empty\n"+
1070
-		"$",
1071
-
1072
-		string(b)))
1067
+	assert.Assert(c, is.Regexp("^Path cannot be empty\n$", string(b)))
1073 1068
 
1074 1069
 }
1075 1070
 
... ...
@@ -1091,12 +1086,7 @@ func (s *DockerSuite) TestContainerAPICopyResourcePathNotFoundPre124(c *testing.
1091 1091
 	}
1092 1092
 	b, err := request.ReadBody(body)
1093 1093
 	assert.NilError(c, err)
1094
-	assert.Assert(c, is.Regexp("^"+
1095
-
1096
-		("Could not find the file /notexist in container "+name+"\n")+
1097
-		"$",
1098
-
1099
-		string(b)))
1094
+	assert.Assert(c, is.Regexp("^Could not find the file /notexist in container "+name+"\n$", string(b)))
1100 1095
 
1101 1096
 }
1102 1097
 
... ...
@@ -4799,12 +4799,7 @@ func (s *DockerSuite) TestBuildFollowSymlinkToFile(c *testing.T) {
4799 4799
 	cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx))
4800 4800
 
4801 4801
 	out := cli.DockerCmd(c, "run", "--rm", name, "cat", "target").Combined()
4802
-	assert.Assert(c, cmp.Regexp("^"+
4803
-
4804
-		"bar"+
4805
-		"$",
4806
-
4807
-		out))
4802
+	assert.Assert(c, cmp.Regexp("^bar$", out))
4808 4803
 
4809 4804
 	// change target file should invalidate cache
4810 4805
 	err = ioutil.WriteFile(filepath.Join(ctx.Dir, "foo"), []byte("baz"), 0644)
... ...
@@ -4813,12 +4808,7 @@ func (s *DockerSuite) TestBuildFollowSymlinkToFile(c *testing.T) {
4813 4813
 	result := cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx))
4814 4814
 	assert.Assert(c, !strings.Contains(result.Combined(), "Using cache"))
4815 4815
 	out = cli.DockerCmd(c, "run", "--rm", name, "cat", "target").Combined()
4816
-	assert.Assert(c, cmp.Regexp("^"+
4817
-
4818
-		"baz"+
4819
-		"$",
4820
-
4821
-		out))
4816
+	assert.Assert(c, cmp.Regexp("^baz$", out))
4822 4817
 
4823 4818
 }
4824 4819
 
... ...
@@ -4840,12 +4830,7 @@ func (s *DockerSuite) TestBuildFollowSymlinkToDir(c *testing.T) {
4840 4840
 	cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx))
4841 4841
 
4842 4842
 	out := cli.DockerCmd(c, "run", "--rm", name, "cat", "abc", "def").Combined()
4843
-	assert.Assert(c, cmp.Regexp("^"+
4844
-
4845
-		"barbaz"+
4846
-		"$",
4847
-
4848
-		out))
4843
+	assert.Assert(c, cmp.Regexp("^barbaz$", out))
4849 4844
 
4850 4845
 	// change target file should invalidate cache
4851 4846
 	err = ioutil.WriteFile(filepath.Join(ctx.Dir, "foo/def"), []byte("bax"), 0644)
... ...
@@ -4854,12 +4839,7 @@ func (s *DockerSuite) TestBuildFollowSymlinkToDir(c *testing.T) {
4854 4854
 	result := cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx))
4855 4855
 	assert.Assert(c, !strings.Contains(result.Combined(), "Using cache"))
4856 4856
 	out = cli.DockerCmd(c, "run", "--rm", name, "cat", "abc", "def").Combined()
4857
-	assert.Assert(c, cmp.Regexp("^"+
4858
-
4859
-		"barbax"+
4860
-		"$",
4861
-
4862
-		out))
4857
+	assert.Assert(c, cmp.Regexp("^barbax$", out))
4863 4858
 
4864 4859
 }
4865 4860
 
... ...
@@ -4882,12 +4862,7 @@ func (s *DockerSuite) TestBuildSymlinkBasename(c *testing.T) {
4882 4882
 	cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx))
4883 4883
 
4884 4884
 	out := cli.DockerCmd(c, "run", "--rm", name, "cat", "asymlink").Combined()
4885
-	assert.Assert(c, cmp.Regexp("^"+
4886
-
4887
-		"bar"+
4888
-		"$",
4889
-
4890
-		out))
4885
+	assert.Assert(c, cmp.Regexp("^bar$", out))
4891 4886
 
4892 4887
 }
4893 4888
 
... ...
@@ -115,11 +115,7 @@ func (s *DockerSuite) TestHistoryHumanOptionTrue(c *testing.T) {
115 115
 			endIndex = len(lines[i])
116 116
 		}
117 117
 		sizeString := lines[i][startIndex:endIndex]
118
-		assert.Assert(c, cmp.Regexp("^"+
119
-
120
-			humanSizeRegexRaw+
121
-			"$",
122
-
118
+		assert.Assert(c, cmp.Regexp("^"+humanSizeRegexRaw+"$",
123 119
 			strings.TrimSpace(sizeString)), fmt.Sprintf("The size '%s' was not in human format", sizeString))
124 120
 	}
125 121
 }
... ...
@@ -90,21 +90,11 @@ func (s *DockerSuite) TestImagesFilterLabelMatch(c *testing.T) {
90 90
 
91 91
 	out, _ := dockerCmd(c, "images", "--no-trunc", "-q", "-f", "label=match")
92 92
 	out = strings.TrimSpace(out)
93
-	assert.Assert(c, is.Regexp("^"+
93
+	assert.Assert(c, is.Regexp(fmt.Sprintf("^[\\s\\w:]*%s[\\s\\w:]*$", image1ID), out))
94 94
 
95
-		fmt.Sprintf("[\\s\\w:]*%s[\\s\\w:]*", image1ID)+
96
-		"$",
95
+	assert.Assert(c, is.Regexp(fmt.Sprintf("^[\\s\\w:]*%s[\\s\\w:]*$", image2ID), out))
97 96
 
98
-		out))
99
-
100
-	assert.Assert(c, is.Regexp("^"+
101
-
102
-		fmt.Sprintf("[\\s\\w:]*%s[\\s\\w:]*", image2ID)+
103
-		"$",
104
-
105
-		out))
106
-
107
-	assert.Assert(c, !is.Regexp("^"+fmt.Sprintf("[\\s\\w:]*%s[\\s\\w:]*", image3ID)+"$", out)().Success())
97
+	assert.Assert(c, !is.Regexp(fmt.Sprintf("^[\\s\\w:]*%s[\\s\\w:]*$", image3ID), out)().Success())
108 98
 
109 99
 	out, _ = dockerCmd(c, "images", "--no-trunc", "-q", "-f", "label=match=me too")
110 100
 	out = strings.TrimSpace(out)
... ...
@@ -229,13 +229,7 @@ func (s *DockerSuite) TestLinksEtcHostsRegularFile(c *testing.T) {
229 229
 	testRequires(c, DaemonIsLinux, NotUserNamespace)
230 230
 	out, _ := dockerCmd(c, "run", "--net=host", "busybox", "ls", "-la", "/etc/hosts")
231 231
 	// /etc/hosts should be a regular file
232
-	assert.Assert(c, cmp.Regexp("^"+
233
-
234
-		"^-.+\n"+
235
-		"$",
236
-
237
-		out))
238
-
232
+	assert.Assert(c, cmp.Regexp("^-.+\n$", out))
239 233
 }
240 234
 
241 235
 func (s *DockerSuite) TestLinksMultipleWithSameName(c *testing.T) {