Skip to content

Commit cffa82f

Browse files
committed
e2e: serial: config: restore previous check
We can't reliably depend on isNROOperAvailableAt because older versions (pre 4.21) don't expose the value, so all the checks will fail (observedGeneration stuck at 0). So we need to write tests carefully supporting both flows. Signed-off-by: Francesco Romani <fromani@redhat.com>
1 parent 8802e54 commit cffa82f

1 file changed

Lines changed: 21 additions & 17 deletions

File tree

test/e2e/serial/tests/configuration.go

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -235,25 +235,29 @@ var _ = Describe("[serial][disruptive] numaresources configuration management",
235235
g.Expect(isNROOperSyncedAt(&updatedOperObj.Status, status.ConditionAvailable, updatedOperObj.Generation)).To(Succeed())
236236
}).WithTimeout(10*time.Minute).WithPolling(30*time.Second).Should(Succeed(), "failed to update RTE daemonset node selector")
237237

238-
dss, err := objects.GetDaemonSetsByNamespacedName(fxt.Client, ctx, updatedOperObj.Status.DaemonSets...)
239-
Expect(err).ToNot(HaveOccurred())
238+
// Eventually is not strictly needed but till all the supported version report ObservedGeneration in status
239+
// (aka oldest supported version is 4.20) we can't really depend on `isNROOperUpToDate`
240+
Eventually(func(g Gomega) {
241+
dss, err := objects.GetDaemonSetsByNamespacedName(fxt.Client, ctx, updatedOperObj.Status.DaemonSets...)
242+
g.Expect(err).ToNot(HaveOccurred())
240243

241-
Expect(dss).To(HaveLen(len(nroOperObj.Spec.NodeGroups)), "daemonsets found owned by NRO object doesn't align with specified NodeGroups")
242-
for _, ds := range dss {
243-
e2efixture.By("check RTE daemonset %q", ds.Name)
244-
if ds.Name == objectnames.GetComponentName(updatedOperObj.Name, roleMCPTest) {
245-
By("check the correct match labels for the new RTE daemonset")
246-
Expect(ds.Spec.Template.Spec.NodeSelector).To(Equal(testMCP.Spec.NodeSelector.MatchLabels))
244+
g.Expect(dss).To(HaveLen(len(nroOperObj.Spec.NodeGroups)), "daemonsets found owned by NRO object doesn't align with specified NodeGroups")
245+
for _, ds := range dss {
246+
e2efixture.By("check RTE daemonset %q", ds.Name)
247+
if ds.Name == objectnames.GetComponentName(updatedOperObj.Name, roleMCPTest) {
248+
By("check the correct match labels for the new RTE daemonset")
249+
g.Expect(ds.Spec.Template.Spec.NodeSelector).To(Equal(testMCP.Spec.NodeSelector.MatchLabels))
250+
}
251+
By("check the correct image")
252+
cnt := ds.Spec.Template.Spec.Containers[0] // shortcut
253+
g.Expect(cnt.Image).To(Equal(serialconfig.GetRteCiImage()))
254+
255+
By("checking the correct LogLevel")
256+
found, match := matchLogLevelToKlog(&cnt, newLogLevel)
257+
g.Expect(found).To(BeTrue(), "-v flag doesn't exist in container %q args under DaemonSet: %q", cnt.Name, ds.Name)
258+
g.Expect(match).To(BeTrue(), "LogLevel %s doesn't match the existing -v flag in container: %q managed by DaemonSet: %q", updatedOperObj.Spec.LogLevel, cnt.Name, ds.Name)
247259
}
248-
By("check the correct image")
249-
cnt := ds.Spec.Template.Spec.Containers[0] // shortcut
250-
Expect(cnt.Image).To(Equal(serialconfig.GetRteCiImage()))
251-
252-
By("checking the correct LogLevel")
253-
found, match := matchLogLevelToKlog(&cnt, newLogLevel)
254-
Expect(found).To(BeTrue(), "-v flag doesn't exist in container %q args under DaemonSet: %q", cnt.Name, ds.Name)
255-
Expect(match).To(BeTrue(), "LogLevel %s doesn't match the existing -v flag in container: %q managed by DaemonSet: %q", updatedOperObj.Spec.LogLevel, cnt.Name, ds.Name)
256-
}
260+
}).WithTimeout(10*time.Minute).WithPolling(30*time.Second).Should(Succeed(), "failed to update RTE daemonset node selector")
257261
})
258262

259263
It("should converge with mixed SELinux policy across node groups", Label(label.Tier2, label.OpenShift), func(ctx context.Context) {

0 commit comments

Comments
 (0)