diff --git a/components/engine/integration-cli/docker_api_auth_test.go b/components/engine/integration-cli/docker_api_auth_test.go deleted file mode 100644 index a1f7a098cd..0000000000 --- a/components/engine/integration-cli/docker_api_auth_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package main - -import ( - "github.com/docker/docker/api/types" - "github.com/docker/docker/client" - "github.com/docker/docker/integration-cli/checker" - "github.com/go-check/check" - "golang.org/x/net/context" -) - -// Test case for #22244 -func (s *DockerSuite) TestAuthAPI(c *check.C) { - testRequires(c, Network) - config := types.AuthConfig{ - Username: "no-user", - Password: "no-password", - } - cli, err := client.NewEnvClient() - c.Assert(err, checker.IsNil) - defer cli.Close() - - _, err = cli.RegistryLogin(context.Background(), config) - expected := "Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password" - c.Assert(err.Error(), checker.Contains, expected) -} diff --git a/components/engine/integration/system/login_test.go b/components/engine/integration/system/login_test.go new file mode 100644 index 0000000000..a3e296c3ac --- /dev/null +++ b/components/engine/integration/system/login_test.go @@ -0,0 +1,27 @@ +package system + +import ( + "testing" + + "github.com/docker/docker/api/types" + "github.com/docker/docker/integration/util/request" + "github.com/docker/docker/integration/util/requirement" + "github.com/gotestyourself/gotestyourself/skip" + "github.com/stretchr/testify/assert" + "golang.org/x/net/context" +) + +// Test case for GitHub 22244 +func TestLoginFailsWithBadCredentials(t *testing.T) { + skip.IfCondition(t, !requirement.HasHubConnectivity(t)) + + client := request.NewAPIClient(t) + + config := types.AuthConfig{ + Username: "no-user", + Password: "no-password", + } + _, err := client.RegistryLogin(context.Background(), config) + expected := "Error response from daemon: Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password" + assert.EqualError(t, err, expected) +}