mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 10:43:56 +00:00
fix: minor lint issues and redundant check
This commit is contained in:
parent
056b25dfca
commit
2ccf7e8e49
@ -20,7 +20,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"k8s.io/utils/ptr"
|
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -59,6 +58,7 @@ import (
|
|||||||
"k8s.io/kubernetes/test/integration/framework"
|
"k8s.io/kubernetes/test/integration/framework"
|
||||||
"k8s.io/kubernetes/test/integration/util"
|
"k8s.io/kubernetes/test/integration/util"
|
||||||
"k8s.io/utils/pointer"
|
"k8s.io/utils/pointer"
|
||||||
|
"k8s.io/utils/ptr"
|
||||||
)
|
)
|
||||||
|
|
||||||
const waitInterval = time.Second
|
const waitInterval = time.Second
|
||||||
@ -3007,14 +3007,14 @@ func updateJob(ctx context.Context, jobClient typedv1.JobInterface, jobName stri
|
|||||||
|
|
||||||
func addFinalizerAndDeletePods(ctx context.Context, t *testing.T, clientSet clientset.Interface, namespace string) {
|
func addFinalizerAndDeletePods(ctx context.Context, t *testing.T, clientSet clientset.Interface, namespace string) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
pods, errList := clientSet.CoreV1().Pods(namespace).List(ctx, metav1.ListOptions{})
|
pods, err := clientSet.CoreV1().Pods(namespace).List(ctx, metav1.ListOptions{})
|
||||||
if errList != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to list pods: %v", errList)
|
t.Fatalf("Failed to list pods: %v", err)
|
||||||
}
|
}
|
||||||
updatePod(t, clientSet, pods.Items, func(pod *v1.Pod) {
|
updatePod(t, clientSet, pods.Items, func(pod *v1.Pod) {
|
||||||
pod.Finalizers = append(pod.Finalizers, "fake.example.com/blockDeletion")
|
pod.Finalizers = append(pod.Finalizers, "fake.example.com/blockDeletion")
|
||||||
})
|
})
|
||||||
err := clientSet.CoreV1().Pods(namespace).DeleteCollection(ctx,
|
err = clientSet.CoreV1().Pods(namespace).DeleteCollection(ctx,
|
||||||
metav1.DeleteOptions{},
|
metav1.DeleteOptions{},
|
||||||
metav1.ListOptions{
|
metav1.ListOptions{
|
||||||
Limit: 1000,
|
Limit: 1000,
|
||||||
@ -3022,14 +3022,8 @@ func addFinalizerAndDeletePods(ctx context.Context, t *testing.T, clientSet clie
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to cleanup Pods: %v", err)
|
t.Fatalf("Failed to cleanup Pods: %v", err)
|
||||||
}
|
}
|
||||||
|
_, err = clientSet.CoreV1().Pods(namespace).List(ctx, metav1.ListOptions{})
|
||||||
podsDelete, errList2 := clientSet.CoreV1().Pods(namespace).List(ctx, metav1.ListOptions{})
|
if err != nil {
|
||||||
if errList2 != nil {
|
t.Fatalf("Failed to list pods: %v", err)
|
||||||
t.Fatalf("Failed to list pods: %v", errList2)
|
|
||||||
}
|
|
||||||
for _, val := range podsDelete.Items {
|
|
||||||
if val.DeletionTimestamp == nil {
|
|
||||||
t.Fatalf("Deletion not registered.")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user