Skip to content

Commit cc63f69

Browse files
chore: panic on error in test (GoogleCloudPlatform#947)
The err for certDerBytes, err := x509.CreateCertificate(rand.Reader, cert, cert, &k.PublicKey, k) was being unused. Adding check for error and calling panic in tests.
1 parent 36bfb60 commit cc63f69

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/mock/certs.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ func mustBuildRootCertificate(subject pkix.Name, k *rsa.PrivateKey) *x509.Certif
124124
}
125125

126126
certDerBytes, err := x509.CreateCertificate(rand.Reader, cert, cert, &k.PublicKey, k)
127+
if err != nil {
128+
panic(err)
129+
}
127130
c, err := x509.ParseCertificate(certDerBytes)
128131
if err != nil {
129132
panic(err)
@@ -163,6 +166,9 @@ func mustBuildSignedCertificate(
163166
}
164167

165168
certDerBytes, err := x509.CreateCertificate(rand.Reader, cert, cert, &subjectPublicKey.PublicKey, issuerPrivateKey)
169+
if err != nil {
170+
panic(err)
171+
}
166172
c, err := x509.ParseCertificate(certDerBytes)
167173
if err != nil {
168174
panic(err)

0 commit comments

Comments
 (0)