@@ -43,9 +43,48 @@ func TestUpdateDatastore_EndpointSliceReconciler(t *testing.T) {
43
43
"some-key" : "some-val" ,
44
44
},
45
45
},
46
+ Status : corev1.PodStatus {
47
+ Conditions : []corev1.PodCondition {
48
+ {
49
+ Type : corev1 .PodReady ,
50
+ Status : corev1 .ConditionTrue ,
51
+ },
52
+ },
53
+ },
46
54
},
47
55
wantPods : []string {basePod1 .Name , basePod2 .Name , basePod3 .Name },
48
56
},
57
+ {
58
+ name : "New pod, not ready, valid selector" ,
59
+ datastore : & K8sDatastore {
60
+ pods : populateMap (basePod1 , basePod2 ),
61
+ inferencePool : & v1alpha1.InferencePool {
62
+ Spec : v1alpha1.InferencePoolSpec {
63
+ TargetPortNumber : int32 (8000 ),
64
+ Selector : map [v1alpha1.LabelKey ]v1alpha1.LabelValue {
65
+ "some-key" : "some-val" ,
66
+ },
67
+ },
68
+ },
69
+ },
70
+ incomingPod : & corev1.Pod {
71
+ ObjectMeta : metav1.ObjectMeta {
72
+ Name : "pod3" ,
73
+ Labels : map [string ]string {
74
+ "some-key" : "some-val" ,
75
+ },
76
+ },
77
+ Status : corev1.PodStatus {
78
+ Conditions : []corev1.PodCondition {
79
+ {
80
+ Type : corev1 .PodReady ,
81
+ Status : corev1 .ConditionFalse ,
82
+ },
83
+ },
84
+ },
85
+ },
86
+ wantPods : []string {basePod1 .Name , basePod2 .Name },
87
+ },
49
88
{
50
89
name : "Remove pod that does not match selector" ,
51
90
datastore : & K8sDatastore {
@@ -66,6 +105,45 @@ func TestUpdateDatastore_EndpointSliceReconciler(t *testing.T) {
66
105
"some-wrong-key" : "some-val" ,
67
106
},
68
107
},
108
+ Status : corev1.PodStatus {
109
+ Conditions : []corev1.PodCondition {
110
+ {
111
+ Type : corev1 .PodReady ,
112
+ Status : corev1 .ConditionTrue ,
113
+ },
114
+ },
115
+ },
116
+ },
117
+ wantPods : []string {basePod2 .Name },
118
+ },
119
+ {
120
+ name : "Remove pod that is not ready" ,
121
+ datastore : & K8sDatastore {
122
+ pods : populateMap (basePod1 , basePod2 ),
123
+ inferencePool : & v1alpha1.InferencePool {
124
+ Spec : v1alpha1.InferencePoolSpec {
125
+ TargetPortNumber : int32 (8000 ),
126
+ Selector : map [v1alpha1.LabelKey ]v1alpha1.LabelValue {
127
+ "some-key" : "some-val" ,
128
+ },
129
+ },
130
+ },
131
+ },
132
+ incomingPod : & corev1.Pod {
133
+ ObjectMeta : metav1.ObjectMeta {
134
+ Name : "pod1" ,
135
+ Labels : map [string ]string {
136
+ "some-wrong-key" : "some-val" ,
137
+ },
138
+ },
139
+ Status : corev1.PodStatus {
140
+ Conditions : []corev1.PodCondition {
141
+ {
142
+ Type : corev1 .PodReady ,
143
+ Status : corev1 .ConditionFalse ,
144
+ },
145
+ },
146
+ },
69
147
},
70
148
wantPods : []string {basePod2 .Name },
71
149
},
0 commit comments