Merge pull request #104799 from RyanAoh/cronjob_dev
fix the error when cleaning up finished jobs for cronjob
This commit is contained in:
@@ -26,6 +26,7 @@ import (
|
||||
batchv1 "k8s.io/api/batch/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/client-go/informers"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
@@ -153,6 +154,14 @@ func TestCronJobLaunchesPodAndCleansUp(t *testing.T) {
|
||||
ns := framework.CreateTestingNamespace(namespaceName, server, t)
|
||||
defer framework.DeleteTestingNamespace(ns, server, t)
|
||||
|
||||
backupHandlers := runtime.ErrorHandlers
|
||||
runtime.ErrorHandlers = append(runtime.ErrorHandlers, func(e error) {
|
||||
t.Fatalf("Failed with error: %v", e)
|
||||
})
|
||||
defer func() {
|
||||
runtime.ErrorHandlers = backupHandlers
|
||||
}()
|
||||
|
||||
cjClient := clientSet.BatchV1().CronJobs(ns.Name)
|
||||
|
||||
stopCh := make(chan struct{})
|
||||
|
||||
Reference in New Issue
Block a user