MCPcopy
hub / github.com/kubernetes/kubernetes / TestUpdatePod

Function TestUpdatePod

pkg/scheduler/eventhandlers_test.go:885–1035  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

883}
884
885func TestUpdatePod(t *testing.T) {
886 pod := st.MakePod().Name("pod1").Namespace("ns1").UID("pod1").SchedulerName("supported-scheduler").Obj()
887 updatedPod := st.MakePod().Name("pod1").Namespace("ns1").UID("pod1").Labels(map[string]string{"foo": "bar"}).ResourceVersion("2").SchedulerName("supported-scheduler").Obj()
888
889 podWithDeletionTimestamp := st.MakePod().Name("pod1").Namespace("ns1").UID("pod1").Terminating().ResourceVersion("2").SchedulerName("supported-scheduler").Obj()
890
891 otherPod := st.MakePod().Name("pod1").Namespace("ns1").UID("pod1").SchedulerName("other-scheduler").Obj()
892 updatedOtherPod := st.MakePod().Name("pod1").Namespace("ns1").UID("pod1").Labels(map[string]string{"foo": "bar"}).ResourceVersion("2").SchedulerName("other-scheduler").Obj()
893
894 scheduledPod := st.MakePod().Name("pod1").Namespace("ns1").UID("pod1").Node("node1").SchedulerName("supported-scheduler").Obj()
895 updatedScheduledPod := st.MakePod().Name("pod1").Namespace("ns1").UID("pod1").Labels(map[string]string{"foo": "bar"}).ResourceVersion("2").Node("node1").SchedulerName("supported-scheduler").Obj()
896
897 otherScheduledPod := st.MakePod().Name("pod1").Namespace("ns1").UID("pod1").Node("node1").SchedulerName("other-scheduler").Obj()
898 updatedOtherScheduledPod := st.MakePod().Name("pod1").Namespace("ns1").UID("pod1").Labels(map[string]string{"foo": "bar"}).ResourceVersion("2").Node("node1").SchedulerName("other-scheduler").Obj()
899
900 scheduledPodOtherNode := st.MakePod().Name("pod1").Namespace("ns1").UID("pod1").Node("node2").SchedulerName("supported-scheduler").Obj()
901
902 tests := []struct {
903 name string
904 oldPod *v1.Pod
905 assumedPod *v1.Pod
906 newPod *v1.Pod
907 expectInQueue *v1.Pod
908 expectInCache *v1.Pod
909 }{
910 {
911 name: "update unscheduled pod",
912 oldPod: pod,
913 newPod: updatedPod,
914 expectInQueue: updatedPod,
915 },
916 {
917 name: "update unscheduled pod with other scheduler name",
918 oldPod: otherPod,
919 newPod: updatedOtherPod,
920 },
921 {
922 name: "update assumed pod",
923 oldPod: pod,
924 assumedPod: scheduledPod,
925 newPod: updatedPod,
926 expectInCache: scheduledPod,
927 },
928 {
929 name: "update scheduled pod",
930 oldPod: scheduledPod,
931 newPod: updatedScheduledPod,
932 expectInCache: updatedScheduledPod,
933 },
934 {
935 name: "update scheduled pod with other scheduler name",
936 oldPod: otherScheduledPod,
937 newPod: updatedOtherScheduledPod,
938 expectInCache: updatedOtherScheduledPod,
939 },
940 {
941 name: "bind unscheduled pod",
942 oldPod: pod,

Callers

nothing calls this directly

Calls 15

addPodMethod · 0.95
updatePodMethod · 0.95
WithCancelMethod · 0.80
DiffMethod · 0.80
ObjMethod · 0.65
SchedulerNameMethod · 0.65
UIDMethod · 0.65
NamespaceMethod · 0.65
NameMethod · 0.65
ResourceVersionMethod · 0.65
LabelsMethod · 0.65
NodeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…