Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
osm-controller/test: compare cert for equality instead of its length (#…
Browse files Browse the repository at this point in the history
…1639)

The test hardcodes the expected length for a certificate, compare
the certificate content instead. An issue was seen when the Go
version was updated, possibly resulting from a change in a lib
used for generating the certs. This change removes the length
check and directly compares the certificate.

Resolves #1635

Signed-off-by: Shashank Ram <shashank08@gmail.com>
  • Loading branch information
shashankram authored Aug 27, 2020
1 parent 8266205 commit 4a35522
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/osm-controller/osm-controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ var _ = Describe("Test creation of CA bundle k8s secret", func() {
expected := "-----BEGIN CERTIFICATE-----\nMIIF"
stringPEM := string(actual.Data[constants.KubernetesOpaqueSecretCAKey])[:len(expected)]
Expect(stringPEM).To(Equal(expected))
Expect(len(actual.Data[constants.KubernetesOpaqueSecretCAKey])).To(Equal(1915))

expectedRootCert, err := certManager.GetRootCertificate()
Expect(err).ToNot(HaveOccurred())
Expect(actual.Data[constants.KubernetesOpaqueSecretCAKey]).To(Equal(expectedRootCert.GetCertificateChain()))
})
})
})

0 comments on commit 4a35522

Please sign in to comment.