diff --git a/Makefile b/Makefile index 4a10f2302..d172f3a01 100644 --- a/Makefile +++ b/Makefile @@ -181,12 +181,16 @@ bots: test/common live-vm: bots $(UPDATES_IMG) ./test/webui_testvm.py $(TEST_LIVE_OS) -prepare-test-deps: bots test/common payload +prepare-test-deps: bots test/common payload images .PHONY: payload payload: bots bots/image-download $(PAYLOAD) +.PHONY: images +images: bots + bots/image-download $(TEST_OS) debian-stable + $(UPDATES_IMG): bots test/prepare-updates-img diff --git a/test/anacondalib.py b/test/anacondalib.py index 73726bbc4..9dfca859c 100644 --- a/test/anacondalib.py +++ b/test/anacondalib.py @@ -40,6 +40,7 @@ class VirtInstallMachineCase(MachineCase): efi = False disk_image = "" + disk_size = 15 MachineCase.machine_class = VirtInstallMachine @classmethod @@ -58,8 +59,7 @@ def setUp(self): # Add installation target disk backing_file = None if not self.disk_image else os.path.join(BOTS_DIR, f"./images/{self.disk_image}") - size = None if backing_file else 15 - self.add_disk(size, backing_file) + self.add_disk(self.disk_size, backing_file) # Select the disk as boot device subprocess.check_call([ "virt-xml", "-c", "qemu:///session", @@ -107,7 +107,7 @@ def _create_disk_image(self, size, image_path=None, backing_file=None): "qemu-img", "create", "-f", "qcow2", *(["-o", f"backing_file={backing_file},backing_fmt=qcow2"] if backing_file else []), image_path, - *([f"{size}G"] if size else []) + f"{size}G" ]) return image_path @@ -165,8 +165,23 @@ def handleReboot(self): self.installation_finished = True p = Progress(self.browser) p.reboot() + + # The installed machine does not need to skip the nologin check + os.environ["TEST_ALLOW_NOLOGIN"] = "false" + self.addCleanup(lambda: os.environ["TEST_ALLOW_NOLOGIN"] == "true") self.machine.wait_reboot() + def selectBootMenuEntry(self, entry): + grub_cfg = """ + GRUB_DEFAULT=saved + GRUB_TIMEOUT=0 + GRUB_HIDDEN_TIMEOUT=0 + GRUB_HIDDEN_TIMEOUT_QUIET=true + """ + + self.write_file("/etc/default/grub", grub_cfg) + self.machine.execute(f"grub2-set-default {entry}") + def tearDown(self): if not self.installation_finished: self.downloadLogs() diff --git a/test/check-existing-system b/test/check-existing-system index fb0366290..e2810629d 100755 --- a/test/check-existing-system +++ b/test/check-existing-system @@ -17,8 +17,11 @@ import anacondalib from installer import Installer +from progress import Progress from review import Review +from storage import Storage from testlib import nondestructive, test_main # pylint: disable=import-error +from utils import get_pretty_name @nondestructive @@ -40,6 +43,37 @@ class TestExistingSystemFedora(anacondalib.VirtInstallMachineCase): r.check_deleted_system("Fedora Linux") +class TestExistingSystemDebian(anacondalib.VirtInstallMachineCase): + disk_image = "debian-stable" + disk_size = 20 + + def testScenarioUseFreeSpace(self): + b = self.browser + m = self.machine + i = Installer(b, m) + s = Storage(b, m) + p = Progress(b) + + i.open() + i.reach(i.steps.INSTALLATION_METHOD) + s.set_partitioning("use-free-space") + i.next() + s.check_encryption_selected(False) + i.reach(i.steps.REVIEW) + i.begin_installation(button_text="Install") + with b.wait_timeout(300): + p.wait_done() + + # Expect the new OS is the default grub entry + self.handleReboot() + pretty_name = get_pretty_name(m) + self.assertIn("Fedora Linux", pretty_name) + # Select second OS grub entry + self.selectBootMenuEntry(2) + m.reboot() + pretty_name = get_pretty_name(m) + self.assertIn("Debian GNU/Linux", pretty_name) + if __name__ == '__main__': test_main() diff --git a/test/check-storage-reclaim b/test/check-storage-reclaim index cd7719f48..b1c820175 100755 --- a/test/check-storage-reclaim +++ b/test/check-storage-reclaim @@ -72,8 +72,6 @@ class TestStorageUseFreeSpaceScenario(anacondalib.VirtInstallMachineCase, Storag s.reclaim_check_checkbox(True, False) s.reclaim_set_checkbox(False) - i.next() - s.check_encryption_selected(False) i.reach(i.steps.REVIEW) r.check_disk_row(dev, "/", "vda5, LVM", "8.59 GB", True, "xfs") @@ -147,7 +145,6 @@ class TestStorageUseFreeSpaceScenario(anacondalib.VirtInstallMachineCase, Storag s.reclaim_check_available_space("9.66 GB") s.reclaim_modal_submit() - s.check_encryption_selected(False) i.reach(i.steps.REVIEW) r.check_disk_row(dev, parent="vda4", action="delete") @@ -172,7 +169,6 @@ class TestStorageUseFreeSpaceScenarioExistingSystemFedora(anacondalib.VirtInstal s.reclaim_remove_device("vda4") s.reclaim_modal_submit() - s.check_encryption_selected(False) i.reach(i.steps.REVIEW) r.check_affected_system("Fedora Linux", [("vda4", ["home", "root", "var"])]) diff --git a/test/helpers/installer.py b/test/helpers/installer.py index e573609d1..bf5d3de37 100644 --- a/test/helpers/installer.py +++ b/test/helpers/installer.py @@ -64,7 +64,8 @@ def __init__(self, browser, machine, hidden_steps=None, scenario=None): def begin_installation(self, should_fail=False, confirm_erase=True, button_text='Erase data and install'): current_page = self.get_current_page() - self.browser.click(f"button:contains('{button_text}')") + self.browser.wait_text("#installation-next-btn", button_text) + self.browser.click("#installation-next-btn") if confirm_erase: self.browser.click(f"#{self.steps.REVIEW}-disk-erase-confirm")