Skip to content

Commit

Permalink
test: deflake by waiting for healthy pods
Browse files Browse the repository at this point in the history
  • Loading branch information
tallaxes committed Jan 16, 2025
1 parent f6d20e0 commit deaa7ae
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/suites/drift/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,11 +580,13 @@ var _ = Describe("Drift", func() {
},
},
})
selector = labels.SelectorFromSet(dep.Spec.Selector.MatchLabels)
env.ExpectCreated(dep, nodeClass, nodePool)

By("deploying multiple replicas, pod per node")
startingNodeClaimState := env.EventuallyExpectCreatedNodeClaimCount("==", int(numPods))
env.EventuallyExpectCreatedNodeCount("==", int(numPods))
env.EventuallyExpectHealthyPodCount(selector, int(numPods))

By("drifting the nodeClaim with bad configuration that never registers")
nodeClass.Spec.VNETSubnetID = lo.ToPtr("/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/sillygeese/providers/Microsoft.Network/virtualNetworks/karpenter/subnets/nodeclassSubnet2")
Expand Down Expand Up @@ -626,11 +628,13 @@ var _ = Describe("Drift", func() {
},
},
})
selector = labels.SelectorFromSet(dep.Spec.Selector.MatchLabels)
env.ExpectCreated(dep, nodeClass, nodePool)

By("deploying multiple replicas, pod per node")
startingNodeClaimState := env.EventuallyExpectCreatedNodeClaimCount("==", int(numPods))
env.EventuallyExpectCreatedNodeCount("==", int(numPods))
env.EventuallyExpectHealthyPodCount(selector, int(numPods))

By("drifting the nodeClaim with bad configuration that never initializes")
nodePool.Spec.Template.Spec.StartupTaints = []corev1.Taint{{Key: "example.com/taint", Effect: corev1.TaintEffectPreferNoSchedule}}
Expand Down

0 comments on commit deaa7ae

Please sign in to comment.