diff --git a/cmd/notation/verify.go b/cmd/notation/verify.go index 8cadc07a..66cc0df0 100644 --- a/cmd/notation/verify.go +++ b/cmd/notation/verify.go @@ -246,8 +246,8 @@ func getVerifier(ctx context.Context) (notation.Verifier, error) { } fileCache, err := crl.NewFileCache(cacheRoot) if err != nil { - // discard NewFileCache error directly as cache is not critical - fmt.Printf("Warning: %v\n", err) + // discard NewFileCache error as cache errors are not critical + fmt.Fprintf(os.Stderr, "Warning: %v\n", err) } else { crlFetcher.Cache = &clicrl.CacheWithLog{ Cache: fileCache, diff --git a/test/e2e/suite/scenario/crl.go b/test/e2e/suite/scenario/crl.go index 4eef6944..bf76424f 100644 --- a/test/e2e/suite/scenario/crl.go +++ b/test/e2e/suite/scenario/crl.go @@ -135,7 +135,7 @@ var _ = Describe("notation CRL revocation check", Serial, func() { }) }) - It("successfully completed with cache creation error in debug log", func() { + It("successfully completed with cache creation error in warning message", func() { Host(CRLOptions(), func(notation *utils.ExecOpts, artifact *Artifact, vhost *utils.VirtualHost) { notation.Exec("sign", artifact.ReferenceWithDigest()). MatchKeyWords(SignSuccessfully) @@ -152,9 +152,9 @@ var _ = Describe("notation CRL revocation check", Serial, func() { notation.Exec("verify", artifact.ReferenceWithDigest(), "-d"). MatchKeyWords( VerifySuccessfully, - "Warning: failed to create crl file cache", ). MatchErrKeyWords( + "Warning: failed to create crl file cache", "OCSP check failed with unknown error and fallback to CRL check for certificate #2", `"GET" "http://localhost:10086/intermediate.crl"`, `"GET" "http://localhost:10086/leaf.crl"`, @@ -165,7 +165,7 @@ var _ = Describe("notation CRL revocation check", Serial, func() { }) }) - It("failed with revoked leaf certificate and cache creation error in debug log", func() { + It("failed with revoked leaf certificate and cache creation error in warning message", func() { Host(CRLOptions(), func(notation *utils.ExecOpts, artifact *Artifact, vhost *utils.VirtualHost) { notation.Exec("sign", artifact.ReferenceWithDigest()). MatchKeyWords(SignSuccessfully) @@ -180,11 +180,9 @@ var _ = Describe("notation CRL revocation check", Serial, func() { // verify without cache notation.ExpectFailure().Exec("verify", artifact.ReferenceWithDigest(), "-d"). - MatchKeyWords( - "Warning: failed to create crl file cache", - ). MatchErrKeyWords( VerifyFailed, + "Warning: failed to create crl file cache", "OCSP check failed with unknown error and fallback to CRL check for certificate #2", `"GET" "http://localhost:10086/intermediate.crl"`, `"GET" "http://localhost:10086/leaf.crl"`,