(t *testing.T)
| 883 | } |
| 884 | |
| 885 | func 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, |
nothing calls this directly
no test coverage detected
searching dependent graphs…