mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 20:42:26 +00:00
cronjob: add ut for namespace terminating cause no extra log
This commit is contained in:
parent
a890724f9e
commit
ade63dd764
@ -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 New Issue
Block a user