fix ginkgolinter linter

Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
This commit is contained in:
Tim Ramlot 2024-04-29 15:18:01 +02:00
parent 4e66b95473
commit aac2233b1a
No known key found for this signature in database
GPG Key ID: 47428728E0C2878D
6 changed files with 10 additions and 11 deletions

View File

@ -25,7 +25,6 @@ issues:
- gosimple
- nakedret
- asasalint
- ginkgolinter
- goprintffuncname
- ineffassign
- musttag

View File

@ -126,7 +126,7 @@ var oidExtensionSubjectAltName = []int{2, 5, 29, 17}
func extractSANsFromCertificate(certDER string) pkix.Extension {
block, rest := pem.Decode([]byte(certDER))
Expect(len(rest)).To(Equal(0))
Expect(rest).To(BeEmpty())
cert, err := x509.ParseCertificate(block.Bytes)
Expect(err).NotTo(HaveOccurred())

View File

@ -367,7 +367,7 @@ var _ = framework.CertManagerDescribe("Certificate AdditionalCertificateOutputFo
continue
}
var fieldset fieldpath.Set
Expect(fieldset.FromJSON(bytes.NewReader(managedField.FieldsV1.Raw)))
Expect(fieldset.FromJSON(bytes.NewReader(managedField.FieldsV1.Raw))).NotTo(HaveOccurred())
if fieldset.Has(fieldpath.Path{
{FieldName: ptr.To("data")},
{FieldName: ptr.To("tls-combined.pem")},

View File

@ -97,12 +97,12 @@ var _ = framework.CertManagerDescribe("literalsubject rdn parsing", func() {
Expect(err).NotTo(HaveOccurred(), "failed to wait for Certificate to become Ready")
secret, err := f.KubeClientSet.CoreV1().Secrets(f.Namespace.Name).Get(context.TODO(), secretName, metav1.GetOptions{})
Expect(err).To(BeNil())
Expect(err).NotTo(HaveOccurred())
Expect(secret.Data).To(HaveKey("tls.crt"))
crtPEM := secret.Data["tls.crt"]
pemBlock, _ := pem.Decode(crtPEM)
cert, err := x509.ParseCertificate(pemBlock.Bytes)
Expect(err).To(BeNil())
Expect(err).NotTo(HaveOccurred())
Expect(cert.Subject.Names).To(Equal([]pkix.AttributeTypeAndValue{
{Type: asn1.ObjectIdentifier{2, 5, 4, 6}, Value: "Spain"},
@ -121,7 +121,7 @@ var _ = framework.CertManagerDescribe("literalsubject rdn parsing", func() {
It("Should not allow unknown RDN component", func() {
_, err := createCertificate(f, "UNKNOWN=blah")
Expect(err).NotTo(BeNil())
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("Literal subject contains unrecognized key with value [blah]"))
})

View File

@ -103,12 +103,12 @@ var _ = framework.CertManagerDescribe("othername san processing", func() {
Expect(err).NotTo(HaveOccurred(), "failed to wait for Certificate to become Ready")
secret, err := f.KubeClientSet.CoreV1().Secrets(f.Namespace.Name).Get(context.TODO(), secretName, metav1.GetOptions{})
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
Expect(secret.Data).To(HaveKey("tls.crt"))
crtPEM := secret.Data["tls.crt"]
pemBlock, _ := pem.Decode(crtPEM)
cert, err := x509.ParseCertificate(pemBlock.Bytes)
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
By("Including the appropriate GeneralNames ( RFC822 email Address and OtherName) in generated Certificate")
@ -151,7 +151,7 @@ YH0ROM05IRf2nOI6KInaiz4POk6JvdTb
UTF8Value: "user@example.org",
},
})
Expect(err).NotTo(BeNil())
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("admission webhook \"webhook.cert-manager.io\" denied the request: spec.otherNames[0].oid: Invalid value: \"BAD_OID\": oid syntax invalid"))
})
@ -166,7 +166,7 @@ YH0ROM05IRf2nOI6KInaiz4POk6JvdTb
UTF8Value: "user@example.org",
},
})
Expect(err).NotTo(BeNil())
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("admission webhook \"webhook.cert-manager.io\" denied the request: spec.otherNames[0].utf8Value: Required value: must be set to a valid non-empty UTF8 string"))
})

View File

@ -267,7 +267,7 @@ func (s *Suite) Define() {
pemBlock, _ := pem.Decode(certBytes)
cert, err := x509.ParseCertificate(pemBlock.Bytes)
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
By("Including the appropriate GeneralNames ( RFC822 email Address and OtherName) in generated Certificate")
/* openssl req -nodes -newkey rsa:2048 -subj "/CN=someCN" \