Fix a flake in kubecertauthority_test.go.

Signed-off-by: Matt Moyer <moyerm@vmware.com>
This commit is contained in:
Matt Moyer 2020-08-28 16:13:43 -05:00
parent ecf67862e2
commit 0135d8b6c3

View File

@ -215,9 +215,6 @@ func TestCA(t *testing.T) {
// Tick the timer and wait for another refresh loop to complete. // Tick the timer and wait for another refresh loop to complete.
fakeTicker <- time.Now() fakeTicker <- time.Now()
r.Equal(1, callbacks.NumberOfTimesSuccessCalled())
r.Equal(0, callbacks.NumberOfTimesFailureCalled())
// Eventually it starts issuing certs using the new signing key. // Eventually it starts issuing certs using the new signing key.
var secondCertPEM, secondKeyPEM string var secondCertPEM, secondKeyPEM string
r.Eventually(func() bool { r.Eventually(func() bool {
@ -243,6 +240,9 @@ func TestCA(t *testing.T) {
return err == nil return err == nil
}, 5*time.Second, 100*time.Millisecond) }, 5*time.Second, 100*time.Millisecond)
r.Equal(2, callbacks.NumberOfTimesSuccessCalled())
r.Equal(0, callbacks.NumberOfTimesFailureCalled())
validCert2 := testutil.ValidateCertificate(t, fakeCert2PEM, secondCertPEM) validCert2 := testutil.ValidateCertificate(t, fakeCert2PEM, secondCertPEM)
validCert2.RequireDNSName("example.com") validCert2.RequireDNSName("example.com")
validCert2.RequireLifetime(time.Now(), time.Now().Add(15*time.Minute), 6*time.Minute) validCert2.RequireLifetime(time.Now(), time.Now().Add(15*time.Minute), 6*time.Minute)