Skip to content

Commit

Permalink
fixing failing tests
Browse files Browse the repository at this point in the history
Signed-off-by: chaosinthecrd <[email protected]>
  • Loading branch information
ChaosInTheCRD authored and jkjell committed Jul 6, 2024
1 parent 4904d89 commit 97cfc04
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
15 changes: 7 additions & 8 deletions policy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,19 @@ func (p Policy) PublicKeyVerifiers(ko map[string][]func(signer.SignerProvider) (
}
}

kspv, ok := vp.(*kms.KMSSignerProvider)
if !ok {
return nil, fmt.Errorf("provided verifier provider is not a KMS verifier provider")
if vp != nil {
var ok bool
ksp, ok = vp.(*kms.KMSSignerProvider)
if !ok {
return nil, fmt.Errorf("provided verifier provider is not a KMS verifier provider")
}
}

verifier, err = kspv.Verifier(context.TODO())
verifier, err = ksp.Verifier(context.TODO())
if err != nil {
return nil, fmt.Errorf("failed to create kms verifier: %w", err)
}

if err != nil {
return nil, fmt.Errorf("KMS Key ID recognized but not valid: %w", err)
}

}
}

Expand Down
3 changes: 2 additions & 1 deletion policy/policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/in-toto/go-witness/attestation/commandrun"
"github.com/in-toto/go-witness/cryptoutil"
"github.com/in-toto/go-witness/intoto"
"github.com/in-toto/go-witness/signer"
"github.com/in-toto/go-witness/source"
"github.com/invopop/jsonschema"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -483,7 +484,7 @@ func TestPubKeyVerifiers(t *testing.T) {
}
}

verifiers, err := p.PublicKeyVerifiers()
verifiers, err := p.PublicKeyVerifiers(map[string][]func(signer.SignerProvider) (signer.SignerProvider, error){})
if testCase.expectedErr == nil {
assert.NoError(t, err)
assert.Len(t, verifiers, testCase.expectedLen)
Expand Down

0 comments on commit 97cfc04

Please sign in to comment.