From a17761247175fb64abd06a64e7930616d3b782f2 Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Wed, 29 Nov 2023 09:36:36 +0200 Subject: [PATCH] WIP - tests --- test/verify/check-storage-lvm2 | 30 ++++++++--------- test/verify/check-storage-mdraid | 54 +++++++++++++++---------------- test/verify/check-storage-msdos | 20 ++++++------ test/verify/check-storage-stratis | 26 +++++++-------- test/verify/check-storage-used | 2 +- 5 files changed, 66 insertions(+), 66 deletions(-) diff --git a/test/verify/check-storage-lvm2 b/test/verify/check-storage-lvm2 index 6d6d7ff3d8ff..b65bd9634157 100755 --- a/test/verify/check-storage-lvm2 +++ b/test/verify/check-storage-lvm2 @@ -59,8 +59,8 @@ class TestStorageLvm2(storagelib.StorageCase): # just in case the test fails self.addCleanup(m.execute, "vgremove --force TEST1 2>/dev/null || true") b.click(self.card_row("Storage", name="TEST1")) - b.wait_visible(self.card_row("LVM2 physical volumes", name=dev_1)) - b.wait_visible(self.card_row("LVM2 physical volumes", name=dev_2)) + b.wait_visible(self.card_row("LVM2 volume group", name=dev_1)) + b.wait_visible(self.card_row("LVM2 volume group", name=dev_2)) # Create two logical volumes m.execute("lvcreate TEST1 -n one -L 20m") @@ -79,12 +79,12 @@ class TestStorageLvm2(storagelib.StorageCase): # remove a disk from the volume group m.execute(f"pvmove {dev_2} &>/dev/null || true") m.execute(f"vgreduce TEST1 {dev_2}") - b.wait_not_present(self.card_row("LVM2 physical volumes", name=dev_2)) + b.wait_not_present(self.card_row("LVM2 volume group", name=dev_2)) # The remaining lone disk is not removable - b.click(self.dropdown_toggle(self.card_row("LVM2 physical volumes", name=dev_1))) - b.wait_visible(self.dropdown_action(self.card_row("LVM2 physical volumes", name=dev_1), "Remove") + "[disabled]") - b.wait_text(self.dropdown_description(self.card_row("LVM2 physical volumes", name=dev_1), "Remove"), + b.click(self.dropdown_toggle(self.card_row("LVM2 volume group", name=dev_1))) + b.wait_visible(self.dropdown_action(self.card_row("LVM2 volume group", name=dev_1), "Remove") + "[disabled]") + b.wait_text(self.dropdown_description(self.card_row("LVM2 volume group", name=dev_1), "Remove"), "Last cannot be removed") # Wipe the disk and make sure lvmetad forgets about it. This @@ -191,8 +191,8 @@ class TestStorageLvm2(storagelib.StorageCase): self.assertEqual(m.execute(f"grep {mount_point_one} /etc/fstab || true"), "") # remove disk2 - self.click_dropdown(self.card_row("LVM2 physical volumes", name=dev_2), "Remove") - b.wait_not_present(self.card_row("LVM2 physical volumes", name=dev_2)) + self.click_dropdown(self.card_row("LVM2 volume group", name=dev_2), "Remove") + b.wait_not_present(self.card_row("LVM2 volume group", name=dev_2)) b.wait_in_text(self.card_desc("LVM2 volume group", "Capacity"), "50.3 MB") # create thin pool and volume @@ -212,12 +212,12 @@ class TestStorageLvm2(storagelib.StorageCase): b.wait_text(self.card_row_col("LVM2 logical volumes", 2, 1), "thin") # add a disk and resize the pool - b.click(self.card_button("LVM2 physical volumes", "Add physical volume")) + b.click(self.card_button("LVM2 volume group", "Add physical volume")) self.dialog_wait_open() self.dialog_set_val('disks', {dev_2: True}) self.dialog_apply() self.dialog_wait_close() - b.wait_visible(self.card_row("LVM2 physical volumes", name=dev_2)) + b.wait_visible(self.card_row("LVM2 volume group", name=dev_2)) # this is sometimes 96, sometimes 100 MB cap = self.card_desc("LVM2 volume group", "Capacity") b.wait_js_func("(sel => { const c = Number(ph_text(sel).split(' ')[0]); return c >= 96 && c <= 101 })", cap) @@ -303,15 +303,15 @@ class TestStorageLvm2(storagelib.StorageCase): b.click(self.card_row("Storage", name="vgroup0")) # Check the we are really using a partition on disk1 now - b.wait_in_text(self.card_row_col("LVM2 physical volumes", 1, 2), "Partition - Linux scsi_debug") + b.wait_in_text(self.card_row_col("LVM2 volume group", 1, 2), "Partition - Linux scsi_debug") # Add the unused space of disk2 - self.dialog_with_retry(trigger=lambda: b.click(self.card_button("LVM2 physical volumes", + self.dialog_with_retry(trigger=lambda: b.click(self.card_button("LVM2 volume group", "Add physical volume")), expect=lambda: self.dialog_is_present( 'disks', "unpartitioned space on " + disk2), values={"disks": {disk2: True}}) - b.wait_in_text(self.card_row_col("LVM2 physical volumes", 1, 2), "Partition - Block device") + b.wait_in_text(self.card_row_col("LVM2 volume group", 1, 2), "Partition - Block device") def testSnapshots(self): m = self.machine @@ -510,12 +510,12 @@ class TestStorageLvm2(storagelib.StorageCase): self.dialog_wait_close() b.click(self.card_parent_link()) - b.click(self.card_button("LVM2 physical volumes", "Add physical volume")) + b.click(self.card_button("LVM2 volume group", "Add physical volume")) self.dialog_wait_open() self.dialog_set_val('disks', {disk4: True}) self.dialog_apply() self.dialog_wait_close() - b.wait_visible(self.card_row("LVM2 physical volumes", name=disk4)) + b.wait_visible(self.card_row("LVM2 volume group", name=disk4)) b.click(self.card_row("LVM2 logical volumes", 1)) b.click(self.card_button("LVM2 logical volume", "Repair")) diff --git a/test/verify/check-storage-mdraid b/test/verify/check-storage-mdraid index e58bfda25aa0..695bc2d4c251 100755 --- a/test/verify/check-storage-mdraid +++ b/test/verify/check-storage-mdraid @@ -27,16 +27,16 @@ class TestStorageMdRaid(storagelib.StorageCase): def wait_states(self, states): for s in states.keys(): - self.browser.wait_in_text(self.card_row("MDRAID disks", name=s), states[s]) + self.browser.wait_in_text(self.card_row("MDRAID device", name=s), states[s]) def raid_add_disk(self, name): - self.dialog_open_with_retry(trigger=lambda: self.browser.click(self.card_button("MDRAID disks", "Add disk")), + self.dialog_open_with_retry(trigger=lambda: self.browser.click(self.card_button("MDRAID device", "Add disk")), expect=lambda: self.dialog_is_present('disks', name)) self.dialog_set_val("disks", {name: True}) self.dialog_apply_with_retry() def raid_remove_disk(self, name): - self.click_dropdown(self.card_row("MDRAID disks", name=name), "Remove") + self.click_dropdown(self.card_row("MDRAID device", name=name), "Remove") def raid_action(self, action): self.browser.click(self.card_button("MDRAID device", action)) @@ -203,7 +203,7 @@ class TestStorageMdRaid(storagelib.StorageCase): # Remove DISK1. The spare takes over. self.raid_remove_disk(disk1) - b.wait_not_present(self.card_row("MDRAID disks", name=disk1)) + b.wait_not_present(self.card_row("MDRAID device", name=disk1)) self.wait_states({disk4: "In sync"}) # Stop the array, destroy a disk, and start the array @@ -216,7 +216,7 @@ class TestStorageMdRaid(storagelib.StorageCase): self.raid_default_action_finish("Stop") b.wait_text(self.card_desc("MDRAID device", "State"), "Not running") m.execute("wipefs -a /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_DISK2") - b.wait_not_present(self.card_row("MDRAID disks", name=disk2)) + b.wait_not_present(self.card_row("MDRAID device", name=disk2)) self.raid_default_action("Start") b.wait_text(self.card_desc("MDRAID device", "State"), "Running") wait_degraded_state(is_degraded=True) @@ -231,7 +231,7 @@ class TestStorageMdRaid(storagelib.StorageCase): self.wait_states({disk2: "Spare"}) # Remove it by formatting DISK2 - b.click(self.card_row("MDRAID disks", name=disk2)) + b.click(self.card_row("MDRAID device", name=disk2)) self.click_card_dropdown("Hard Disk Drive", "Create partition table") b.wait_in_text('#dialog', "remove from MDRAID, initialize") self.dialog_set_val("type", "empty") @@ -240,8 +240,8 @@ class TestStorageMdRaid(storagelib.StorageCase): b.go("#/") b.click(self.card_row("Storage", name="/dev/md/raid0")) - b.wait_visible(self.card("MDRAID disks")) - b.wait_not_present(self.card_row("MDRAID disks", name=disk2)) + b.wait_visible(self.card("MDRAID device")) + b.wait_not_present(self.card_row("MDRAID device", name=disk2)) # Delete the array. We are back on the storage page. self.click_card_dropdown("MDRAID device", "Delete") @@ -281,23 +281,23 @@ class TestStorageMdRaid(storagelib.StorageCase): self.raid_default_action("Stop") b.wait_text(self.card_desc("MDRAID device", "State"), "Not running") - b.wait_visible(self.card_button("MDRAID disks", "Add disk") + ":disabled") - b.click(self.dropdown_toggle(self.card_row("MDRAID disks", name=disk1))) - b.wait_visible(self.dropdown_action(self.card_row("MDRAID disks", name=disk1), "Remove") + "[disabled]") - b.wait_text(self.dropdown_description(self.card_row("MDRAID disks", name=disk1), "Remove"), + b.wait_visible(self.card_button("MDRAID device", "Add disk") + ":disabled") + b.click(self.dropdown_toggle(self.card_row("MDRAID device", name=disk1))) + b.wait_visible(self.dropdown_action(self.card_row("MDRAID device", name=disk1), "Remove") + "[disabled]") + b.wait_text(self.dropdown_description(self.card_row("MDRAID device", name=disk1), "Remove"), "The MDRAID device must be running") - b.click(self.dropdown_toggle(self.card_row("MDRAID disks", name=disk1))) + b.click(self.dropdown_toggle(self.card_row("MDRAID device", name=disk1))) self.raid_default_action("Start") b.wait_text(self.card_desc("MDRAID device", "State"), "Running") # With a running array, we can add spares, but not remove "in-sync" disks - b.wait_not_present(self.card_button("MDRAID disks", "Add disk") + ":disabled") - b.click(self.dropdown_toggle(self.card_row("MDRAID disks", name=disk1))) - b.wait_visible(self.dropdown_action(self.card_row("MDRAID disks", name=disk1), "Remove") + "[disabled]") - b.wait_text(self.dropdown_description(self.card_row("MDRAID disks", name=disk1), "Remove"), + b.wait_not_present(self.card_button("MDRAID device", "Add disk") + ":disabled") + b.click(self.dropdown_toggle(self.card_row("MDRAID device", name=disk1))) + b.wait_visible(self.dropdown_action(self.card_row("MDRAID device", name=disk1), "Remove") + "[disabled]") + b.wait_text(self.dropdown_description(self.card_row("MDRAID device", name=disk1), "Remove"), "Need a spare disk") - b.click(self.dropdown_toggle(self.card_row("MDRAID disks", name=disk1))) + b.click(self.dropdown_toggle(self.card_row("MDRAID device", name=disk1))) # Adding a spare will allow removal of the "in-sync" disks. self.raid_add_disk(disk3) @@ -307,25 +307,25 @@ class TestStorageMdRaid(storagelib.StorageCase): disk2: "In sync"}) # Removing the disk will make the rest un-removable again - b.click(self.dropdown_toggle(self.card_row("MDRAID disks", name=disk3))) - b.wait_visible(self.dropdown_action(self.card_row("MDRAID disks", name=disk3), "Remove") + "[disabled]") - b.wait_text(self.dropdown_description(self.card_row("MDRAID disks", name=disk3), "Remove"), + b.click(self.dropdown_toggle(self.card_row("MDRAID device", name=disk3))) + b.wait_visible(self.dropdown_action(self.card_row("MDRAID device", name=disk3), "Remove") + "[disabled]") + b.wait_text(self.dropdown_description(self.card_row("MDRAID device", name=disk3), "Remove"), "Need a spare disk") - b.click(self.dropdown_toggle(self.card_row("MDRAID disks", name=disk3))) + b.click(self.dropdown_toggle(self.card_row("MDRAID device", name=disk3))) # A failed disk can be removed dev = b.text(self.card_desc("MDRAID device", "Device")) m.execute(f"mdadm --quiet {dev} --fail /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_DISK3") self.wait_states({disk3: "Failed"}) self.raid_remove_disk(disk3) - b.wait_not_present(self.card_row("MDRAID disks", name=disk3)) + b.wait_not_present(self.card_row("MDRAID device", name=disk3)) # The last disk can not be removed - b.click(self.dropdown_toggle(self.card_row("MDRAID disks", name=disk2))) - b.wait_visible(self.dropdown_action(self.card_row("MDRAID disks", name=disk2), "Remove") + "[disabled]") - b.wait_text(self.dropdown_description(self.card_row("MDRAID disks", name=disk2), "Remove"), + b.click(self.dropdown_toggle(self.card_row("MDRAID device", name=disk2))) + b.wait_visible(self.dropdown_action(self.card_row("MDRAID device", name=disk2), "Remove") + "[disabled]") + b.wait_text(self.dropdown_description(self.card_row("MDRAID device", name=disk2), "Remove"), "Need a spare disk") - b.click(self.dropdown_toggle(self.card_row("MDRAID disks", name=disk2))) + b.click(self.dropdown_toggle(self.card_row("MDRAID device", name=disk2))) def testBitmap(self): m = self.machine diff --git a/test/verify/check-storage-msdos b/test/verify/check-storage-msdos index e5c8acb2dfbe..95ef2ed96169 100755 --- a/test/verify/check-storage-msdos +++ b/test/verify/check-storage-msdos @@ -36,19 +36,19 @@ class TestStorageMsDOS(storagelib.StorageCase): # Format it with a DOS partition table self.click_card_dropdown("Solid State Drive", "Create partition table") self.dialog({"type": "dos"}) - b.wait_text(self.card_row_col("GPT partitions", 1, 1), "Free space") + b.wait_text(self.card_row_col("DOS partitions", 1, 1), "Free space") # Create a primary partition - self.click_dropdown(self.card_row("GPT partitions", 1), "Create partition") + self.click_dropdown(self.card_row("DOS partitions", 1), "Create partition") self.dialog({"size": 10, "type": "ext4", "mount_point": "/foo", "name": "FIRST"}, secondary=True) - b.wait_text(self.card_row_col("GPT partitions", 1, 2), "ext4 filesystem") + b.wait_text(self.card_row_col("DOS partitions", 1, 2), "ext4 filesystem") # Open dialog for formatting the primary partition and check that "dos-extended" is not offered. - b.click(self.card_row("GPT partitions", 1)) + b.click(self.card_row("DOS partitions", 1)) self.click_card_dropdown("ext4 filesystem", "Format") self.dialog_wait_open() b.wait_not_present("select option[value='dos-extended']") @@ -57,7 +57,7 @@ class TestStorageMsDOS(storagelib.StorageCase): b.click(self.card_parent_link()) # Create a extended partition to fill the rest of the disk - self.click_dropdown(self.card_row("GPT partitions", 2), "Create partition") + self.click_dropdown(self.card_row("DOS partitions", 2), "Create partition") self.dialog_wait_open() self.dialog_set_val("type", "dos-extended") self.dialog_wait_not_present("name") @@ -65,12 +65,12 @@ class TestStorageMsDOS(storagelib.StorageCase): self.dialog_wait_not_present("mount_options") self.dialog_apply() self.dialog_wait_close() - b.wait_text(self.card_row_col("GPT partitions", 2, 1), "Extended partition") - b.wait_text(self.card_row_col("GPT partitions", 3, 1), "Free space") + b.wait_text(self.card_row_col("DOS partitions", 2, 1), "Extended partition") + b.wait_text(self.card_row_col("DOS partitions", 3, 1), "Free space") # Create logical partitions and check that "dos-extended" is # not offered. - self.click_dropdown(self.card_row("GPT partitions", 3), "Create partition") + self.click_dropdown(self.card_row("DOS partitions", 3), "Create partition") self.dialog_wait_open() b.wait_not_present("select option[value='dos-extended']") self.dialog_cancel() @@ -78,10 +78,10 @@ class TestStorageMsDOS(storagelib.StorageCase): # Delete it - self.click_dropdown(self.card_row("GPT partitions", 2), "Delete") + self.click_dropdown(self.card_row("DOS partitions", 2), "Delete") self.confirm() - b.wait_text(self.card_row_col("GPT partitions", 2, 1), "Free space") + b.wait_text(self.card_row_col("DOS partitions", 2, 1), "Free space") if __name__ == '__main__': diff --git a/test/verify/check-storage-stratis b/test/verify/check-storage-stratis index 778998612f30..2fce7f46d0f0 100755 --- a/test/verify/check-storage-stratis +++ b/test/verify/check-storage-stratis @@ -236,7 +236,7 @@ class TestStorageStratis(storagelib.StorageCase): b.wait_not_present(self.card_row("Stratis filesystems", name="fsys-unmounted")) # Add a data blockdev - b.click(self.card_button("Stratis block devices", "Add block device")) + b.click(self.card_button("Stratis pool", "Add block device")) self.dialog_wait_open() self.dialog_apply() self.dialog_wait_error("disks", "At least one") @@ -245,20 +245,20 @@ class TestStorageStratis(storagelib.StorageCase): self.dialog_apply() self.dialog_wait_close() - b.wait_visible(self.card_row("Stratis block devices", name=dev_3)) + b.wait_visible(self.card_row("Stratis pool", name=dev_3)) b.wait_in_text(self.card_desc("Stratis pool", "Usage"), "12 GB") # Add a cache blockdev - b.click(self.card_button("Stratis block devices", "Add block device")) + b.click(self.card_button("Stratis pool", "Add block device")) self.dialog({'tier': "cache", 'disks': {dev_4: True}}) - b.wait_in_text(self.card_row("Stratis block devices", name=dev_4), "cache") + b.wait_in_text(self.card_row("Stratis pool", name=dev_4), "cache") # Add a second cache blockdev, this uses a different code path - b.click(self.card_button("Stratis block devices", "Add block device")) + b.click(self.card_button("Stratis pool", "Add block device")) self.dialog({'tier': "cache", 'disks': {dev_5: True}}) - b.wait_in_text(self.card_row("Stratis block devices", name=dev_5), "cache") + b.wait_in_text(self.card_row("Stratis pool", name=dev_5), "cache") # Rename the pool b.click(self.card_desc_action("Stratis pool", "Name")) @@ -480,7 +480,7 @@ class TestStorageStratisReboot(storagelib.StorageCase): self.assertIn("noauto", m.execute("grep /run/fsys1 /etc/fstab")) # Add a data blockdev - b.click(self.card_button("Stratis block devices", "Add block device")) + b.click(self.card_button("Stratis pool", "Add block device")) self.dialog_wait_open() self.dialog_set_val('disks', {dev_2: True}) self.dialog_apply() @@ -488,7 +488,7 @@ class TestStorageStratisReboot(storagelib.StorageCase): self.dialog_set_val('passphrase', passphrase) self.dialog_apply() self.dialog_wait_close() - b.wait_in_text(self.card_row("Stratis block devices", name=dev_2), "data") + b.wait_in_text(self.card_row("Stratis pool", name=dev_2), "data") # Change the passphrase (if supported) if not self.stratis_v2: @@ -506,14 +506,14 @@ class TestStorageStratisReboot(storagelib.StorageCase): # Add a cache blockdev (if supported) if not self.stratis_v2: - b.click(self.card_button("Stratis block devices", "Add block device")) + b.click(self.card_button("Stratis pool", "Add block device")) self.dialog_wait_open() self.dialog_set_val('tier', "cache") self.dialog_set_val('disks', {dev_3: True}) self.dialog_set_val('passphrase', passphrase) self.dialog_apply() self.dialog_wait_close() - b.wait_in_text(self.card_row("Stratis block devices", name=dev_3), "cache") + b.wait_in_text(self.card_row("Stratis pool", name=dev_3), "cache") m.reboot() m.start_cockpit() @@ -521,8 +521,8 @@ class TestStorageStratisReboot(storagelib.StorageCase): b.enter_page("/storage") b.wait_visible(self.card("Stratis pool")) - b.wait_in_text(self.card("Stratis block devices"), "DISK1") - b.wait_in_text(self.card("Stratis block devices"), "DISK2") + b.wait_in_text(self.card("Stratis pool"), "DISK1") + b.wait_in_text(self.card("Stratis pool"), "DISK2") # Unlock the pool b.click(self.card_button("Stratis pool", "Start")) @@ -915,7 +915,7 @@ class TestStorageStratisNBDE(packagelib.PackageCase, storagelib.StorageCase): # Add a blockdevice. This requires the passphrase. - b.click(self.card_button("Stratis block devices", "Add block device")) + b.click(self.card_button("Stratis pool", "Add block device")) self.dialog({'disks': {dev_2: True}, 'passphrase': "foodeeboodeebar"}) # Remove the keyserver and add it back diff --git a/test/verify/check-storage-used b/test/verify/check-storage-used index caf3896c5b9c..25f763e2a876 100755 --- a/test/verify/check-storage-used +++ b/test/verify/check-storage-used @@ -62,7 +62,7 @@ ExecStart=/usr/bin/sleep infinity b.click(self.card_row("Storage", name=disk)) b.wait_visible(self.card("Solid State Drive")) - b.click(self.card_row("GPT partitions", 1)) + b.click(self.card_row("DOS partitions", 1)) self.click_card_dropdown("ext2 filesystem", "Format") self.dialog_wait_open() b.click("#dialog button:contains(Currently in use)")