e2e: wait for capacity annotation update
@@ -306,15 +306,21 @@ spec:
Expect(err).ShouldNot(HaveOccurred(), "stdout=%s", stdout)
var maxCapNodes []string
+ Eventually(func() error {
var maxCapacity int
+ maxCapNodes = []string{}
for _, node := range nodes.Items {
if node.Name == "topolvm-e2e-control-plane" {
continue
}
strCap, ok := node.Annotations[topolvm.CapacityKeyPrefix+"ssd"]
- Expect(ok).To(Equal(true), "capacity is not annotated: "+node.Name)
+ if !ok {
+ return fmt.Errorf("capacity is not annotated: %s", node.Name)
+ }
capacity, err := strconv.Atoi(strCap)
- Expect(err).ShouldNot(HaveOccurred())
+ if err != nil {
+ return err
+ }
fmt.Printf("%s: %d bytes\n", node.Name, capacity)
switch {
case capacity > maxCapacity:
@@ -324,7 +330,11 @@ spec:
maxCapNodes = append(maxCapNodes, node.GetName())
}
}
- Expect(len(maxCapNodes)).To(Equal(3 - i))
+ if len(maxCapNodes) != 3-i {
+ return fmt.Errorf("unexpected number of maxCapNodes: expected: %d, actual: %d", 3-i, len(maxCapNodes))
+ }
+ return nil
+ }).Should(Succeed())
By("creating pvc")
claimYAML := fmt.Sprintf(`kind: PersistentVolumeClaim
