From c620d854ae6ec2b6ed87bd6f99552ee03afa78d0 Mon Sep 17 00:00:00 2001 From: Junjie Gao Date: Thu, 22 Aug 2024 08:08:05 +0000 Subject: [PATCH] fix: update Signed-off-by: Junjie Gao --- revocation/internal/crl/crl.go | 6 +++--- revocation/internal/crl/crl_test.go | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/revocation/internal/crl/crl.go b/revocation/internal/crl/crl.go index 1f7502c5..0cdb6d51 100644 --- a/revocation/internal/crl/crl.go +++ b/revocation/internal/crl/crl.go @@ -69,9 +69,9 @@ func CertCheckStatus(ctx context.Context, cert, issuer *x509.Certificate, opts C // CRL not enabled for this certificate. return &result.CertRevocationResult{ Result: result.ResultNonRevokable, - CRLResults: []*result.CRLResult{ - {Result: result.ResultNonRevokable}, - }, + CRLResults: []*result.CRLResult{{ + Result: result.ResultNonRevokable, + }}, } } diff --git a/revocation/internal/crl/crl_test.go b/revocation/internal/crl/crl_test.go index 4b903fe8..88ce6826 100644 --- a/revocation/internal/crl/crl_test.go +++ b/revocation/internal/crl/crl_test.go @@ -33,6 +33,14 @@ import ( ) func TestCertCheckStatus(t *testing.T) { + t.Run("certtificate does not have CRLDistributionPoints", func(t *testing.T) { + cert := &x509.Certificate{} + r := CertCheckStatus(context.Background(), cert, &x509.Certificate{}, CertCheckStatusOptions{}) + if r.Result != result.ResultNonRevokable { + t.Fatalf("expected NonRevokable, got %s", r.Result) + } + }) + t.Run("download error", func(t *testing.T) { cert := &x509.Certificate{ CRLDistributionPoints: []string{"http://example.com"},