10000 add test case for expired certificate · cert-manager/cert-manager@87f4e1a · GitHub
[go: up one dir, main page]

Skip to content

Commit 87f4e1a

Browse files
inteoncert-manager-bot
authored andcommitted
add test case for expired certificate
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
1 parent 0749fee commit 87f4e1a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pkg/server/tls/authority/authority_test.go

< AA5B span aria-hidden="true" class="f6 text-bold fgColor-success">+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,18 @@ func Test__caRequiresRegeneration(t *testing.T) {
147147
},
148148
expect: false,
149149
},
150+
{
151+
name: "Root CA certificate is expired",
152+
secret: &corev1.Secret{
153+
Data: generateSecretData(
154+
func(cert *x509.Certificate) {
155+
cert.NotBefore = time.Now().Add(-1 * time.Hour)
156+
cert.NotAfter = time.Now().Add(-1 * time.Minute)
157+
},
158+
),
159+
},
160+
expect: true,
161+
},
150162
{
151163
name: "Ok",
152164
secret: &corev1.Secret{

0 commit comments

Comments
 (0)
0