Skip to content

Commit

Permalink
Reset legacy X509 parser on test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
hslatman committed Sep 11, 2024
1 parent 5ca69c2 commit 46c9f76
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion parse_go1.23_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ func TestParseWindowsSCEPCertificateRequest(t *testing.T) {

// enable the legacy parser when Go 1.23 or newer is used, and parse it again
SetFallbackLegacyX509CertificateParserEnabled(true)
t.Cleanup(func() {
SetFallbackLegacyX509CertificateParserEnabled(false)
})
p7, err = Parse(data)
if err != nil {
t.Errorf("failed parsing SCEP request data with legacy X509 certificate parser enabled: %v", err)
}
SetFallbackLegacyX509CertificateParserEnabled(false)

if len(p7.Certificates) != 1 {
t.Errorf("expected a single certificate; got %d", len(p7.Certificates))
Expand Down

0 comments on commit 46c9f76

Please sign in to comment.