Skip to content

Commit 8d4be1b

Browse files
aledbfclaude
andcommitted
test(oci): hold the empty-registry skip of ResolveBuildAuth
The whole-repository mutation run without Docker left one edit standing: `reg == "" || seen[reg]` read as `&&`. A DEVCONTAINERS_OCI_AUTH entry with an empty host matches an empty registry, so without the skip the build's auth config gains a "" entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent a863be0 commit 8d4be1b

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎internal/oci/buildauth_test.go‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,15 @@ func TestResolveBuildAuth_IdentityToken(t *testing.T) {
136136
t.Errorf("Auth should be empty for a token-only credential, got %q", entry.Auth)
137137
}
138138
}
139+
140+
// An empty registry (an image reference with no registry part resolved) is
141+
// skipped before any lookup, even when DEVCONTAINERS_OCI_AUTH carries an entry
142+
// with an empty host that would match it.
143+
func TestResolveBuildAuthSkipsAnEmptyRegistry(t *testing.T) {
144+
env := map[string]string{"DEVCONTAINERS_OCI_AUTH": "|u|p", "DOCKER_CONFIG": isolatedDockerConfig(t)}
145+
dir, cleanup, ok, err := ResolveBuildAuth(env, []string{""}, log.Null)
146+
defer cleanup()
147+
if err != nil || ok || dir != "" {
148+
t.Errorf("ResolveBuildAuth(\"\") = (%q, ok=%v, %v), want no auth config", dir, ok, err)
149+
}
150+
}

0 commit comments

Comments
 (0)