mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-05-28 04:04:39 -04:00
cronjob: add ut for namespace terminating cause no extra log
This commit is contained in:
parent
a890724f9e
commit
ade63dd764
1 changed files with 21 additions and 0 deletions
|
|
@ -18,6 +18,7 @@ package cronjob
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
|
|
@ -1165,6 +1166,26 @@ func TestControllerV2SyncCronJob(t *testing.T) {
|
|||
expectUpdateStatus: true,
|
||||
jobPresentInCJActiveStatus: true,
|
||||
},
|
||||
"do nothing if the namespace is terminating": {
|
||||
jobCreateError: &errors.StatusError{ErrStatus: metav1.Status{Details: &metav1.StatusDetails{Causes: []metav1.StatusCause{
|
||||
{
|
||||
Type: v1.NamespaceTerminatingCause,
|
||||
Message: fmt.Sprintf("namespace %s is being terminated", metav1.NamespaceDefault),
|
||||
Field: "metadata.namespace",
|
||||
}}}}},
|
||||
concurrencyPolicy: "Allow",
|
||||
schedule: onTheHour,
|
||||
deadline: noDead,
|
||||
ranPreviously: true,
|
||||
stillActive: true,
|
||||
jobCreationTime: justAfterThePriorHour(),
|
||||
now: *justAfterTheHour(),
|
||||
expectActive: 0,
|
||||
expectRequeueAfter: false,
|
||||
expectUpdateStatus: false,
|
||||
expectErr: true,
|
||||
jobPresentInCJActiveStatus: false,
|
||||
},
|
||||
}
|
||||
for name, tc := range testCases {
|
||||
name := name
|
||||
|
|
|
|||
Loading…
Reference in a new issue