Skip to content

Commit 463ce24

Browse files
test: verify HPA self-healing restores resources with a new UID in AgentDeployment controller tests
1 parent 9551a5e commit 463ce24

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

internal/controller/agentdeployment_controller_test.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -823,15 +823,19 @@ var _ = Describe("AgentDeployment HPA lifecycle", func() {
823823
Eventually(func() error {
824824
return k8sClient.Get(ctx, key, hpa)
825825
}, testTimeout, testInterval).Should(Succeed(), "HPA should appear initially")
826+
origUID := hpa.UID
826827

827828
// Delete the HPA out-of-band.
828829
Expect(k8sClient.Delete(ctx, hpa)).To(Succeed())
829830

830-
// The reconciler should restore it within one reconcile interval.
831+
// The reconciler should restore it within one reconcile interval with a new UID.
831832
recreated := &autoscalingv2.HorizontalPodAutoscaler{}
832-
Eventually(func() error {
833-
return k8sClient.Get(ctx, key, recreated)
834-
}, testTimeout, testInterval).Should(Succeed(), "HPA should be self-healed")
833+
Eventually(func() bool {
834+
if err := k8sClient.Get(ctx, key, recreated); err != nil {
835+
return false
836+
}
837+
return recreated.UID != origUID
838+
}, testTimeout, testInterval).Should(BeTrue(), "HPA should be self-healed with a new UID")
835839

836840
ad := &agentraxv1alpha1.AgentDeployment{}
837841
Expect(k8sClient.Get(ctx, key, ad)).To(Succeed())

0 commit comments

Comments
 (0)