Skip to content

Commit 4f4fac5

Browse files
committed
fix(test): added controller restart to load limiter config
1 parent 23c2dc2 commit 4f4fac5

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

test/e2e-saturation-based/e2e_limiter_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,31 @@ enableLimiter: true`
135135
_, err = k8sClient.CoreV1().ConfigMaps(controllerNamespace).Update(ctx, cm, metav1.UpdateOptions{})
136136
Expect(err).NotTo(HaveOccurred(), "Should be able to update saturation ConfigMap to enable limiter")
137137

138+
By("restarting controller-manager pods to load limiter configuration")
139+
podList, err := k8sClient.CoreV1().Pods(controllerNamespace).List(ctx, metav1.ListOptions{
140+
LabelSelector: "app.kubernetes.io/name=workload-variant-autoscaler",
141+
})
142+
Expect(err).NotTo(HaveOccurred(), "Should be able to list manager pods")
143+
144+
for _, pod := range podList.Items {
145+
err = k8sClient.CoreV1().Pods(controllerNamespace).Delete(ctx, pod.Name, metav1.DeleteOptions{})
146+
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("Should be able to delete pod %s", pod.Name))
147+
}
148+
149+
// Wait for new controller pods to be running
150+
Eventually(func(g Gomega) {
151+
newPodList, err := k8sClient.CoreV1().Pods(controllerNamespace).List(ctx, metav1.ListOptions{
152+
LabelSelector: "app.kubernetes.io/name=workload-variant-autoscaler",
153+
})
154+
g.Expect(err).NotTo(HaveOccurred(), "Should be able to list manager pods")
155+
g.Expect(newPodList.Items).NotTo(BeEmpty(), "Pod list should not be empty")
156+
for _, pod := range newPodList.Items {
157+
g.Expect(pod.Status.Phase).To(Equal(corev1.PodRunning), fmt.Sprintf("Pod %s is not running", pod.Name))
158+
}
159+
}, 2*time.Minute, 1*time.Second).Should(Succeed())
160+
161+
_, _ = fmt.Fprintf(GinkgoWriter, "Controller pods restarted with limiter enabled\n")
162+
138163
By("ensuring unique app label for deployment")
139164
utils.ValidateAppLabelUniqueness(namespace, appLabel, k8sClient, crClient)
140165

0 commit comments

Comments
 (0)