Skip to content

Commit 9545d18

Browse files
committed
fix unit-tests
1 parent 264aa76 commit 9545d18

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

pkg/psmdb/tls/certificate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (c *caCert) Name() string {
3333
}
3434

3535
func (c *caCert) Namespace() string {
36-
if c.cr.CompareVersion("1.22.0") >= 0 && c.cr.Spec.TLS.IssuerConf.Kind == cm.ClusterIssuerKind {
36+
if c.cr.CompareVersion("1.22.0") >= 0 && c.cr.Spec.TLS != nil && c.cr.Spec.TLS.IssuerConf.Kind == cm.ClusterIssuerKind {
3737
return certManagerNamespace()
3838
}
3939

@@ -53,7 +53,7 @@ func (c *caCert) Object() *cm.Certificate {
5353
}
5454

5555
issuerKind := cm.IssuerKind
56-
if cr.CompareVersion("1.22.0") >= 0 {
56+
if cr.CompareVersion("1.22.0") >= 0 && cr.Spec.TLS != nil {
5757
issuerKind = cr.Spec.TLS.IssuerConf.Kind
5858
}
5959
return &cm.Certificate{

pkg/psmdb/tls/certmanager_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ func TestCreateCertificate(t *testing.T) {
136136
}
137137

138138
func TestWaitForCerts(t *testing.T) {
139-
ctx := context.Background()
140-
141139
cr := &api.PerconaServerMongoDB{
142140
ObjectMeta: metav1.ObjectMeta{
143141
Name: "test-cluster",
@@ -256,7 +254,7 @@ func TestWaitForCerts(t *testing.T) {
256254
dryRun: false,
257255
}
258256

259-
err := controller.WaitForCerts(ctx, cr, CertificateCA(cr))
257+
err := controller.WaitForCerts(t.Context(), cr, CertificateCA(cr))
260258
assert.NoError(t, err)
261259
})
262260
}

0 commit comments

Comments
 (0)