Merge pull request #45886 from thaJeztah/more_grepable
use string-literals for easier grep'ing
This commit is contained in:
commit
ba02bbb3b4
32 changed files with 99 additions and 98 deletions
|
@ -304,7 +304,7 @@ func newGraphDriverController(ctx context.Context, rt http.RoundTripper, opt Opt
|
|||
return nil, errors.Errorf("snapshotter doesn't support differ")
|
||||
}
|
||||
|
||||
leases, err := lm.List(ctx, "labels.\"buildkit/lease.temporary\"")
|
||||
leases, err := lm.List(ctx, `labels."buildkit/lease.temporary"`)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -53,31 +53,31 @@ func TestGetFilenameForDownload(t *testing.T) {
|
|||
expected string
|
||||
}{
|
||||
{
|
||||
path: "http://www.example.com/",
|
||||
path: "https://www.example.com/",
|
||||
expected: "",
|
||||
},
|
||||
{
|
||||
path: "http://www.example.com/xyz",
|
||||
path: "https://www.example.com/xyz",
|
||||
expected: "xyz",
|
||||
},
|
||||
{
|
||||
path: "http://www.example.com/xyz.html",
|
||||
path: "https://www.example.com/xyz.html",
|
||||
expected: "xyz.html",
|
||||
},
|
||||
{
|
||||
path: "http://www.example.com/xyz/",
|
||||
path: "https://www.example.com/xyz/",
|
||||
expected: "",
|
||||
},
|
||||
{
|
||||
path: "http://www.example.com/xyz/uvw",
|
||||
path: "https://www.example.com/xyz/uvw",
|
||||
expected: "uvw",
|
||||
},
|
||||
{
|
||||
path: "http://www.example.com/xyz/uvw.html",
|
||||
path: "https://www.example.com/xyz/uvw.html",
|
||||
expected: "uvw.html",
|
||||
},
|
||||
{
|
||||
path: "http://www.example.com/xyz/uvw/",
|
||||
path: "https://www.example.com/xyz/uvw/",
|
||||
expected: "",
|
||||
},
|
||||
{
|
||||
|
@ -114,23 +114,23 @@ func TestGetFilenameForDownload(t *testing.T) {
|
|||
expected: "xyz.html",
|
||||
},
|
||||
{
|
||||
disposition: "attachment; filename=\"xyz\"",
|
||||
disposition: `attachment; filename="xyz"`,
|
||||
expected: "xyz",
|
||||
},
|
||||
{
|
||||
disposition: "attachment; filename=\"xyz.html\"",
|
||||
disposition: `attachment; filename="xyz.html"`,
|
||||
expected: "xyz.html",
|
||||
},
|
||||
{
|
||||
disposition: "attachment; filename=\"/xyz.html\"",
|
||||
disposition: `attachment; filename="/xyz.html"`,
|
||||
expected: "xyz.html",
|
||||
},
|
||||
{
|
||||
disposition: "attachment; filename=\"/xyz/uvw\"",
|
||||
disposition: `attachment; filename="/xyz/uvw"`,
|
||||
expected: "uvw",
|
||||
},
|
||||
{
|
||||
disposition: "attachment; filename=\"Naïve file.txt\"",
|
||||
disposition: `attachment; filename="Naïve file.txt"`,
|
||||
expected: "Naïve file.txt",
|
||||
},
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@ import (
|
|||
)
|
||||
|
||||
var pathDenyList = map[string]bool{
|
||||
"c:\\": true,
|
||||
"c:\\windows": true,
|
||||
`c:\`: true,
|
||||
`c:\windows`: true,
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
|
|
@ -14,20 +14,20 @@ func TestEnable(t *testing.T) {
|
|||
}()
|
||||
Enable()
|
||||
if os.Getenv("DEBUG") != "1" {
|
||||
t.Fatalf("expected DEBUG=1, got %s\n", os.Getenv("DEBUG"))
|
||||
t.Fatalf("expected DEBUG=1, got %s", os.Getenv("DEBUG"))
|
||||
}
|
||||
if logrus.GetLevel() != logrus.DebugLevel {
|
||||
t.Fatalf("expected log level %v, got %v\n", logrus.DebugLevel, logrus.GetLevel())
|
||||
t.Fatalf("expected log level %v, got %v", logrus.DebugLevel, logrus.GetLevel())
|
||||
}
|
||||
}
|
||||
|
||||
func TestDisable(t *testing.T) {
|
||||
Disable()
|
||||
if os.Getenv("DEBUG") != "" {
|
||||
t.Fatalf("expected DEBUG=\"\", got %s\n", os.Getenv("DEBUG"))
|
||||
t.Fatalf(`expected DEBUG="", got %s`, os.Getenv("DEBUG"))
|
||||
}
|
||||
if logrus.GetLevel() != logrus.InfoLevel {
|
||||
t.Fatalf("expected log level %v, got %v\n", logrus.InfoLevel, logrus.GetLevel())
|
||||
t.Fatalf("expected log level %v, got %v", logrus.InfoLevel, logrus.GetLevel())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ func TestImageTagInvalidSourceImageName(t *testing.T) {
|
|||
}
|
||||
|
||||
err := client.ImageTag(context.Background(), "invalid_source_image_name_", "repo:tag")
|
||||
if err == nil || err.Error() != "Error parsing reference: \"invalid_source_image_name_\" is not a valid repository/tag: invalid reference format" {
|
||||
if err == nil || err.Error() != `Error parsing reference: "invalid_source_image_name_" is not a valid repository/tag: invalid reference format` {
|
||||
t.Fatalf("expected Parsing Reference Error, got %v", err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -359,7 +359,7 @@ func (c *Cluster) errNoManager(st nodeState) error {
|
|||
if st.err == errSwarmCertificatesExpired {
|
||||
return errSwarmCertificatesExpired
|
||||
}
|
||||
return errors.WithStack(notAvailableError("This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again."))
|
||||
return errors.WithStack(notAvailableError(`This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.`))
|
||||
}
|
||||
if st.swarmNode.Manager() != nil {
|
||||
return errors.WithStack(notAvailableError("This node is not a swarm manager. Manager is being prepared or has trouble connecting to the cluster."))
|
||||
|
|
|
@ -5,13 +5,13 @@ const (
|
|||
errNoSwarm notAvailableError = "This node is not part of a swarm"
|
||||
|
||||
// errSwarmExists is returned on initialize or join request for a cluster that has already been activated
|
||||
errSwarmExists notAvailableError = "This node is already part of a swarm. Use \"docker swarm leave\" to leave this swarm and join another one."
|
||||
errSwarmExists notAvailableError = `This node is already part of a swarm. Use "docker swarm leave" to leave this swarm and join another one.`
|
||||
|
||||
// errSwarmJoinTimeoutReached is returned when cluster join could not complete before timeout was reached.
|
||||
errSwarmJoinTimeoutReached notAvailableError = "Timeout was reached before node joined. The attempt to join the swarm will continue in the background. Use the \"docker info\" command to see the current swarm status of your node."
|
||||
errSwarmJoinTimeoutReached notAvailableError = `Timeout was reached before node joined. The attempt to join the swarm will continue in the background. Use the "docker info" command to see the current swarm status of your node.`
|
||||
|
||||
// errSwarmLocked is returned if the swarm is encrypted and needs a key to unlock it.
|
||||
errSwarmLocked notAvailableError = "Swarm is encrypted and needs to be unlocked before it can be used. Please use \"docker swarm unlock\" to unlock it."
|
||||
errSwarmLocked notAvailableError = `Swarm is encrypted and needs to be unlocked before it can be used. Please use "docker swarm unlock" to unlock it.`
|
||||
|
||||
// errSwarmCertificatesExpired is returned if docker was not started for the whole validity period and they had no chance to renew automatically.
|
||||
errSwarmCertificatesExpired notAvailableError = "Swarm certificates have expired. To replace them, leave the swarm and join again."
|
||||
|
|
|
@ -456,7 +456,7 @@ func (c *Cluster) ServiceLogs(ctx context.Context, selector *backend.LogSelector
|
|||
} else {
|
||||
t, err := strconv.Atoi(config.Tail)
|
||||
if err != nil {
|
||||
return nil, errors.New("tail value must be a positive integer or \"all\"")
|
||||
return nil, errors.New(`tail value must be a positive integer or "all"`)
|
||||
}
|
||||
if t < 0 {
|
||||
return nil, errors.New("negative tail values not supported")
|
||||
|
|
|
@ -700,7 +700,7 @@ func verifyPlatformContainerSettings(daemon *Daemon, daemonCfg *configStore, hos
|
|||
if hostConfig.CgroupParent != "" && UsingSystemd(&daemonCfg.Config) {
|
||||
// CgroupParent for systemd cgroup should be named as "xxx.slice"
|
||||
if len(hostConfig.CgroupParent) <= 6 || !strings.HasSuffix(hostConfig.CgroupParent, ".slice") {
|
||||
return warnings, fmt.Errorf("cgroup-parent for systemd cgroup should be a valid slice named as \"xxx.slice\"")
|
||||
return warnings, fmt.Errorf(`cgroup-parent for systemd cgroup should be a valid slice named as "xxx.slice"`)
|
||||
}
|
||||
}
|
||||
if hostConfig.Runtime == "" {
|
||||
|
@ -753,7 +753,7 @@ func verifyDaemonSettings(conf *config.Config) error {
|
|||
}
|
||||
if conf.CgroupParent != "" && UsingSystemd(conf) {
|
||||
if len(conf.CgroupParent) <= 6 || !strings.HasSuffix(conf.CgroupParent, ".slice") {
|
||||
return fmt.Errorf("cgroup-parent for systemd cgroup should be a valid slice named as \"xxx.slice\"")
|
||||
return fmt.Errorf(`cgroup-parent for systemd cgroup should be a valid slice named as "xxx.slice"`)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1059,7 +1059,7 @@ func initBridgeDriver(controller *libnetwork.Controller, config *config.Config)
|
|||
libnetwork.NetworkOptionIpam("default", "", v4Conf, v6Conf, nil),
|
||||
libnetwork.NetworkOptionDeferIPv6Alloc(deferIPv6Alloc))
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error creating default \"bridge\" network: %v", err)
|
||||
return fmt.Errorf(`error creating default "bridge" network: %v`, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@ func TestParseSecurityOptWithDeprecatedColon(t *testing.T) {
|
|||
t.Fatalf("Unexpected parseSecurityOpt error: %v", err)
|
||||
}
|
||||
if opts.AppArmorProfile != "test_profile" {
|
||||
t.Fatalf("Unexpected AppArmorProfile, expected: \"test_profile\", got %q", opts.AppArmorProfile)
|
||||
t.Fatalf(`Unexpected AppArmorProfile, expected: "test_profile", got %q`, opts.AppArmorProfile)
|
||||
}
|
||||
|
||||
// test seccomp
|
||||
|
|
|
@ -377,7 +377,7 @@ func (daemon *Daemon) createNetwork(cfg *config.Config, create types.NetworkCrea
|
|||
if err != nil {
|
||||
if errors.Is(err, libnetwork.ErrDataStoreNotInitialized) {
|
||||
//nolint: revive
|
||||
return nil, errors.New("This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again.")
|
||||
return nil, errors.New(`This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.`)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ func validatePSArgs(psArgs string) error {
|
|||
k := group[1]
|
||||
v := group[2]
|
||||
if k != "pid" {
|
||||
return fmt.Errorf("specifying \"%s=%s\" is not allowed", k, v)
|
||||
return fmt.Errorf(`specifying "%s=%s" is not allowed`, k, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ import (
|
|||
func TestContainerTopValidatePSArgs(t *testing.T) {
|
||||
tests := map[string]bool{
|
||||
"ae -o uid=PID": true,
|
||||
"ae -o \"uid= PID\"": true, // ascii space (0x20)
|
||||
"ae -o \"uid= PID\"": false, // unicode space (U+2003, 0xe2 0x80 0x83)
|
||||
`ae -o "uid= PID"`: true, // ascii space (0x20)
|
||||
`ae -o "uid= PID"`: false, // unicode space (U+2003, 0xe2 0x80 0x83)
|
||||
"ae o uid=PID": true,
|
||||
"aeo uid=PID": true,
|
||||
"ae -O uid=PID": true,
|
||||
|
|
|
@ -54,7 +54,7 @@ func (daemon *Daemon) update(name string, hostConfig *container.HostConfig) erro
|
|||
|
||||
if ctr.RemovalInProgress || ctr.Dead {
|
||||
ctr.Unlock()
|
||||
return errCannotUpdate(ctr.ID, fmt.Errorf("container is marked for removal and cannot be \"update\""))
|
||||
return errCannotUpdate(ctr.ID, fmt.Errorf(`container is marked for removal and cannot be "update"`))
|
||||
}
|
||||
|
||||
if err := ctr.UpdateContainer(hostConfig); err != nil {
|
||||
|
|
|
@ -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`,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -414,21 +414,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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -229,7 +229,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.
|
||||
|
@ -282,7 +282,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.
|
||||
|
|
|
@ -251,9 +251,10 @@ func TestTemplatedConfig(t *testing.T) {
|
|||
Templating: &swarmtypes.Driver{
|
||||
Name: "golang",
|
||||
},
|
||||
Data: []byte("SERVICE_NAME={{.Service.Name}}\n" +
|
||||
"{{secret \"referencedsecrettarget\"}}\n" +
|
||||
"{{config \"referencedconfigtarget\"}}\n"),
|
||||
Data: []byte(`SERVICE_NAME={{.Service.Name}}
|
||||
{{secret "referencedsecrettarget"}}
|
||||
{{config "referencedconfigtarget"}}
|
||||
`),
|
||||
}
|
||||
|
||||
templatedConfig, err := c.ConfigCreate(ctx, configSpec)
|
||||
|
|
|
@ -26,7 +26,7 @@ func TestNoPersist(t *testing.T) {
|
|||
defer testController.Stop()
|
||||
nw, err := testController.NewNetwork("host", "host", "", NetworkOptionPersist(false))
|
||||
if err != nil {
|
||||
t.Fatalf("Error creating default \"host\" network: %v", err)
|
||||
t.Fatalf(`Error creating default "host" network: %v`, err)
|
||||
}
|
||||
ep, err := nw.CreateEndpoint("newendpoint", []EndpointOption{}...)
|
||||
if err != nil {
|
||||
|
|
|
@ -30,7 +30,7 @@ func testLocalBackend(t *testing.T, provider, url string, storeConfig *store.Con
|
|||
defer testController.Stop()
|
||||
nw, err := testController.NewNetwork("host", "host", "")
|
||||
if err != nil {
|
||||
t.Fatalf("Error creating default \"host\" network: %v", err)
|
||||
t.Fatalf(`Error creating default "host" network: %v`, err)
|
||||
}
|
||||
ep, err := nw.CreateEndpoint("newendpoint", []EndpointOption{}...)
|
||||
if err != nil {
|
||||
|
|
|
@ -71,10 +71,10 @@ func TestListOptsWithoutValidator(t *testing.T) {
|
|||
t.Errorf("%d != 3", o.Len())
|
||||
}
|
||||
if !o.Get("bar") {
|
||||
t.Error("o.Get(\"bar\") == false")
|
||||
t.Error(`o.Get("bar") == false`)
|
||||
}
|
||||
if o.Get("baz") {
|
||||
t.Error("o.Get(\"baz\") == true")
|
||||
t.Error(`o.Get("baz") == true`)
|
||||
}
|
||||
o.Delete("foo")
|
||||
if o.String() != "[bar bar]" {
|
||||
|
@ -106,10 +106,10 @@ func TestListOptsWithValidator(t *testing.T) {
|
|||
t.Errorf("%d != 1", o.Len())
|
||||
}
|
||||
if !o.Get("max-file=2") {
|
||||
t.Error("o.Get(\"max-file=2\") == false")
|
||||
t.Error(`o.Get("max-file=2") == false`)
|
||||
}
|
||||
if o.Get("baz") {
|
||||
t.Error("o.Get(\"baz\") == true")
|
||||
t.Error(`o.Get("baz") == true`)
|
||||
}
|
||||
o.Delete("max-file=2")
|
||||
if o.String() != "" {
|
||||
|
@ -361,7 +361,7 @@ func TestMapMapOpts(t *testing.T) {
|
|||
o.Set("r1=k12=v12")
|
||||
assert.Check(t, is.DeepEqual(tmpMap["r1"], map[string]string{"k11": "v11", "k12": "v12"}))
|
||||
|
||||
if o.Set("invalid-key={\"k\":\"v\"}") == nil {
|
||||
if o.Set(`invalid-key={"k":"v"}`) == nil {
|
||||
t.Error("validator is not being called")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -458,14 +458,14 @@ func TestLookupUserAndGroup(t *testing.T) {
|
|||
func TestLookupUserAndGroupThatDoesNotExist(t *testing.T) {
|
||||
fakeUser := "fakeuser"
|
||||
_, err := LookupUser(fakeUser)
|
||||
assert.Check(t, is.Error(err, "getent unable to find entry \""+fakeUser+"\" in passwd database"))
|
||||
assert.Check(t, is.Error(err, `getent unable to find entry "fakeuser" in passwd database`))
|
||||
|
||||
_, err = LookupUID(-1)
|
||||
assert.Check(t, is.ErrorContains(err, ""))
|
||||
|
||||
fakeGroup := "fakegroup"
|
||||
_, err = LookupGroup(fakeGroup)
|
||||
assert.Check(t, is.Error(err, "getent unable to find entry \""+fakeGroup+"\" in group database"))
|
||||
assert.Check(t, is.Error(err, `getent unable to find entry "fakegroup" in group database`))
|
||||
|
||||
_, err = LookupGID(-1)
|
||||
assert.Check(t, is.ErrorContains(err, ""))
|
||||
|
|
|
@ -66,7 +66,7 @@ func TestFixedBufferString(t *testing.T) {
|
|||
|
||||
out := buf.String()
|
||||
if out != "helloworld" {
|
||||
t.Fatalf("expected output to be \"helloworld\", got %q", out)
|
||||
t.Fatalf(`expected output to be "helloworld", got %q`, out)
|
||||
}
|
||||
|
||||
// read 5 bytes
|
||||
|
@ -76,7 +76,7 @@ func TestFixedBufferString(t *testing.T) {
|
|||
// test that fixedBuffer.String() only returns the part that hasn't been read
|
||||
out = buf.String()
|
||||
if out != "world" {
|
||||
t.Fatalf("expected output to be \"world\", got %q", out)
|
||||
t.Fatalf(`expected output to be "world", got %q`, out)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ func TestFixedBufferWrite(t *testing.T) {
|
|||
}
|
||||
|
||||
if string(buf.buf[:5]) != "hello" {
|
||||
t.Fatalf("expected \"hello\", got %q", string(buf.buf[:5]))
|
||||
t.Fatalf(`expected "hello", got %q`, string(buf.buf[:5]))
|
||||
}
|
||||
|
||||
n, err = buf.Write(bytes.Repeat([]byte{1}, 64))
|
||||
|
@ -121,7 +121,7 @@ func TestFixedBufferRead(t *testing.T) {
|
|||
}
|
||||
|
||||
if string(b) != "hello" {
|
||||
t.Fatalf("expected \"hello\", got %q", string(b))
|
||||
t.Fatalf(`expected "hello", got %q`, string(b))
|
||||
}
|
||||
|
||||
n, err = buf.Read(b)
|
||||
|
@ -134,7 +134,7 @@ func TestFixedBufferRead(t *testing.T) {
|
|||
}
|
||||
|
||||
if string(b) != " worl" {
|
||||
t.Fatalf("expected \" worl\", got %s", string(b))
|
||||
t.Fatalf(`expected " worl", got %s`, string(b))
|
||||
}
|
||||
|
||||
b = b[:1]
|
||||
|
@ -148,6 +148,6 @@ func TestFixedBufferRead(t *testing.T) {
|
|||
}
|
||||
|
||||
if string(b) != "d" {
|
||||
t.Fatalf("expected \"d\", got %s", string(b))
|
||||
t.Fatalf(`expected "d", got %s`, string(b))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -241,22 +241,22 @@ func TestDisplayJSONMessagesStream(t *testing.T) {
|
|||
"",
|
||||
},
|
||||
// Without progress & ID
|
||||
"{ \"status\": \"status\" }": {
|
||||
`{ "status": "status" }`: {
|
||||
"status\n",
|
||||
"status\n",
|
||||
},
|
||||
// Without progress, with ID
|
||||
"{ \"id\": \"ID\",\"status\": \"status\" }": {
|
||||
`{ "id": "ID","status": "status" }`: {
|
||||
"ID: status\n",
|
||||
"ID: status\n",
|
||||
},
|
||||
// With progress
|
||||
"{ \"id\": \"ID\", \"status\": \"status\", \"progress\": \"ProgressMessage\" }": {
|
||||
`{ "id": "ID", "status": "status", "progress": "ProgressMessage" }`: {
|
||||
"ID: status ProgressMessage",
|
||||
fmt.Sprintf("\n%c[%dAID: status ProgressMessage%c[%dB", 27, 1, 27, 1),
|
||||
},
|
||||
// With progressDetail
|
||||
"{ \"id\": \"ID\", \"status\": \"status\", \"progressDetail\": { \"Current\": 1} }": {
|
||||
`{ "id": "ID", "status": "status", "progressDetail": { "Current": 1} }`: {
|
||||
"", // progressbar is disabled in non-terminal
|
||||
fmt.Sprintf("\n%c[%dA%c[2K\rID: status 1B\r%c[%dB", 27, 1, 27, 27, 1),
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue