@@ -16,9 +16,35 @@ func TestCerts_CertificateName(t *testing.T) {
16
16
}
17
17
18
18
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
+ }
19
45
}
20
46
21
- func makeCert (hasReady , hasIssuing , ready bool ) * cmapi.Certificate {
47
+ func makeCert (hasReady , hasIssuing , ready bool ) cmapi.Certificate {
22
48
cert := cmapi.Certificate {
23
49
Status : cmapi.CertificateStatus {
24
50
Conditions : []cmapi.CertificateCondition {},
@@ -43,5 +69,5 @@ func makeCert(hasReady, hasIssuing, ready bool) *cmapi.Certificate {
43
69
})
44
70
}
45
71
46
- return & cert
72
+ return cert
47
73
}
0 commit comments