From ba3a98185285767d1c6ce4ca9154470b2c286a34 Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Sun, 22 Nov 2020 19:54:44 +0000 Subject: [PATCH] certdehydrate: Fix unit test for Golang issue 40458 CreateCertificate now checks the resulting signature as of Go 1.16+. This was confusing our unit test for invalid dehydrated certs, which was expecting to need to verify the cert after the cert was created. --- certdehydrate/certdehydrate_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/certdehydrate/certdehydrate_test.go b/certdehydrate/certdehydrate_test.go index a528bf3..025904a 100644 --- a/certdehydrate/certdehydrate_test.go +++ b/certdehydrate/certdehydrate_test.go @@ -94,9 +94,13 @@ func TestDehydratedCertSignatureInvalid(t *testing.T) { t.Error("Error rehydrating certificate:", err) } + // Go 1.16+ will error here due to Golang issue #40458. + // Earlier Go versions won't notice. derBytes, err := certdehydrate.FillRehydratedCertTemplate(*template, "www2.veclabs.bit") if err != nil { - t.Error("Error filling domain into rehydrated certificate template:", err) + // The invalid sig was detected by Go 1.16+ like we want. derBytes is + // nil, so we can't proceed, which is fine. + return } cert, err := x509.ParseCertificate(derBytes)