@@ -35,7 +35,6 @@ func TestNewVerifier(t *testing.T) {
3535 config .IgnoreSCT = true
3636 config .IgnoreTlog = true
3737 config .IgnoreAttestations = true
38- config .RekorURL = "https://rekor.test.com"
3938 config .RegistryCredentials = map [string ]* RegistryCredential {
4039 "docker.io" : {
4140 Username : "testuser" ,
@@ -45,6 +44,15 @@ func TestNewVerifier(t *testing.T) {
4544 Username : "testuser" ,
4645 Password : "testpassword" ,
4746 },
47+ "nopassword.io" : { // should warn and ignore
48+ Username : "testuser" ,
49+ Password : "" ,
50+ },
51+ "nousername.io" : { // should warn and ignore
52+ Username : "" ,
53+ Password : "testpassword" ,
54+ },
55+ "nil.io" : nil , // should ignore
4856 }
4957
5058 config .SkippedImages = map [string ]struct {}{
@@ -58,6 +66,8 @@ func TestNewVerifier(t *testing.T) {
5866
5967 verifier := NewVerifier (config )
6068 require .NotNil (t , verifier )
69+ require .NotNil (t , verifier .config .Logger )
70+ require .Equal (t , verifier .config .RekorURL , publicRekorURL ) // verify default public RekorURL
6171
6272 identityPlainValues := cosign.Identity {
6373 Issuer : "test-issuer" ,
@@ -70,7 +80,11 @@ func TestNewVerifier(t *testing.T) {
7080 expectedIdentites := []cosign.Identity {identityPlainValues , identityRegExp }
7181
7282 assert .Equal (t , config , verifier .config )
73- assert .Equal (t , len (config .RegistryCredentials ), len (verifier .authOptions ))
83+ assert .NotNil (t , verifier .authOptions ["docker.io" ])
84+ assert .NotNil (t , verifier .authOptions ["other.io" ])
85+ assert .Nil (t , verifier .authOptions ["nopassword.io" ])
86+ assert .Nil (t , verifier .authOptions ["nousername.io" ])
87+ assert .Nil (t , verifier .authOptions ["nil.io" ])
7488 assert .ElementsMatch (t , expectedIdentites , verifier .allowedIdentities )
7589 assert .NotNil (t , verifier .sigstoreFunctions .verifyImageSignatures )
7690 assert .NotNil (t , verifier .sigstoreFunctions .verifyImageAttestations )
0 commit comments