Skip to content

Commit

Permalink
discard cache error
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Zheng <[email protected]>
  • Loading branch information
Two-Hearts committed Nov 1, 2024
1 parent eb76e2a commit 3cbad75
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/notation/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ func getVerifier(ctx context.Context) (notation.Verifier, error) {
if err != nil {
return nil, err
}
crlFetcher.DiscardCacheError = true // discard cache error
revocationCodeSigningValidator, err := revocation.NewWithOptions(revocation.Options{
OCSPHTTPClient: ocspHttpClient,
CRLFetcher: crlFetcher,
Expand Down
12 changes: 12 additions & 0 deletions cmd/notation/verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,18 @@ func TestVerifyCommand_MissingArgs(t *testing.T) {
}

func TestGetVerifier(t *testing.T) {
defer func(oldConfiDir, oldCacheDir string) {
dir.UserConfigDir = oldConfiDir
dir.UserCacheDir = oldCacheDir
}(dir.UserConfigDir, dir.UserCacheDir)

t.Run("success", func(t *testing.T) {
_, err := getVerifier(context.Background())
if err != nil {
t.Fatal(err)
}
})

t.Run("non-existing trust policy", func(t *testing.T) {
dir.UserConfigDir = "/"
expectedErrMsg := "trust policy is not present. To create a trust policy, see: https://notaryproject.dev/docs/quickstart/#create-a-trust-policy"
Expand Down

0 comments on commit 3cbad75

Please sign in to comment.