Skip to content

Commit

Permalink
refine
Browse files Browse the repository at this point in the history
Signed-off-by: Lixia (Sylvia) Lei <[email protected]>
  • Loading branch information
Wwwsylvia committed Oct 13, 2023
1 parent 089ba02 commit c5b2e65
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
18 changes: 13 additions & 5 deletions registry/remote/credentials/internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,19 @@ func TestConfig_GetCredential_legacyConfig(t *testing.T) {
Password: "password1",
},
},
{
name: "Another entry for the same address matched",
serverAddress: "https://registry1.example.com/",
want: auth.Credential{
Username: "foo",
Password: "bar",
},
},
{
name: "Address with different scheme unmached",
serverAddress: "http://registry1.example.com/",
want: auth.EmptyCredential,
},
{
name: "Address with http prefix matched",
serverAddress: "registry2.example.com",
Expand Down Expand Up @@ -240,11 +253,6 @@ func TestConfig_GetCredential_legacyConfig(t *testing.T) {
Password: "password6",
},
},
{
name: "Reverse won't work",
serverAddress: "https://registry1.example.com/",
want: auth.EmptyCredential,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
3 changes: 3 additions & 0 deletions registry/remote/credentials/testdata/legacy_auths_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
},
"https://registry6.example.com/path/": {
"auth": "dXNlcm5hbWU2OnBhc3N3b3JkNg=="
},
"https://registry1.example.com/": {
"auth": "Zm9vOmJhcg=="
}
}
}

0 comments on commit c5b2e65

Please sign in to comment.