daemon/create.go: Fix error capitalization

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
This commit is contained in:
Albin Kerouanton 2023-08-10 01:32:05 +02:00
parent 742475bc8d
commit 38e26c4717
No known key found for this signature in database
GPG key ID: 630B8E1DCBDB1864
3 changed files with 6 additions and 7 deletions

View file

@ -305,7 +305,7 @@ func (daemon *Daemon) mergeAndVerifyConfig(config *containertypes.Config, img *i
config.Entrypoint = nil
}
if len(config.Entrypoint) == 0 && len(config.Cmd) == 0 {
return fmt.Errorf("No command specified")
return fmt.Errorf("no command specified")
}
return nil
}
@ -321,7 +321,7 @@ func verifyNetworkingConfig(nwConfig *networktypes.NetworkingConfig) error {
for k := range nwConfig.EndpointsConfig {
l = append(l, k)
}
return fmt.Errorf("Container cannot be connected to network endpoints: %s", strings.Join(l, ", "))
return fmt.Errorf("container cannot be connected to network endpoints: %s", strings.Join(l, ", "))
}
for k, v := range nwConfig.EndpointsConfig {

View file

@ -550,8 +550,7 @@ func (s *DockerAPISuite) TestContainerAPICreateEmptyConfig(c *testing.T) {
_, err = apiClient.ContainerCreate(context.Background(), &container.Config{}, &container.HostConfig{}, &network.NetworkingConfig{}, nil, "")
expected := "No command specified"
assert.ErrorContains(c, err, expected)
assert.ErrorContains(c, err, "no command specified")
}
func (s *DockerAPISuite) TestContainerAPICreateMultipleNetworksConfig(c *testing.T) {
@ -575,7 +574,7 @@ func (s *DockerAPISuite) TestContainerAPICreateMultipleNetworksConfig(c *testing
_, err = apiClient.ContainerCreate(context.Background(), &config, &container.HostConfig{}, &networkingConfig, nil, "")
msg := err.Error()
// network name order in error message is not deterministic
assert.Assert(c, strings.Contains(msg, "Container cannot be connected to network endpoints"))
assert.Assert(c, strings.Contains(msg, "container cannot be connected to network endpoints"))
assert.Assert(c, strings.Contains(msg, "net1"))
assert.Assert(c, strings.Contains(msg, "net2"))
assert.Assert(c, strings.Contains(msg, "net3"))

View file

@ -1948,7 +1948,7 @@ func (s *DockerCLIRunSuite) TestRunCidFileCleanupIfEmpty(c *testing.T) {
out, _, err := dockerCmdWithError("run", "--cidfile", tmpCidFile, image)
if err == nil {
c.Fatalf("Run without command must fail. out=%s", out)
} else if !strings.Contains(out, "No command specified") {
} else if !strings.Contains(out, "no command specified") {
c.Fatalf("Run without command failed with wrong output. out=%s\nerr=%v", out, err)
}
@ -3988,7 +3988,7 @@ exec "$@"`,
// CMD will be reset as well (the same as setting a custom entrypoint)
cli.Docker(cli.Args("run", "--entrypoint=", "-t", name)).Assert(c, icmd.Expected{
ExitCode: 125,
Err: "No command specified",
Err: "no command specified",
})
}