diff --git a/docs/e2e-test.md b/docs/e2e-test.md index 4dfe139241..c3930addf1 100644 --- a/docs/e2e-test.md +++ b/docs/e2e-test.md @@ -60,7 +60,6 @@ The e2e tests currently include three different sets: 1. Remediation based feature tests 1. clusterctl upgrade tests 1. K8s upgrade tests -1. Live ISO test ### Pivoting based feature tests @@ -136,11 +135,6 @@ Release 1.5 branch k8s-upgrade test: When Kubernetes 1.31 is released, k8s-upgrade `v1.30` => `v1.31` will be supported in v1.7.x (but not in v1.6.x) -### Live ISO test - -Independent from the previous tests and can run independently. -This is testing the booting of target cluster's nodes with the live ISO. - ## Guidelines to follow when adding new E2E tests - Tests should be defined in a new file and separate test spec, unless the new @@ -153,7 +147,6 @@ This is testing the booting of target cluster's nodes with the live ISO. - `[clusterctl-upgrade]` => runs only existing upgrade tests including CAPI, CAPM3, Ironic and Baremetal Operator. - `[remediation]` => runs only remediation and inspection tests. - - `[live-iso]` => runs only live ISO test. - `[k8s-upgrade]` => runs only k8s upgrade tests. For instance, to skip the upgrade E2E tests set `GINKGO_SKIP="[upgrade]"` diff --git a/scripts/ci-e2e.sh b/scripts/ci-e2e.sh index f0ab15963c..4d30bc0ff0 100755 --- a/scripts/ci-e2e.sh +++ b/scripts/ci-e2e.sh @@ -66,9 +66,6 @@ source "${M3_DEV_ENV_PATH}/lib/ironic_basic_auth.sh" # shellcheck disable=SC1091,SC1090 source "${M3_DEV_ENV_PATH}/lib/ironic_tls_setup.sh" -# image for live iso testing -export LIVE_ISO_IMAGE="https://artifactory.nordix.org/artifactory/metal3/images/iso/minimal_linux_live-v2.iso" - # Generate credentials BMO_OVERLAYS=( "${REPO_ROOT}/test/e2e/data/bmo-deployment/overlays/release-0.4" diff --git a/test/e2e/live_iso_test.go b/test/e2e/live_iso_test.go deleted file mode 100644 index 949b4a0cf3..0000000000 --- a/test/e2e/live_iso_test.go +++ /dev/null @@ -1,130 +0,0 @@ -package e2e - -import ( - "fmt" - "os" - "os/exec" - "path/filepath" - "strings" - - bmov1alpha1 "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - "k8s.io/utils/ptr" - "sigs.k8s.io/controller-runtime/pkg/client" -) - -/* - * The purpose of the live-iso feature in Metal3 is to allow booting a BareMetalHost with a live ISO image instead of deploying an image to the local disk using the IPA deploy ramdisk. This feature is useful in scenarios where reducing boot time for ephemeral workloads is desired, or when integrating with third-party installers distributed as a CD image. - * - * This test demonstrates the usage of the live-iso feature. It performs the following steps: - * - * The live ISO image URL is retrieved from the test configuration. - * The list of bare metal hosts (BMHs) in the namespace is displayed. - * It waits for all BMHs to be in the "Available" state. - * It retrieves all BMHs and selects the first available BMH that supports the "redfish-virtualmedia" mechanism for provisioning the live image. - * The selected BMH is updated with the live ISO image URL and marked as online. - * It waits for the BMH to transition to the "Provisioned" state, indicating successful booting from the live ISO image. - * The list of BMHs in the namespace is displayed. - * Serial logs are read to verify that the node was booted from the live ISO image. - * The test is considered passed. - */ - -var _ = Describe("When testing live iso [live-iso] [features]", Label("live-iso", "features"), func() { - liveIsoTest() -}) - -// Live iso tests provision live-iso image on host -// it lists all the bmh and selects the one supporting redfish-virtualmedia for provisioning the live image. -func liveIsoTest() { - BeforeEach(func() { - validateGlobals(specName) - // We need to override clusterctl apply log folder to avoid getting our credentials exposed. - clusterctlLogFolder = filepath.Join(os.TempDir(), "clusters", bootstrapClusterProxy.GetName()) - }) - It("Should update the BMH with live ISO", func() { - liveISOImageURL := e2eConfig.GetVariable("LIVE_ISO_IMAGE") - Logf("Starting live ISO test") - bootstrapClient := bootstrapClusterProxy.GetClient() - ListBareMetalHosts(ctx, bootstrapClient, client.InNamespace(namespace)) - - WaitForNumBmhInState(ctx, bmov1alpha1.StateAvailable, WaitForNumInput{ - Client: bootstrapClient, - Options: []client.ListOption{client.InNamespace(namespace)}, - Replicas: numberOfAllBmh, - Intervals: e2eConfig.GetIntervals(specName, "wait-bmh-available"), - }) - - bmhs, err := GetAllBmhs(ctx, bootstrapClient, namespace) - Expect(err).NotTo(HaveOccurred(), "Error getting BMHs") - var isoBmh bmov1alpha1.BareMetalHost - for _, bmh := range bmhs { - Logf("Checking BMH %s", bmh.Name) - // Pick the first BMH that is available and uses redfish-virtualmedia (ipmi and redfish does not support live-iso) - if bmh.Status.Provisioning.State == bmov1alpha1.StateAvailable && - strings.HasPrefix(bmh.Spec.BMC.Address, "redfish-virtualmedia") { - isoBmh = bmh - Logf("BMH %s is in %s state", bmh.Name, bmh.Status.Provisioning.State) - break - } - } - - isoBmh.Spec.Online = true - isoBmh.Spec.Image = &bmov1alpha1.Image{ - URL: liveISOImageURL, - Checksum: "", - ChecksumType: "", - DiskFormat: ptr.To("live-iso"), - } - Expect(bootstrapClient.Update(ctx, &isoBmh)).NotTo(HaveOccurred()) - isoBmhName := isoBmh.Name - - By("Waiting for live ISO image booted host to be in provisioned state") - Eventually(func(g Gomega) { - g.Expect(bootstrapClient.Get(ctx, client.ObjectKey{Namespace: namespace, Name: isoBmhName}, &isoBmh)).To(Succeed()) - g.Expect(isoBmh.Status.Provisioning.State).To(Equal(bmov1alpha1.StateProvisioned), fmt.Sprintf("BMH %s is not in provisioned state", isoBmh.Name)) - Logf("BMH %s is in %s state", isoBmh.Name, isoBmh.Status.Provisioning.State) - }, e2eConfig.GetIntervals(specName, "wait-bmh-provisioned")...).Should(Succeed()) - ListBareMetalHosts(ctx, bootstrapClient, client.InNamespace(namespace)) - - vmName := BmhToVMName(isoBmh) - serialLogFile := fmt.Sprintf("/var/log/libvirt/qemu/%s-serial0.log", vmName) - - By("Reading serial logs to verify the node was booted from live ISO image") - Eventually(func(g Gomega) { - cmd := fmt.Sprintf("sudo cat %s | grep '# Welcome'", serialLogFile) - output, err := exec.Command("/bin/sh", "-c", cmd).Output() - g.Expect(err).ToNot(HaveOccurred()) - g.Expect(output).ToNot(BeNil(), fmt.Sprintf("Failed to read serial logs from %s", serialLogFile)) - }, e2eConfig.GetIntervals(specName, "wait-job")...).Should(Succeed()) - By("LIVE ISO TEST PASSED!") - }) - - AfterEach(func() { - By("Deprovisioning live ISO image booted BMH") - - bootstrapClient := bootstrapClusterProxy.GetClient() - - bmhs, err := GetAllBmhs(ctx, bootstrapClient, namespace) - Expect(err).NotTo(HaveOccurred(), "Error getting all BMHs") - - for _, bmh := range bmhs { - bmh := bmh // for gosec G601 - Logf("Checking BMH %s", bmh.Name) - if bmh.Status.Provisioning.State == bmov1alpha1.StateProvisioned { - Logf("live ISO image booted BMH found %s", bmh.Name) - bmh.Spec.Online = false - bmh.Spec.Image = nil - Expect(bootstrapClient.Update(ctx, &bmh)).NotTo(HaveOccurred()) - } - } - By("Waiting for deprovisioned live ISO image booted BMH to be available") - WaitForNumBmhInState(ctx, bmov1alpha1.StateAvailable, WaitForNumInput{ - Client: bootstrapClient, - Options: []client.ListOption{client.InNamespace(namespace)}, - Replicas: numberOfAllBmh, - Intervals: e2eConfig.GetIntervals(specName, "wait-bmh-available"), - }) - By("live ISO image booted BMH deprovisioned successfully") - }) -}