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

Commit e80dba9

Browse files
authored
Added test for cert manager
Added test for cert manager for a nil ca Fixes #3437 Signed-off-by: mudit singh <[email protected]>
1 parent c9d2292 commit e80dba9

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pkg/certificate/providers/tresor/certificate_manager_test.go

+18
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,24 @@ var _ = Describe("Test Certificate Manager", func() {
7676
})
7777
})
7878

79+
Context("Test nil certificate issue", func() {
80+
validity := 3 * time.Second
81+
mockConfigurator = configurator.NewMockConfigurator(mockCtrl)
82+
mockConfigurator.EXPECT().GetServiceCertValidityPeriod().Return(validity).AnyTimes()
83+
mockConfigurator.EXPECT().GetCertKeyBitSize().Return(2048).AnyTimes()
84+
m, newCertError := NewCertManager(
85+
nil,
86+
"org",
87+
mockConfigurator,
88+
mockConfigurator.GetServiceCertValidityPeriod(),
89+
mockConfigurator.GetCertKeyBitSize(),
90+
)
91+
It("should return nil and error of no certificate", func() {
92+
Expect(m).To(BeNil())
93+
Expect(newCertError).To(Equal(errNoIssuingCA))
94+
})
95+
})
96+
7997
Context("Test Getting a certificate from the cache", func() {
8098
validity := 1 * time.Hour
8199
cn := certificate.CommonName("Test CA")

0 commit comments

Comments
 (0)