From cc01289792d918856d0c1a0cf38008f32d3d5bc7 Mon Sep 17 00:00:00 2001 From: Tibor Vass Date: Mon, 9 Sep 2019 21:35:23 +0000 Subject: [PATCH] intgration-cli: fix formatting Signed-off-by: Tibor Vass --- integration-cli/docker_api_containers_test.go | 14 ++------ integration-cli/docker_cli_build_test.go | 35 +++---------------- integration-cli/docker_cli_history_test.go | 6 +--- integration-cli/docker_cli_images_test.go | 16 ++------- integration-cli/docker_cli_links_test.go | 8 +---- 5 files changed, 12 insertions(+), 67 deletions(-) diff --git a/integration-cli/docker_api_containers_test.go b/integration-cli/docker_api_containers_test.go index 37fc6fa123..13f1a55ba3 100644 --- a/integration-cli/docker_api_containers_test.go +++ b/integration-cli/docker_api_containers_test.go @@ -1064,12 +1064,7 @@ func (s *DockerSuite) TestContainerAPICopyResourcePathEmptyPre124(c *testing.T) } b, err := request.ReadBody(body) assert.NilError(c, err) - assert.Assert(c, is.Regexp("^"+ - - "Path cannot be empty\n"+ - "$", - - string(b))) + assert.Assert(c, is.Regexp("^Path cannot be empty\n$", string(b))) } @@ -1091,12 +1086,7 @@ func (s *DockerSuite) TestContainerAPICopyResourcePathNotFoundPre124(c *testing. } b, err := request.ReadBody(body) assert.NilError(c, err) - assert.Assert(c, is.Regexp("^"+ - - ("Could not find the file /notexist in container "+name+"\n")+ - "$", - - string(b))) + assert.Assert(c, is.Regexp("^Could not find the file /notexist in container "+name+"\n$", string(b))) } diff --git a/integration-cli/docker_cli_build_test.go b/integration-cli/docker_cli_build_test.go index eb38935715..4ccb1b8961 100644 --- a/integration-cli/docker_cli_build_test.go +++ b/integration-cli/docker_cli_build_test.go @@ -4799,12 +4799,7 @@ func (s *DockerSuite) TestBuildFollowSymlinkToFile(c *testing.T) { cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx)) out := cli.DockerCmd(c, "run", "--rm", name, "cat", "target").Combined() - assert.Assert(c, cmp.Regexp("^"+ - - "bar"+ - "$", - - out)) + assert.Assert(c, cmp.Regexp("^bar$", out)) // change target file should invalidate cache err = ioutil.WriteFile(filepath.Join(ctx.Dir, "foo"), []byte("baz"), 0644) @@ -4813,12 +4808,7 @@ func (s *DockerSuite) TestBuildFollowSymlinkToFile(c *testing.T) { result := cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx)) assert.Assert(c, !strings.Contains(result.Combined(), "Using cache")) out = cli.DockerCmd(c, "run", "--rm", name, "cat", "target").Combined() - assert.Assert(c, cmp.Regexp("^"+ - - "baz"+ - "$", - - out)) + assert.Assert(c, cmp.Regexp("^baz$", out)) } @@ -4840,12 +4830,7 @@ func (s *DockerSuite) TestBuildFollowSymlinkToDir(c *testing.T) { cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx)) out := cli.DockerCmd(c, "run", "--rm", name, "cat", "abc", "def").Combined() - assert.Assert(c, cmp.Regexp("^"+ - - "barbaz"+ - "$", - - out)) + assert.Assert(c, cmp.Regexp("^barbaz$", out)) // change target file should invalidate cache err = ioutil.WriteFile(filepath.Join(ctx.Dir, "foo/def"), []byte("bax"), 0644) @@ -4854,12 +4839,7 @@ func (s *DockerSuite) TestBuildFollowSymlinkToDir(c *testing.T) { result := cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx)) assert.Assert(c, !strings.Contains(result.Combined(), "Using cache")) out = cli.DockerCmd(c, "run", "--rm", name, "cat", "abc", "def").Combined() - assert.Assert(c, cmp.Regexp("^"+ - - "barbax"+ - "$", - - out)) + assert.Assert(c, cmp.Regexp("^barbax$", out)) } @@ -4882,12 +4862,7 @@ func (s *DockerSuite) TestBuildSymlinkBasename(c *testing.T) { cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx)) out := cli.DockerCmd(c, "run", "--rm", name, "cat", "asymlink").Combined() - assert.Assert(c, cmp.Regexp("^"+ - - "bar"+ - "$", - - out)) + assert.Assert(c, cmp.Regexp("^bar$", out)) } diff --git a/integration-cli/docker_cli_history_test.go b/integration-cli/docker_cli_history_test.go index b6f5242562..5766def799 100644 --- a/integration-cli/docker_cli_history_test.go +++ b/integration-cli/docker_cli_history_test.go @@ -115,11 +115,7 @@ func (s *DockerSuite) TestHistoryHumanOptionTrue(c *testing.T) { endIndex = len(lines[i]) } sizeString := lines[i][startIndex:endIndex] - assert.Assert(c, cmp.Regexp("^"+ - - humanSizeRegexRaw+ - "$", - + assert.Assert(c, cmp.Regexp("^"+humanSizeRegexRaw+"$", strings.TrimSpace(sizeString)), fmt.Sprintf("The size '%s' was not in human format", sizeString)) } } diff --git a/integration-cli/docker_cli_images_test.go b/integration-cli/docker_cli_images_test.go index 6caa75b94b..e9e728b103 100644 --- a/integration-cli/docker_cli_images_test.go +++ b/integration-cli/docker_cli_images_test.go @@ -90,21 +90,11 @@ func (s *DockerSuite) TestImagesFilterLabelMatch(c *testing.T) { out, _ := dockerCmd(c, "images", "--no-trunc", "-q", "-f", "label=match") out = strings.TrimSpace(out) - assert.Assert(c, is.Regexp("^"+ + assert.Assert(c, is.Regexp(fmt.Sprintf("^[\\s\\w:]*%s[\\s\\w:]*$", image1ID), out)) - fmt.Sprintf("[\\s\\w:]*%s[\\s\\w:]*", image1ID)+ - "$", + assert.Assert(c, is.Regexp(fmt.Sprintf("^[\\s\\w:]*%s[\\s\\w:]*$", image2ID), out)) - out)) - - assert.Assert(c, is.Regexp("^"+ - - fmt.Sprintf("[\\s\\w:]*%s[\\s\\w:]*", image2ID)+ - "$", - - out)) - - assert.Assert(c, !is.Regexp("^"+fmt.Sprintf("[\\s\\w:]*%s[\\s\\w:]*", image3ID)+"$", out)().Success()) + assert.Assert(c, !is.Regexp(fmt.Sprintf("^[\\s\\w:]*%s[\\s\\w:]*$", image3ID), out)().Success()) out, _ = dockerCmd(c, "images", "--no-trunc", "-q", "-f", "label=match=me too") out = strings.TrimSpace(out) diff --git a/integration-cli/docker_cli_links_test.go b/integration-cli/docker_cli_links_test.go index 4216aadf01..ff5792635b 100644 --- a/integration-cli/docker_cli_links_test.go +++ b/integration-cli/docker_cli_links_test.go @@ -229,13 +229,7 @@ func (s *DockerSuite) TestLinksEtcHostsRegularFile(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace) out, _ := dockerCmd(c, "run", "--net=host", "busybox", "ls", "-la", "/etc/hosts") // /etc/hosts should be a regular file - assert.Assert(c, cmp.Regexp("^"+ - - "^-.+\n"+ - "$", - - out)) - + assert.Assert(c, cmp.Regexp("^-.+\n$", out)) } func (s *DockerSuite) TestLinksMultipleWithSameName(c *testing.T) {