integration-cli: use string-literals for easier grep'ing
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 6331a3a346
)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
5bba60b1bb
commit
a3f1f4eeb0
11 changed files with 42 additions and 42 deletions
|
@ -76,7 +76,7 @@ func printCliVersion() {
|
|||
cli.SetTestEnvironment(testEnv)
|
||||
cmd := cli.Docker(cli.Args("version"))
|
||||
if cmd.Error != nil {
|
||||
fmt.Printf("WARNING: Failed to run \"docker version\": %+v\n", cmd.Error)
|
||||
fmt.Printf("WARNING: Failed to run 'docker version': %+v\n", cmd.Error)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -1158,7 +1158,7 @@ func (s *DockerAPISuite) TestContainerAPIDeleteRemoveLinks(c *testing.T) {
|
|||
assert.Assert(c, waitRun(id2) == nil)
|
||||
|
||||
links := inspectFieldJSON(c, id2, "HostConfig.Links")
|
||||
assert.Equal(c, links, "[\"/tlink1:/tlink2/tlink1\"]", "expected to have links between containers")
|
||||
assert.Equal(c, links, `["/tlink1:/tlink2/tlink1"]`, "expected to have links between containers")
|
||||
|
||||
removeOptions := types.ContainerRemoveOptions{
|
||||
RemoveLinks: true,
|
||||
|
|
|
@ -2258,7 +2258,7 @@ docker.com>"
|
|||
`))
|
||||
|
||||
res := inspectField(c, name, "Author")
|
||||
if res != "\"Docker IO <io@docker.com>\"" {
|
||||
if res != `"Docker IO <io@docker.com>"` {
|
||||
c.Fatalf("Parsed string did not match the escaped string. Got: %q", res)
|
||||
}
|
||||
}
|
||||
|
@ -2272,7 +2272,7 @@ func (s *DockerCLIBuildSuite) TestBuildVerifyIntString(c *testing.T) {
|
|||
MAINTAINER 123`))
|
||||
|
||||
out, _ := dockerCmd(c, "inspect", name)
|
||||
if !strings.Contains(out, "\"123\"") {
|
||||
if !strings.Contains(out, `"123"`) {
|
||||
c.Fatalf("Output does not contain the int as a string:\n%s", out)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,17 +120,17 @@ func (s *DockerCLICommitSuite) TestCommitChange(c *testing.T) {
|
|||
dockerCmd(c, "run", "--name", "test", "busybox", "true")
|
||||
|
||||
imageID, _ := dockerCmd(c, "commit",
|
||||
"--change", "EXPOSE 8080",
|
||||
"--change", "ENV DEBUG true",
|
||||
"--change", "ENV test 1",
|
||||
"--change", "ENV PATH /foo",
|
||||
"--change", "LABEL foo bar",
|
||||
"--change", "CMD [\"/bin/sh\"]",
|
||||
"--change", "WORKDIR /opt",
|
||||
"--change", "ENTRYPOINT [\"/bin/sh\"]",
|
||||
"--change", "USER testuser",
|
||||
"--change", "VOLUME /var/lib/docker",
|
||||
"--change", "ONBUILD /usr/local/bin/python-build --dir /app/src",
|
||||
"--change", `EXPOSE 8080`,
|
||||
"--change", `ENV DEBUG true`,
|
||||
"--change", `ENV test 1`,
|
||||
"--change", `ENV PATH /foo`,
|
||||
"--change", `LABEL foo bar`,
|
||||
"--change", `CMD ["/bin/sh"]`,
|
||||
"--change", `WORKDIR /opt`,
|
||||
"--change", `ENTRYPOINT ["/bin/sh"]`,
|
||||
"--change", `USER testuser`,
|
||||
"--change", `VOLUME /var/lib/docker`,
|
||||
"--change", `ONBUILD /usr/local/bin/python-build --dir /app/src`,
|
||||
"test", "test-commit")
|
||||
imageID = strings.TrimSpace(imageID)
|
||||
|
||||
|
|
|
@ -750,7 +750,7 @@ func (s *DockerCLIEventSuite) TestEventsFormatBadFunc(c *testing.T) {
|
|||
result.Assert(c, icmd.Expected{
|
||||
Error: "exit status 64",
|
||||
ExitCode: 64,
|
||||
Err: "Error parsing format: template: :1: function \"badFuncString\" not defined",
|
||||
Err: `Error parsing format: template: :1: function "badFuncString" not defined`,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -760,6 +760,6 @@ func (s *DockerCLIEventSuite) TestEventsFormatBadField(c *testing.T) {
|
|||
result.Assert(c, icmd.Expected{
|
||||
Error: "exit status 64",
|
||||
ExitCode: 64,
|
||||
Err: "Error parsing format: template: :1:2: executing \"\" at <.badFieldString>: can't evaluate field badFieldString in type *events.Message",
|
||||
Err: `Error parsing format: template: :1:2: executing "" at <.badFieldString>: can't evaluate field badFieldString in type *events.Message`,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -415,21 +415,21 @@ func (s *DockerDaemonSuite) TestDaemonEvents(c *testing.T) {
|
|||
// only check for values known (daemon ID/name) or explicitly set above,
|
||||
// otherwise just check for names being present.
|
||||
expectedSubstrings := []string{
|
||||
" daemon reload " + info.ID + " ",
|
||||
"(allow-nondistributable-artifacts=[",
|
||||
" debug=true, ",
|
||||
" default-ipc-mode=",
|
||||
" default-runtime=",
|
||||
" default-shm-size=",
|
||||
" insecure-registries=[",
|
||||
" labels=[\"bar=foo\"], ",
|
||||
" live-restore=",
|
||||
" max-concurrent-downloads=1, ",
|
||||
" max-concurrent-uploads=5, ",
|
||||
" name=" + info.Name,
|
||||
" registry-mirrors=[",
|
||||
" runtimes=",
|
||||
" shutdown-timeout=10)",
|
||||
` daemon reload ` + info.ID + " ",
|
||||
`(allow-nondistributable-artifacts=[`,
|
||||
` debug=true, `,
|
||||
` default-ipc-mode=`,
|
||||
` default-runtime=`,
|
||||
` default-shm-size=`,
|
||||
` insecure-registries=[`,
|
||||
` labels=["bar=foo"], `,
|
||||
` live-restore=`,
|
||||
` max-concurrent-downloads=1, `,
|
||||
` max-concurrent-uploads=5, `,
|
||||
` name=` + info.Name,
|
||||
` registry-mirrors=[`,
|
||||
` runtimes=`,
|
||||
` shutdown-timeout=10)`,
|
||||
}
|
||||
|
||||
for _, s := range expectedSubstrings {
|
||||
|
|
|
@ -218,7 +218,7 @@ func (s *DockerCLILinksSuite) TestLinkShortDefinition(c *testing.T) {
|
|||
assert.Assert(c, waitRun(cid2) == nil)
|
||||
|
||||
links := inspectFieldJSON(c, cid2, "HostConfig.Links")
|
||||
assert.Equal(c, links, "[\"/shortlinkdef:/link2/shortlinkdef\"]")
|
||||
assert.Equal(c, links, `["/shortlinkdef:/link2/shortlinkdef"]`)
|
||||
}
|
||||
|
||||
func (s *DockerCLILinksSuite) TestLinksNetworkHostContainer(c *testing.T) {
|
||||
|
|
|
@ -176,7 +176,7 @@ func (s *DockerCLIPsSuite) TestPsListContainersSize(c *testing.T) {
|
|||
select {
|
||||
case <-wait:
|
||||
case <-time.After(3 * time.Second):
|
||||
c.Fatalf("Calling \"docker ps -s\" timed out!")
|
||||
c.Fatalf(`Calling "docker ps -s" timed out!`)
|
||||
}
|
||||
result.Assert(c, icmd.Success)
|
||||
lines := strings.Split(strings.Trim(result.Combined(), "\n "), "\n")
|
||||
|
@ -634,8 +634,8 @@ func (s *DockerCLIPsSuite) TestPsShowMounts(c *testing.T) {
|
|||
var bindMountSource string
|
||||
var bindMountDestination string
|
||||
if DaemonIsWindows() {
|
||||
bindMountSource = "c:\\"
|
||||
bindMountDestination = "c:\\t"
|
||||
bindMountSource = `c:\`
|
||||
bindMountDestination = `c:\t`
|
||||
} else {
|
||||
bindMountSource = "/tmp"
|
||||
bindMountDestination = "/t"
|
||||
|
|
|
@ -391,7 +391,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestPullWithExternalAuthLoginWithSchem
|
|||
|
||||
b, err := os.ReadFile(configPath)
|
||||
assert.NilError(c, err)
|
||||
assert.Assert(c, !strings.Contains(string(b), "\"auth\":"))
|
||||
assert.Assert(c, !strings.Contains(string(b), `"auth":`))
|
||||
dockerCmd(c, "--config", tmp, "tag", "busybox", repoName)
|
||||
dockerCmd(c, "--config", tmp, "push", repoName)
|
||||
|
||||
|
@ -433,7 +433,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestPullWithExternalAuth(c *testing.T)
|
|||
|
||||
b, err := os.ReadFile(configPath)
|
||||
assert.NilError(c, err)
|
||||
assert.Assert(c, !strings.Contains(string(b), "\"auth\":"))
|
||||
assert.Assert(c, !strings.Contains(string(b), `"auth":`))
|
||||
dockerCmd(c, "--config", tmp, "tag", "busybox", repoName)
|
||||
dockerCmd(c, "--config", tmp, "push", repoName)
|
||||
|
||||
|
|
|
@ -1673,7 +1673,7 @@ func (s *DockerCLIRunSuite) TestRunCopyVolumeUIDGID(c *testing.T) {
|
|||
RUN mkdir -p /hello && touch /hello/test && chown dockerio.dockerio /hello`))
|
||||
|
||||
// Test that the uid and gid is copied from the image to the volume
|
||||
out, _ := dockerCmd(c, "run", "--rm", "-v", "/hello", name, "sh", "-c", "ls -l / | grep hello | awk '{print $3\":\"$4}'")
|
||||
out, _ := dockerCmd(c, "run", "--rm", "-v", "/hello", name, "sh", "-c", `ls -l / | grep hello | awk '{print $3":"$4}'`)
|
||||
out = strings.TrimSpace(out)
|
||||
if out != "dockerio:dockerio" {
|
||||
c.Fatalf("Wrong /hello ownership: %s, expected dockerio:dockerio", out)
|
||||
|
@ -2053,7 +2053,7 @@ func (s *DockerCLIRunSuite) TestRunPortInUse(c *testing.T) {
|
|||
c.Fatalf("Binding on used port must fail")
|
||||
}
|
||||
if !strings.Contains(out, "port is already allocated") {
|
||||
c.Fatalf("Out must be about \"port is already allocated\", got %s", out)
|
||||
c.Fatalf(`Out must be about "port is already allocated", got %s`, out)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -230,7 +230,7 @@ func (s *DockerSwarmSuite) TestServiceLogsTaskLogs(c *testing.T) {
|
|||
assert.Assert(c, id != "")
|
||||
// so, right here, we're basically inspecting by id and returning only
|
||||
// the ID. if they don't match, the service doesn't exist.
|
||||
result = icmd.RunCmd(d.Command("service", "inspect", "--format=\"{{.ID}}\"", id))
|
||||
result = icmd.RunCmd(d.Command("service", "inspect", `--format="{{.ID}}"`, id))
|
||||
result.Assert(c, icmd.Expected{Out: id})
|
||||
|
||||
// make sure task has been deployed.
|
||||
|
@ -283,7 +283,7 @@ func (s *DockerSwarmSuite) TestServiceLogsTTY(c *testing.T) {
|
|||
assert.Assert(c, id != "")
|
||||
// so, right here, we're basically inspecting by id and returning only
|
||||
// the ID. if they don't match, the service doesn't exist.
|
||||
result = icmd.RunCmd(d.Command("service", "inspect", "--format=\"{{.ID}}\"", id))
|
||||
result = icmd.RunCmd(d.Command("service", "inspect", `--format="{{.ID}}"`, id))
|
||||
result.Assert(c, icmd.Expected{Out: id})
|
||||
|
||||
// make sure task has been deployed.
|
||||
|
|
Loading…
Reference in a new issue