From 284f6d9bd459a51a46c701dcc13b50de20fa915d Mon Sep 17 00:00:00 2001 From: Katerina Koukiou Date: Fri, 21 Jul 2023 13:26:10 +0200 Subject: [PATCH 1/2] webui: don't crash in case a AUTOMATIC partitioning object exists It was problematic if this existed prior to entering the custom partitioning step. Then partitioningData.requests is 'undefined'. --- ui/webui/src/components/storage/CustomMountPoint.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/webui/src/components/storage/CustomMountPoint.jsx b/ui/webui/src/components/storage/CustomMountPoint.jsx index bd745bca226..4af933bd42e 100644 --- a/ui/webui/src/components/storage/CustomMountPoint.jsx +++ b/ui/webui/src/components/storage/CustomMountPoint.jsx @@ -153,7 +153,7 @@ export const CustomMountPoint = ({ deviceData, diskSelection, partitioningData, // If device selection changed since the last partitioning request redo the partitioning const selectedDevicesPaths = diskSelection.selectedDisks.map(d => deviceData[d].path.v) || []; - const partitioningDevicesPaths = partitioningData?.requests.map(r => r["device-spec"]) || []; + const partitioningDevicesPaths = partitioningData?.requests?.map(r => r["device-spec"]) || []; const canReusePartitioning = selectedDevicesPaths.length === partitioningDevicesPaths.length && selectedDevicesPaths.every(d => partitioningDevicesPaths.includes(d)); useEffect(() => { From d42d651e6093332de277e992a9b93a79b3b38049 Mon Sep 17 00:00:00 2001 From: Katerina Koukiou Date: Fri, 21 Jul 2023 13:27:56 +0200 Subject: [PATCH 2/2] webui: tests: make some more tests non-destructive These tests partition the vda device. Just wipe the partitions in the test tearDown, to allow reuse of the same test VM in followup tests. --- ui/webui/test/check-storage | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ui/webui/test/check-storage b/ui/webui/test/check-storage index 9fd3ea8d970..16910ec02d4 100755 --- a/ui/webui/test/check-storage +++ b/ui/webui/test/check-storage @@ -423,6 +423,7 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase): udevadm settle --timeout=120 """) + @nondestructive def testBasic(self): b = self.browser m = self.machine @@ -430,6 +431,8 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase): s = Storage(b, m) r = Review(b) + self.addCleanup(m.execute, "wipefs --all /dev/vda") + disk = "/dev/vda" m.execute(f""" sgdisk --zap-all {disk} @@ -438,8 +441,8 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase): sgdisk --new=0:0:+10GiB {disk} sgdisk --new=0:0:0 {disk} mkfs.ext4 {disk}2 - mkfs.xfs {disk}3 - mkfs.btrfs {disk}4 + mkfs.xfs -f {disk}3 + mkfs.btrfs -f {disk}4 """) self.udevadm_settle() @@ -500,12 +503,15 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase): r.check_disk_row(disk, row, "Format type", "btrfs") r.check_disk_row(disk, row, "Mount point", "/") + @nondestructive def testNoRootMountPoint(self): b = self.browser m = self.machine i = Installer(b, m) s = Storage(b, m) + self.addCleanup(m.execute, "wipefs --all /dev/vda") + # BIOS boot /boot on ext4 / on xfs /home on btrfs disk = "/dev/vda" m.execute(f""" @@ -515,7 +521,7 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase): sgdisk --new=0:0:+10GiB {disk} sgdisk --new=0:0:0 {disk} mkfs.ext4 {disk}2 - mkfs.xfs {disk}3 + mkfs.xfs -f {disk}3 mkfs.ext4 {disk}4 """)