github.com/letsencrypt/boulder@v0.20251208.0/linter/lints/cabf_br/lint_crl_no_critical_reason_codes_test.go (about) 1 package cabfbr 2 3 import ( 4 "fmt" 5 "strings" 6 "testing" 7 8 "github.com/zmap/zlint/v3/lint" 9 10 "github.com/letsencrypt/boulder/linter/lints/test" 11 ) 12 13 func TestCrlCriticalReasonCodes(t *testing.T) { 14 t.Parallel() 15 16 testCases := []struct { 17 name string 18 want lint.LintStatus 19 wantSubStr string 20 }{ 21 { 22 name: "good", 23 want: lint.Pass, 24 }, 25 { 26 name: "critical_reason", 27 want: lint.Error, 28 wantSubStr: "reasonCode extension MUST NOT be marked critical", 29 }, 30 } 31 32 for _, tc := range testCases { 33 t.Run(tc.name, func(t *testing.T) { 34 l := NewCrlCriticalReasonCodes() 35 c := test.LoadPEMCRL(t, fmt.Sprintf("testdata/crl_%s.pem", tc.name)) 36 r := l.Execute(c) 37 38 if r.Status != tc.want { 39 t.Errorf("expected %q, got %q", tc.want, r.Status) 40 } 41 if !strings.Contains(r.Details, tc.wantSubStr) { 42 t.Errorf("expected %q, got %q", tc.wantSubStr, r.Details) 43 } 44 }) 45 } 46 }