Skip to content

Commit a3d03a1

Browse files
committed
Finish up test for isCertReady()
1 parent 778fe91 commit a3d03a1

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

certs/util_test.go

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,35 @@ func TestCerts_CertificateName(t *testing.T) {
1616
}
1717

1818
func TestCerts_isCertReady(t *testing.T) {
19+
tests := map[string]struct {
20+
cert cmapi.Certificate
21+
expected bool
22+
}{
23+
"NoConditions": {
24+
cert: makeCert(false, false, false),
25+
expected: false,
26+
},
27+
"Issuing": {
28+
cert: makeCert(false, true, false),
29+
expected: false,
30+
},
31+
"IssuingNotReady": {
32+
cert: makeCert(true, true, false),
33+
expected: false,
34+
},
35+
"Ready": {
36+
cert: makeCert(true, true, true),
37+
expected: true,
38+
},
39+
}
40+
41+
for _, tc := range tests {
42+
ready := isCertReady(&tc.cert)
43+
assert.Equal(t, tc.expected, ready)
44+
}
1945
}
2046

21-
func makeCert(hasReady, hasIssuing, ready bool) *cmapi.Certificate {
47+
func makeCert(hasReady, hasIssuing, ready bool) cmapi.Certificate {
2248
cert := cmapi.Certificate{
2349
Status: cmapi.CertificateStatus{
2450
Conditions: []cmapi.CertificateCondition{},
@@ -43,5 +69,5 @@ func makeCert(hasReady, hasIssuing, ready bool) *cmapi.Certificate {
4369
})
4470
}
4571

46-
return &cert
72+
return cert
4773
}

0 commit comments

Comments
 (0)