Merge pull request #46731 from rmmh/test-only-once

Automatic merge from submit-queue

Don't rerun certificate manager tests 1000 times.

**What this PR does / why we need it**:
Running every testcase 1000 times needlessly bloats the logs.

**Release note**:
```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2017-06-19 17:13:06 -07:00 committed by GitHub
commit cfdbc9c028

View File

@ -202,7 +202,6 @@ func TestSetRotationDeadline(t *testing.T) {
}
for _, tc := range testCases {
for i := 0; i < 1000; i++ {
t.Run(tc.name, func(t *testing.T) {
m := manager{
cert: &tls.Certificate{
@ -214,9 +213,11 @@ func TestSetRotationDeadline(t *testing.T) {
template: &x509.CertificateRequest{},
usages: []certificates.KeyUsage{},
}
m.setRotationDeadline()
lowerBound := tc.notBefore.Add(time.Duration(float64(tc.notAfter.Sub(tc.notBefore)) * 0.7))
upperBound := tc.notBefore.Add(time.Duration(float64(tc.notAfter.Sub(tc.notBefore)) * 0.9))
for i := 0; i < 1000; i++ {
// setRotationDeadline includes jitter, so this needs to run many times for validation.
m.setRotationDeadline()
if m.rotationDeadline.Before(lowerBound) || m.rotationDeadline.After(upperBound) {
t.Errorf("For notBefore %v, notAfter %v, the rotationDeadline %v should be between %v and %v.",
tc.notBefore,
@ -225,8 +226,8 @@ func TestSetRotationDeadline(t *testing.T) {
lowerBound,
upperBound)
}
})
}
})
}
}