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)
|
cli.SetTestEnvironment(testEnv)
|
||||||
cmd := cli.Docker(cli.Args("version"))
|
cmd := cli.Docker(cli.Args("version"))
|
||||||
if cmd.Error != nil {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1158,7 +1158,7 @@ func (s *DockerAPISuite) TestContainerAPIDeleteRemoveLinks(c *testing.T) {
|
||||||
assert.Assert(c, waitRun(id2) == nil)
|
assert.Assert(c, waitRun(id2) == nil)
|
||||||
|
|
||||||
links := inspectFieldJSON(c, id2, "HostConfig.Links")
|
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{
|
removeOptions := types.ContainerRemoveOptions{
|
||||||
RemoveLinks: true,
|
RemoveLinks: true,
|
||||||
|
|
|
@ -2258,7 +2258,7 @@ docker.com>"
|
||||||
`))
|
`))
|
||||||
|
|
||||||
res := inspectField(c, name, "Author")
|
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)
|
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`))
|
MAINTAINER 123`))
|
||||||
|
|
||||||
out, _ := dockerCmd(c, "inspect", name)
|
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)
|
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")
|
dockerCmd(c, "run", "--name", "test", "busybox", "true")
|
||||||
|
|
||||||
imageID, _ := dockerCmd(c, "commit",
|
imageID, _ := dockerCmd(c, "commit",
|
||||||
"--change", "EXPOSE 8080",
|
"--change", `EXPOSE 8080`,
|
||||||
"--change", "ENV DEBUG true",
|
"--change", `ENV DEBUG true`,
|
||||||
"--change", "ENV test 1",
|
"--change", `ENV test 1`,
|
||||||
"--change", "ENV PATH /foo",
|
"--change", `ENV PATH /foo`,
|
||||||
"--change", "LABEL foo bar",
|
"--change", `LABEL foo bar`,
|
||||||
"--change", "CMD [\"/bin/sh\"]",
|
"--change", `CMD ["/bin/sh"]`,
|
||||||
"--change", "WORKDIR /opt",
|
"--change", `WORKDIR /opt`,
|
||||||
"--change", "ENTRYPOINT [\"/bin/sh\"]",
|
"--change", `ENTRYPOINT ["/bin/sh"]`,
|
||||||
"--change", "USER testuser",
|
"--change", `USER testuser`,
|
||||||
"--change", "VOLUME /var/lib/docker",
|
"--change", `VOLUME /var/lib/docker`,
|
||||||
"--change", "ONBUILD /usr/local/bin/python-build --dir /app/src",
|
"--change", `ONBUILD /usr/local/bin/python-build --dir /app/src`,
|
||||||
"test", "test-commit")
|
"test", "test-commit")
|
||||||
imageID = strings.TrimSpace(imageID)
|
imageID = strings.TrimSpace(imageID)
|
||||||
|
|
||||||
|
|
|
@ -750,7 +750,7 @@ func (s *DockerCLIEventSuite) TestEventsFormatBadFunc(c *testing.T) {
|
||||||
result.Assert(c, icmd.Expected{
|
result.Assert(c, icmd.Expected{
|
||||||
Error: "exit status 64",
|
Error: "exit status 64",
|
||||||
ExitCode: 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{
|
result.Assert(c, icmd.Expected{
|
||||||
Error: "exit status 64",
|
Error: "exit status 64",
|
||||||
ExitCode: 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,
|
// only check for values known (daemon ID/name) or explicitly set above,
|
||||||
// otherwise just check for names being present.
|
// otherwise just check for names being present.
|
||||||
expectedSubstrings := []string{
|
expectedSubstrings := []string{
|
||||||
" daemon reload " + info.ID + " ",
|
` daemon reload ` + info.ID + " ",
|
||||||
"(allow-nondistributable-artifacts=[",
|
`(allow-nondistributable-artifacts=[`,
|
||||||
" debug=true, ",
|
` debug=true, `,
|
||||||
" default-ipc-mode=",
|
` default-ipc-mode=`,
|
||||||
" default-runtime=",
|
` default-runtime=`,
|
||||||
" default-shm-size=",
|
` default-shm-size=`,
|
||||||
" insecure-registries=[",
|
` insecure-registries=[`,
|
||||||
" labels=[\"bar=foo\"], ",
|
` labels=["bar=foo"], `,
|
||||||
" live-restore=",
|
` live-restore=`,
|
||||||
" max-concurrent-downloads=1, ",
|
` max-concurrent-downloads=1, `,
|
||||||
" max-concurrent-uploads=5, ",
|
` max-concurrent-uploads=5, `,
|
||||||
" name=" + info.Name,
|
` name=` + info.Name,
|
||||||
" registry-mirrors=[",
|
` registry-mirrors=[`,
|
||||||
" runtimes=",
|
` runtimes=`,
|
||||||
" shutdown-timeout=10)",
|
` shutdown-timeout=10)`,
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range expectedSubstrings {
|
for _, s := range expectedSubstrings {
|
||||||
|
|
|
@ -218,7 +218,7 @@ func (s *DockerCLILinksSuite) TestLinkShortDefinition(c *testing.T) {
|
||||||
assert.Assert(c, waitRun(cid2) == nil)
|
assert.Assert(c, waitRun(cid2) == nil)
|
||||||
|
|
||||||
links := inspectFieldJSON(c, cid2, "HostConfig.Links")
|
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) {
|
func (s *DockerCLILinksSuite) TestLinksNetworkHostContainer(c *testing.T) {
|
||||||
|
|
|
@ -176,7 +176,7 @@ func (s *DockerCLIPsSuite) TestPsListContainersSize(c *testing.T) {
|
||||||
select {
|
select {
|
||||||
case <-wait:
|
case <-wait:
|
||||||
case <-time.After(3 * time.Second):
|
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)
|
result.Assert(c, icmd.Success)
|
||||||
lines := strings.Split(strings.Trim(result.Combined(), "\n "), "\n")
|
lines := strings.Split(strings.Trim(result.Combined(), "\n "), "\n")
|
||||||
|
@ -634,8 +634,8 @@ func (s *DockerCLIPsSuite) TestPsShowMounts(c *testing.T) {
|
||||||
var bindMountSource string
|
var bindMountSource string
|
||||||
var bindMountDestination string
|
var bindMountDestination string
|
||||||
if DaemonIsWindows() {
|
if DaemonIsWindows() {
|
||||||
bindMountSource = "c:\\"
|
bindMountSource = `c:\`
|
||||||
bindMountDestination = "c:\\t"
|
bindMountDestination = `c:\t`
|
||||||
} else {
|
} else {
|
||||||
bindMountSource = "/tmp"
|
bindMountSource = "/tmp"
|
||||||
bindMountDestination = "/t"
|
bindMountDestination = "/t"
|
||||||
|
|
|
@ -391,7 +391,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestPullWithExternalAuthLoginWithSchem
|
||||||
|
|
||||||
b, err := os.ReadFile(configPath)
|
b, err := os.ReadFile(configPath)
|
||||||
assert.NilError(c, err)
|
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, "tag", "busybox", repoName)
|
||||||
dockerCmd(c, "--config", tmp, "push", repoName)
|
dockerCmd(c, "--config", tmp, "push", repoName)
|
||||||
|
|
||||||
|
@ -433,7 +433,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestPullWithExternalAuth(c *testing.T)
|
||||||
|
|
||||||
b, err := os.ReadFile(configPath)
|
b, err := os.ReadFile(configPath)
|
||||||
assert.NilError(c, err)
|
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, "tag", "busybox", repoName)
|
||||||
dockerCmd(c, "--config", tmp, "push", 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`))
|
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
|
// 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)
|
out = strings.TrimSpace(out)
|
||||||
if out != "dockerio:dockerio" {
|
if out != "dockerio:dockerio" {
|
||||||
c.Fatalf("Wrong /hello ownership: %s, expected dockerio:dockerio", out)
|
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")
|
c.Fatalf("Binding on used port must fail")
|
||||||
}
|
}
|
||||||
if !strings.Contains(out, "port is already allocated") {
|
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 != "")
|
assert.Assert(c, id != "")
|
||||||
// so, right here, we're basically inspecting by id and returning only
|
// so, right here, we're basically inspecting by id and returning only
|
||||||
// the ID. if they don't match, the service doesn't exist.
|
// 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})
|
result.Assert(c, icmd.Expected{Out: id})
|
||||||
|
|
||||||
// make sure task has been deployed.
|
// make sure task has been deployed.
|
||||||
|
@ -283,7 +283,7 @@ func (s *DockerSwarmSuite) TestServiceLogsTTY(c *testing.T) {
|
||||||
assert.Assert(c, id != "")
|
assert.Assert(c, id != "")
|
||||||
// so, right here, we're basically inspecting by id and returning only
|
// so, right here, we're basically inspecting by id and returning only
|
||||||
// the ID. if they don't match, the service doesn't exist.
|
// 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})
|
result.Assert(c, icmd.Expected{Out: id})
|
||||||
|
|
||||||
// make sure task has been deployed.
|
// make sure task has been deployed.
|
||||||
|
|
Loading…
Reference in a new issue