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 23, 2024
1 parent 026f919 commit 2c4f311
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/components/storage/CockpitStorageIntegration.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const CockpitStorageIntegration = ({
<div className={idPrefix + "-page-section-cockpit-storage"}>
<PageSection>
<iframe
src="/cockpit/@localhost/storage/index.html"
src="../../@localhost/storage/index.html"
name="cockpit-storage"
className={idPrefix + "-iframe-cockpit-storage"} />
</PageSection>
Expand Down
120 changes: 92 additions & 28 deletions test/check-storage
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ from storage import Storage
from users import dbus_reset_users
from review import Review
from password import Password
from testlib import nondestructive, skipImage, test_main # pylint: disable=import-error
from testlib import nondestructive, skipImage, test_main, sit # 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 @@ -914,37 +914,13 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase, StorageHelpers)
s.rescan_disks()
s.wait_scenario_available("mount-point-mapping", False)

@nondestructive
def testLVM(self):
b = self.browser
m = self.machine
def _testLVM(self, b, m):
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"
s.partition_disk(disk, [("1MiB", "biosboot"), ("1GB", "ext4"), ("", None)])
m.execute(f"""
vgcreate -y -f {vgname} {disk}3
lvcreate -y -l40%FREE -n root {vgname}
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}
mkswap /dev/{vgname}/swap
""")

s.udevadm_settle()

i.open()
i.reach(i.steps.INSTALLATION_METHOD)
s.rescan_disks()

s.select_mountpoint([(dev, True)])

# verify gathered requests
Expand Down Expand Up @@ -1001,6 +977,94 @@ 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 testLVM(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"
s.partition_disk(disk, [("1MiB", "biosboot"), ("1GB", "ext4"), ("", None)])
m.execute(f"""
vgcreate -y -f {vgname} {disk}3
lvcreate -y -l40%FREE -n root {vgname}
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}
mkswap /dev/{vgname}/swap
""")

s.udevadm_settle()

i.open()
i.reach(i.steps.INSTALLATION_METHOD)
s.rescan_disks()
self._testLVM(b, m)

@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.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": 100, "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" })
self.click_card_dropdown("Unformatted data", "Format")
self.dialog({"size": 1000, "type": "ext4", "mount_point": "/root" })

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

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

self._testLVM(b, m)

@nondestructive
def testUnusableFormats(self):
b = self.browser
Expand Down

0 comments on commit 2c4f311

Please sign in to comment.