Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestBuildContainerFromDockerfileWithDockerAuthConfig working on MacOS #1694

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docker_auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func TestBuildContainerFromDockerfileWithDockerAuthConfig(t *testing.T) {
base64 := "dGVzdHVzZXI6dGVzdHBhc3N3b3Jk" // testuser:testpassword
t.Setenv("DOCKER_AUTH_CONFIG", `{
"auths": {
"localhost:5000": { "username": "testuser", "password": "testpassword", "auth": "`+base64+`" }
"localhost:5001": { "username": "testuser", "password": "testpassword", "auth": "`+base64+`" }
},
"credsStore": "desktop"
}`)
Expand Down Expand Up @@ -187,7 +187,7 @@ func TestBuildContainerFromDockerfileShouldFailWithWrongDockerAuthConfig(t *test
base64 := "Zm9vOmJhcg==" // foo:bar
t.Setenv("DOCKER_AUTH_CONFIG", `{
"auths": {
"localhost:5000": { "username": "foo", "password": "bar", "auth": "`+base64+`" }
"localhost:5001": { "username": "foo", "password": "bar", "auth": "`+base64+`" }
},
"credsStore": "desktop"
}`)
Expand Down Expand Up @@ -216,7 +216,7 @@ func TestCreateContainerFromPrivateRegistry(t *testing.T) {
base64 := "dGVzdHVzZXI6dGVzdHBhc3N3b3Jk" // testuser:testpassword
t.Setenv("DOCKER_AUTH_CONFIG", `{
"auths": {
"localhost:5000": { "username": "testuser", "password": "testpassword", "auth": "`+base64+`" }
"localhost:5001": { "username": "testuser", "password": "testpassword", "auth": "`+base64+`" }
},
"credsStore": "desktop"
}`)
Expand All @@ -225,7 +225,7 @@ func TestCreateContainerFromPrivateRegistry(t *testing.T) {

ctx := context.Background()
req := ContainerRequest{
Image: "localhost:5000/redis:5.0-alpine",
Image: "localhost:5001/redis:5.0-alpine",
AlwaysPullImage: true, // make sure the authentication takes place
ExposedPorts: []string{"6379/tcp"},
WaitingFor: wait.ForLog("Ready to accept connections"),
Expand All @@ -246,7 +246,7 @@ func prepareLocalRegistryWithAuth(t *testing.T) {
// bindMounts {
req := ContainerRequest{
Image: "registry:2",
ExposedPorts: []string{"5000:5000/tcp"},
ExposedPorts: []string{"5001:5000/tcp"},
Env: map[string]string{
"REGISTRY_AUTH": "htpasswd",
"REGISTRY_AUTH_HTPASSWD_REALM": "Registry",
Expand Down Expand Up @@ -281,7 +281,7 @@ func prepareLocalRegistryWithAuth(t *testing.T) {
assert.NoError(t, err)

t.Cleanup(func() {
removeImageFromLocalCache(t, "localhost:5000/redis:5.0-alpine")
removeImageFromLocalCache(t, "localhost:5001/redis:5.0-alpine")
})
t.Cleanup(func() {
assert.NoError(t, registryC.Terminate(context.Background()))
Expand Down
2 changes: 1 addition & 1 deletion testdata/auth.Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM localhost:5000/redis:5.0-alpine
FROM localhost:5001/redis:5.0-alpine