From 51457217af68635e8a4f9dd5175a525573f17766 Mon Sep 17 00:00:00 2001 From: Steven Fairchild Date: Mon, 24 Jul 2023 09:54:28 -0400 Subject: [PATCH] Update e2e operator test The e2e test was dependant on the operator flag being enabled by defualt. Now the test will set the operator flag to true temporarily, run the test, and reset to it's original value. --- test/e2e/operator.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/e2e/operator.go b/test/e2e/operator.go index 274d907b2f5..6c289f8ae30 100644 --- a/test/e2e/operator.go +++ b/test/e2e/operator.go @@ -562,6 +562,21 @@ var _ = Describe("ARO Operator - dnsmasq", func() { return names } + // test regardless of the operator flag setting, then set back to original value after tests + enableOperatorFlag := func(g Gomega, ctx context.Context) func(context.Context) { + co, err := clients.AROClusters.AroV1alpha1().Clusters().Get(ctx, "cluster", metav1.GetOptions{}) + if kerrors.IsNotFound(err) { + Skip("skipping tests as aro-operator is not deployed") + } + + originalFlag := co.Spec.OperatorFlags["aro.dnsmasq.enabled"] + co.Spec.OperatorFlags["aro.dnsmasq.enabled"] = "true" + + return func(ctx context.Context) { + co.Spec.OperatorFlags["aro.dnsmasq.enabled"] = originalFlag + } + } + BeforeEach(func(ctx context.Context) { By("Create custom MachineConfigPool") _, err := clients.MachineConfig.MachineconfigurationV1().MachineConfigPools().Create(ctx, &customMcp, metav1.CreateOptions{}) @@ -571,6 +586,8 @@ var _ = Describe("ARO Operator - dnsmasq", func() { It("must handle the lifetime of the `99-${MCP}-custom-dns MachineConfig for every MachineConfigPool ${MCP}", func(ctx context.Context) { By("creating an ARO DNS MachineConfig when creating a custom MachineConfigPool") Eventually(func(g Gomega, ctx context.Context) { + resetFlag := enableOperatorFlag(g, ctx) + defer resetFlag(ctx) machineConfigs := getMachineConfigNames(g, ctx) g.Expect(machineConfigs).To(ContainElement(mcName))