mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Modify how to check the status
Signed-off-by: Ayato Tokubi <atokubi@redhat.com>
This commit is contained in:
parent
8516520fff
commit
31c7235f4c
@ -21,6 +21,7 @@ import (
|
|||||||
|
|
||||||
"github.com/onsi/ginkgo/v2"
|
"github.com/onsi/ginkgo/v2"
|
||||||
"github.com/onsi/gomega"
|
"github.com/onsi/gomega"
|
||||||
|
"github.com/onsi/gomega/gstruct"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
@ -97,14 +98,24 @@ var _ = SIGDescribe("PodRejectionStatus", func() {
|
|||||||
|
|
||||||
// This detects if there are any new fields in Status that were dropped by the pod rejection.
|
// This detects if there are any new fields in Status that were dropped by the pod rejection.
|
||||||
// These new fields either should be kept by kubelet's admission or added explicitly in the list of fields that are having a different value or must be cleared.
|
// These new fields either should be kept by kubelet's admission or added explicitly in the list of fields that are having a different value or must be cleared.
|
||||||
expectedStatus := pod.Status.DeepCopy()
|
gomega.Expect(gotPod.Status).To(gstruct.MatchAllFields(gstruct.Fields{
|
||||||
expectedStatus.Phase = gotPod.Status.Phase
|
"Phase": gstruct.Ignore(),
|
||||||
expectedStatus.Conditions = nil
|
"Conditions": gstruct.Ignore(),
|
||||||
expectedStatus.Message = gotPod.Status.Message
|
"Message": gstruct.Ignore(),
|
||||||
expectedStatus.Reason = gotPod.Status.Reason
|
"Reason": gstruct.Ignore(),
|
||||||
expectedStatus.StartTime = gotPod.Status.StartTime
|
"NominatedNodeName": gstruct.Ignore(),
|
||||||
// expectedStatus.QOSClass keep it as is
|
"HostIP": gstruct.Ignore(),
|
||||||
gomega.Expect(gotPod.Status).To(gomega.Equal(*expectedStatus))
|
"HostIPs": gstruct.Ignore(),
|
||||||
|
"PodIP": gstruct.Ignore(),
|
||||||
|
"PodIPs": gstruct.Ignore(),
|
||||||
|
"StartTime": gstruct.Ignore(),
|
||||||
|
"InitContainerStatuses": gstruct.Ignore(),
|
||||||
|
"ContainerStatuses": gstruct.Ignore(),
|
||||||
|
"QOSClass": gomega.Equal(pod.Status.QOSClass), // QOSClass should be kept
|
||||||
|
"EphemeralContainerStatuses": gstruct.Ignore(),
|
||||||
|
"Resize": gstruct.Ignore(),
|
||||||
|
"ResourceClaimStatuses": gstruct.Ignore(),
|
||||||
|
}))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user