From: Reinhard Tartler Date: Fri, 27 Dec 2024 18:04:24 -0500 Subject: Skip tests that fail on unknown certificate status In offline build environments, authentic timestamp verification cannot reach OCSP or CRL revocation endpoints over the internet, causing tests to fail with "revocation status is unknown". Skip the subtests when this revocation error occurs. Forwarded: not-needed Last-Update: 2026-09-25 --- verifier/timestamp_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/verifier/timestamp_test.go b/verifier/timestamp_test.go index 79983aa..b246d20 100644 --- a/verifier/timestamp_test.go +++ b/verifier/timestamp_test.go @@ -18,6 +18,7 @@ import ( "crypto/x509" "net/http" "os" + "strings" "testing" "time" @@ -71,6 +72,9 @@ func TestAuthenticTimestamp(t *testing.T) { } authenticTimestampResult := verifyAuthenticTimestamp(context.Background(), dummyTrustPolicy.Name, dummyTrustPolicy.TrustStores, dummyTrustPolicy.SignatureVerification, trustStore, revocationTimestampingValidator, outcome) if err := authenticTimestampResult.Error; err != nil { + if strings.Contains(err.Error(), "revocation status is unknown") { + t.Skipf("Skipping test: %v", err) + } t.Fatalf("expected nil error, but got %s", err) } }) @@ -82,6 +86,9 @@ func TestAuthenticTimestamp(t *testing.T) { } authenticTimestampResult := verifyAuthenticTimestamp(context.Background(), dummyTrustPolicy.Name, dummyTrustPolicy.TrustStores, dummyTrustPolicy.SignatureVerification, trustStore, revocationTimestampingValidator, outcome) if err := authenticTimestampResult.Error; err != nil { + if strings.Contains(err.Error(), "revocation status is unknown") { + t.Skipf("Skipping test: %v", err) + } t.Fatalf("expected nil error, but got %s", err) } }) @@ -89,6 +96,9 @@ func TestAuthenticTimestamp(t *testing.T) { t.Run("verify Authentic Timestamp jws with expired codeSigning cert", func(t *testing.T) { jwsEnvContent, err := parseEnvContent("testdata/timestamp/sigEnv/jwsExpiredWithTimestamp.sig", jws.MediaTypeEnvelope) if err != nil { + if strings.Contains(err.Error(), "revocation status is unknown") { + t.Skipf("Skipping test: %v", err) + } t.Fatalf("failed to get signature envelope content: %v", err) } outcome := ¬ation.VerificationOutcome{ @@ -97,6 +107,9 @@ func TestAuthenticTimestamp(t *testing.T) { } authenticTimestampResult := verifyAuthenticTimestamp(context.Background(), dummyTrustPolicy.Name, dummyTrustPolicy.TrustStores, dummyTrustPolicy.SignatureVerification, trustStore, revocationTimestampingValidator, outcome) if err := authenticTimestampResult.Error; err != nil { + if strings.Contains(err.Error(), "revocation status is unknown") { + t.Skipf("Skipping test: %v", err) + } t.Fatalf("expected nil error, but got %s", err) } }) @@ -112,6 +125,9 @@ func TestAuthenticTimestamp(t *testing.T) { } authenticTimestampResult := verifyAuthenticTimestamp(context.Background(), dummyTrustPolicy.Name, dummyTrustPolicy.TrustStores, dummyTrustPolicy.SignatureVerification, trustStore, revocationTimestampingValidator, outcome) if err := authenticTimestampResult.Error; err != nil { + if strings.Contains(err.Error(), "revocation status is unknown") { + t.Skipf("Skipping test: %v", err) + } t.Fatalf("expected nil error, but got %s", err) } })