Skip to content

Commit

Permalink
ci: add workaround for issue #515
Browse files Browse the repository at this point in the history
Signed-off-by: Loic Devulder <[email protected]>
  • Loading branch information
ldevulder committed Sep 27, 2023
1 parent 17f6816 commit 7d4daa6
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/e2e/uninstall-operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,17 @@ import (
"github.com/rancher-sandbox/ele-testhelpers/kubectl"
"github.com/rancher-sandbox/ele-testhelpers/rancher"
"github.com/rancher-sandbox/ele-testhelpers/tools"
"github.com/rancher/elemental/tests/e2e/helpers/elemental"
)

func deleteFinalizers(ns, object, value string) {
_, err := kubectl.Run("patch", object,
"--namespace", ns, value, "--type", "merge",
"--patch", "{\"metadata\":{\"finalizers\":null}}")
Expect(err).To(Not(HaveOccurred()))

}

func testClusterAvailability(ns, cluster string) {
Eventually(func() string {
out, _ := kubectl.Run("get", "cluster",
Expand Down Expand Up @@ -84,6 +93,24 @@ var _ = Describe("E2E - Uninstall Elemental Operator", Label("uninstall-operator
}, tools.SetTimeout(3*time.Minute), 5*time.Second).Should(ContainSubstring("NotFound"))
})

By("WORKAROUND: Removing finalizers from MachineInventory", func() {
machineList, err := kubectl.Run("get", "MachineInventory",
"--namespace", clusterNS, "-o", "jsonpath={.items[*].metadata.name}")
Expect(err).To(Not(HaveOccurred()))

// Removing finalizers from MachineInventory
for _, machine := range strings.Fields(machineList) {
internalMachine, err := elemental.GetInternalMachine(clusterNS, machine)
Expect(err).To(Not(HaveOccurred()))

// Delete blocking Finalizers
GinkgoWriter.Printf("Deleting MachineInventory '%s'...\n", machine)
deleteFinalizers(clusterNS, "MachineInventory", machine)
GinkgoWriter.Printf("Deleting Machine '%s'...\n", internalMachine)
deleteFinalizers(clusterNS, "Machine", internalMachine)
}
})

By("Deleting cluster resource", func() {
Eventually(func() error {
_, err := kubectl.Run("delete", "cluster",
Expand Down

0 comments on commit 7d4daa6

Please sign in to comment.