Skip to content

Commit

Permalink
Add new tests for the cockpit-storage editing mode
Browse files Browse the repository at this point in the history
  • Loading branch information
KKoukiou committed Jan 24, 2024
1 parent a0cf2ca commit ba42dc5
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 5 deletions.
90 changes: 86 additions & 4 deletions test/check-storage
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ from review import Review
from password import Password
from testlib import nondestructive, skipImage, test_main # pylint: disable=import-error
from progress import Progress
from storagelib import StorageHelpers # pylint: disable=import-error
from storagelib import StorageCase, StorageHelpers # pylint: disable=import-error
from utils import pretend_live_iso


Expand Down Expand Up @@ -383,7 +383,7 @@ class TestStorageExtraDisks(anacondalib.VirtInstallMachineCase, StorageHelpers):
s.check_disk_selected(disk)


class TestStorageMountPoints(anacondalib.VirtInstallMachineCase, StorageHelpers):
class TestStorageMountPoints(anacondalib.VirtInstallMachineCase, StorageCase):
efi = False

@nondestructive
Expand Down Expand Up @@ -935,7 +935,7 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase, StorageHelpers)
mkfs.ext4 -F /dev/{vgname}/root
lvcreate -y -l90%FREE -n home {vgname}
mkfs.ext4 -F /dev/{vgname}/home
lvcreate -y -l100%FREE -n swap {vgname}
lvcreate -y -l95%FREE -n swap {vgname}
mkswap /dev/{vgname}/swap
""")

Expand Down Expand Up @@ -971,7 +971,7 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase, StorageHelpers)
s.select_mountpoint_row_reformat(2)
s.check_mountpoint_row_reformat(2, True)

self.addCleanup(lambda: dbus_reset_users(self.machine))
self.addCleanup(lambda: dbus_reset_users(m))
i.reach(i.steps.REVIEW)

# verify review screen
Expand Down Expand Up @@ -1001,6 +1001,88 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase, StorageHelpers)
r.check_disk_row(disk, 2, f"{vgname}-root, 6.01 GB: format as ext4, /")
r.check_disk_row(disk, 3, f"{vgname}-swap, 902 MB: mount, swap")

@nondestructive
def testLVMCockpitStorage(self):
b = self.browser
m = self.machine
i = Installer(b, m)
s = Storage(b, m)
r = Review(b)

vgname = "fedoravg"

self.addCleanup(m.execute, f"vgremove -y -ff {vgname}")

disk = "/dev/vda"
dev = "vda"

i.open()
i.reach(i.steps.INSTALLATION_METHOD)
s.wait_scenario_visible("use-configured-storage", False)
s.modify_storage()
b.wait_visible(".cockpit-storage-integration-sidebar")

frame = "iframe[name='cockpit-storage']"
b._wait_present(frame)
b.switch_to_frame("cockpit-storage")
b._wait_present("#storage.ct-page-fill")

self.click_dropdown(self.card_row("Storage", 1), "Create partition table")
self.confirm()

self.click_dropdown(self.card_row("Storage", 2), "Create partition")
self.dialog({ "size": 1, "type": "biosboot" })

self.click_dropdown(self.card_row("Storage", 3), "Create partition")
self.dialog({"size": 1070, "type": "ext4", "mount_point": "/boot" })

self.click_devices_dropdown("Create LVM2 volume group")
self.dialog({ "name": vgname, "disks": { dev: True } })

self.click_card_row("Storage", name=vgname)

b.click(self.card_button("LVM2 logical volumes", "Create new logical volume"))
self.dialog({ "name": "root", "size": 6010 })
self.click_card_row("LVM2 logical volumes", 1)
self.click_card_dropdown("Unformatted data", "Format")
self.dialog({ "type": "ext4", "mount_point": "/" })

b.click(self.card_parent_link())

b.click(self.card_button("LVM2 logical volumes", "Create new logical volume"))
self.dialog({ "name": "home", "size": 8120 })
self.click_card_row("LVM2 logical volumes", 1)
self.click_card_dropdown("Unformatted data", "Format")
self.dialog({"type": "ext4", "mount_point": "/home" })

b.click(self.card_parent_link())

b.click(self.card_button("LVM2 logical volumes", "Create new logical volume"))
self.dialog({ "name": "swap", "size": 898 })
self.click_card_row("LVM2 logical volumes", 3)
self.click_card_dropdown("Unformatted data", "Format")
self.dialog({ "type": "swap" })

# Exit the cockpit-storage iframe
b.switch_to_top()

s.return_to_installation()
s.return_to_installation_confirm()

s.set_partitioning("use-configured-storage")

self.addCleanup(lambda: dbus_reset_users(m))
i.reach(i.steps.REVIEW)

# verify review screen
disk = "vda"
r.check_disk(disk, "16.1 GB vda (0x1af4)")

r.check_disk_row(disk, 1, "vda2, 1.07 GB: mount, /boot")
r.check_disk_row(disk, 2, f"{vgname}-root, 6.01 GB: format as ext4, /")
r.check_disk_row(disk, 3, f"{vgname}-home, 8.12 GB: mount, /home")
r.check_disk_row(disk, 4, f"{vgname}-swap, 898 MB: mount, swap")

@nondestructive
def testUnusableFormats(self):
b = self.browser
Expand Down
3 changes: 2 additions & 1 deletion test/helpers/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class InstallerSteps(UserDict):

_steps_jump = {}
_steps_jump[WELCOME] = [INSTALLATION_METHOD]
_steps_jump[INSTALLATION_METHOD] = [DISK_ENCRYPTION, CUSTOM_MOUNT_POINT]
_steps_jump[INSTALLATION_METHOD] = [DISK_ENCRYPTION, CUSTOM_MOUNT_POINT, ACCOUNTS]
_steps_jump[DISK_ENCRYPTION] = [ACCOUNTS]
_steps_jump[CUSTOM_MOUNT_POINT] = [ACCOUNTS]
_steps_jump[ACCOUNTS] = [REVIEW]
Expand All @@ -43,6 +43,7 @@ class InstallerSteps(UserDict):
_parent_steps = {}
_parent_steps[DISK_ENCRYPTION] = DISK_CONFIGURATION
_parent_steps[CUSTOM_MOUNT_POINT] = DISK_CONFIGURATION
_parent_steps[ACCOUNTS] = INSTALLATION_METHOD

_steps_callbacks = {}
_steps_callbacks[ACCOUNTS] = create_user
Expand Down
6 changes: 6 additions & 0 deletions test/helpers/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ def rescan_disks(self):
with b.wait_timeout(30):
b.wait_not_present(f"#{self._step}-rescan-disks.pf-m-disabled")

def return_to_installation(self):
self.browser.click("#cockpit-storage-integration-return-to-installation-button")

def return_to_installation_confirm(self):
self.browser.click("#cockpit-storage-integration-check-storage-dialog-continue")

def modify_storage(self):
self.browser.click(f"#{self._step}-modify-storage")

Expand Down

0 comments on commit ba42dc5

Please sign in to comment.