mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-11 21:12:07 +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 (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
@ -1165,6 +1166,26 @@ func TestControllerV2SyncCronJob(t *testing.T) {
|
|||||||
expectUpdateStatus: true,
|
expectUpdateStatus: true,
|
||||||
jobPresentInCJActiveStatus: 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 {
|
for name, tc := range testCases {
|
||||||
name := name
|
name := name
|
||||||
|
Loading…
Reference in New Issue
Block a user