DRA: wait for stats to converge in "creates slices" e2e test

This commit is contained in:
Jon Huhn
2025-08-15 01:00:40 -05:00
parent 9da4b7ecfb
commit bf6c86b562

View File

@@ -2167,6 +2167,14 @@ var _ = framework.SIGDescribe("node")(framework.WithLabel("DRA"), func() {
emptySlice := gomega.HaveField("Spec.Devices", gomega.BeEmpty())
gomega.Eventually(ctx, listSlices).WithTimeout(2 * time.Minute).Should(gomega.HaveField("Items", gomega.HaveExactElements(emptySlice)))
expectStats = resourceslice.Stats{NumCreates: int64(numSlices) + 1, NumDeletes: int64(numSlices)}
// There is a window of time where the ResourceSlice exists and is
// returned in a list but before that ResourceSlice is accounted for
// in the controller's stats, consisting mostly of network latency
// between this test process and the API server. Wait for the stats
// to converge before asserting there are no further changes.
gomega.Eventually(ctx, controller.GetStats).WithTimeout(30 * time.Second).Should(gomega.Equal(expectStats))
gomega.Consistently(ctx, controller.GetStats).WithTimeout(2 * mutationCacheTTL).Should(gomega.Equal(expectStats))
})
})