mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
add DirectCodec; use it in release_1_3 clientset
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
"k8s.io/kubernetes/pkg/labels"
|
||||
"k8s.io/kubernetes/pkg/runtime"
|
||||
"k8s.io/kubernetes/pkg/util"
|
||||
"k8s.io/kubernetes/pkg/util/intstr"
|
||||
"k8s.io/kubernetes/pkg/watch"
|
||||
@@ -74,7 +75,7 @@ func observePodCreation(w watch.Interface) {
|
||||
}
|
||||
}
|
||||
|
||||
func observePodDeletion(w watch.Interface) (lastPod *api.Pod) {
|
||||
func observeObjectDeletion(w watch.Interface) (obj runtime.Object) {
|
||||
deleted := false
|
||||
timeout := false
|
||||
timer := time.After(60 * time.Second)
|
||||
@@ -82,7 +83,7 @@ func observePodDeletion(w watch.Interface) (lastPod *api.Pod) {
|
||||
select {
|
||||
case event, _ := <-w.ResultChan():
|
||||
if event.Type == watch.Deleted {
|
||||
lastPod = event.Object.(*api.Pod)
|
||||
obj = event.Object
|
||||
deleted = true
|
||||
}
|
||||
case <-timer:
|
||||
@@ -155,7 +156,8 @@ var _ = framework.KubeDescribe("Generated release_1_2 clientset", func() {
|
||||
}
|
||||
|
||||
By("verifying pod deletion was observed")
|
||||
lastPod := observePodDeletion(w)
|
||||
obj := observeObjectDeletion(w)
|
||||
lastPod := obj.(*api.Pod)
|
||||
Expect(lastPod.DeletionTimestamp).ToNot(BeNil())
|
||||
Expect(lastPod.Spec.TerminationGracePeriodSeconds).ToNot(BeZero())
|
||||
|
||||
@@ -228,7 +230,8 @@ var _ = framework.KubeDescribe("Generated release_1_3 clientset", func() {
|
||||
}
|
||||
|
||||
By("verifying pod deletion was observed")
|
||||
lastPod := observePodDeletion(w)
|
||||
obj := observeObjectDeletion(w)
|
||||
lastPod := obj.(*v1.Pod)
|
||||
Expect(lastPod.DeletionTimestamp).ToNot(BeNil())
|
||||
Expect(lastPod.Spec.TerminationGracePeriodSeconds).ToNot(BeZero())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user