Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Loic Devulder <ldevulder@suse.com>
  • Loading branch information
ldevulder committed Mar 23, 2023
1 parent 9867b28 commit ecc9db6
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/master-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ jobs:
if: inputs.test_type == 'cli'
run: sudo virsh list
- name: Uninstall Elemental Operator
if: inputs.test_type == 'cli'
# Don't test Operator uninstall if we want to keep the runner for debugging purposes
if: inputs.destroy_runner == true && inputs.test_type == 'cli'
run: cd tests && make e2e-uninstall-operator
- name: Store logs
if: always()
Expand Down
22 changes: 22 additions & 0 deletions tests/assets/dumb_machineRegistration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: elemental.cattle.io/v1beta1
kind: MachineRegistration
metadata:
name: dumb-machine-registration
# The namespace must match the namespace of the cluster
# assigned to the clusters.provisioning.cattle.io resource
# namespace: fleet-default
spec:
# Labels to be added to the created MachineInventory object
machineInventoryLabels:
dumb-label: dumb-value
# Annotations to be added to the created MachineInventory object
machineInventoryAnnotations: {}
# The config that will be used to provision the node
config:
cloud-config:
users:
- name: root
passwd: dumb-password
elemental:
install:
device: /dev/dumb-device
1 change: 1 addition & 0 deletions tests/e2e/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const (
emulateTPMYaml = "../assets/emulateTPM.yaml"
ciTokenYaml = "../assets/local-kubeconfig-token-skel.yaml"
configPrivateCAScript = "../scripts/config-private-ca"
dumbRegistrationYaml = "../assets/dumb_machineRegistration.yaml"
installConfigYaml = "../../install-config.yaml"
installHardenedScript = "../scripts/config-hardened"
installVMScript = "../scripts/install-vm"
Expand Down
26 changes: 20 additions & 6 deletions tests/e2e/uninstall-operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var _ = Describe("E2E - Uninstall Elemental Operator", Label("uninstall-operator
}

It("Uninstall Elemental Operator", func() {
By("Testing cluster availability BEFORE operator uninstallation", func() {
By("Testing cluster resource availability BEFORE operator uninstallation", func() {
testClusterAvailability(clusterNS, clusterName)
})

Expand All @@ -54,17 +54,26 @@ var _ = Describe("E2E - Uninstall Elemental Operator", Label("uninstall-operator
Expect(err).To(Not(HaveOccurred()))
})

By("Testing cluster availability AFTER operator uninstallation", func() {
By("Testing cluster resource availability AFTER operator uninstallation", func() {
testClusterAvailability(clusterNS, clusterName)
})

By("Deleting cluster", func() {
By("Checking that Elemental resources are gone", func() {
Eventually(func() string {
out, _ := kubectl.Run("get", "MachineInventorySelectorTemplate",
"--namespace", clusterNS,
"-o", "jsonpath={.items[*].metadata.name}")
return out
}, misc.SetTimeout(3*time.Minute), 5*time.Second).Should(BeNil())
})

By("Deleting cluster resource", func() {
_, err := kubectl.Run("delete", "cluster",
"--namespace", clusterNS, clusterName)
Expect(err).To(Not(HaveOccurred()))
})

By("Testing cluster unavailability", func() {
By("Testing cluster resource unavailability", func() {
out, err := kubectl.Run("get", "cluster",
"--namespace", clusterNS, clusterName,
"-o", "jsonpath={.metadata.name}")
Expand Down Expand Up @@ -92,13 +101,18 @@ var _ = Describe("E2E - Uninstall Elemental Operator", Label("uninstall-operator
GinkgoWriter.Printf("Operator Image:\n%s\n", operatorImage)
})

By("Re-creating the cluster", func() {
By("Creating a dumb MachineRegistration", func() {
err := kubectl.Apply(clusterNS, dumbRegistrationYaml)
Expect(err).To(Not(HaveOccurred()))
})

By("Creating cluster", func() {
// NOTE: we can re-use clusterYaml as it has already been configured correctly
err := kubectl.Apply(clusterNS, clusterYaml)
Expect(err).To(Not(HaveOccurred()))
})

By("Testing cluster availability", func() {
By("Testing cluster resource availability", func() {
testClusterAvailability(clusterNS, clusterName)
})
})
Expand Down

0 comments on commit ecc9db6

Please sign in to comment.