From e6076e14b876db2db395b1d565763bc692d4cfec Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Thu, 13 Apr 2017 14:47:17 -0700 Subject: [PATCH] Workaround issues with loading same module more than once Summary: Loading the same module more than once *kinda* works, but it shows up all kinds of funky in the openQA web interface. There's a POO for this: https://progress.opensuse.org/issues/10514 But it doesn't seem like it's going to be resolved immediately, so in the mean time maybe we should avoid doing it so we don't have to deal with the weirdness it produces in the web UI. So here's a kinda icky hack that uses symlinks and stuff to load multiple instances of 'the same' test module. Test Plan: Run an update test, look at how it looks in the web UI and confirm it's a lot clearer and less buggy. Check there aren't any bugs in the loading approach. This is deployed on stg so you can look at it there. Reviewers: jsedlak, jskladan Reviewed By: jsedlak Subscribers: tflink Differential Revision: https://phab.qa.fedoraproject.org/D1186 --- main.pm | 29 ++++++++++++++++---- tests/_console_wait_login_2.pm | 1 + tests/_graphical_input_2.pm | 1 + tests/_graphical_wait_login_2.pm | 1 + tests/disk_guided_encrypted_postinstall_2.pm | 1 + 5 files changed, 27 insertions(+), 6 deletions(-) create mode 120000 tests/_console_wait_login_2.pm create mode 120000 tests/_graphical_input_2.pm create mode 120000 tests/_graphical_wait_login_2.pm create mode 120000 tests/disk_guided_encrypted_postinstall_2.pm diff --git a/main.pm b/main.pm index 31ccc40f..bd3fa02e 100644 --- a/main.pm +++ b/main.pm @@ -172,26 +172,43 @@ sub load_install_tests() { autotest::loadtest "tests/_do_install_and_reboot.pm"; } -sub _load_early_postinstall_tests() { +sub _load_instance { + # loads a specific 'instance' of a given test. See next function + # for more details. + my ($test, $instance) = @_; + $test .= "_${instance}" if $instance; + autotest::loadtest "${test}.pm"; +} + +sub _load_early_postinstall_tests { # Early post-install test loading. Split out as a separate sub # because we do this all twice on update tests. + # openQA isn't very good at handling jobs where the same module + # is loaded more than once, and fixing that will be a bit complex + # and no-one got around to it yet. So for now, we use a bit of a + # hack: for modules we know may get loaded multiple times, we have + # symlinks named _2, _3 etc. This function can be passed an arg + # specifying which 'instance' of the tests to use. + my ($instance) = @_; + $instance //= 0; + # Unlock encrypted storage volumes, if necessary. The test name here # follows the 'storage post-install' convention, but must be run earlier. if (get_var("ENCRYPT_PASSWORD")) { - autotest::loadtest "tests/disk_guided_encrypted_postinstall.pm"; + _load_instance("tests/disk_guided_encrypted_postinstall", $instance); } # Appropriate login method for install type if (get_var("DESKTOP")) { - autotest::loadtest "tests/_graphical_wait_login.pm"; + _load_instance("tests/_graphical_wait_login", $instance); } # Test non-US input at this point, on language tests if (get_var("SWITCHED_LAYOUT") || get_var("INPUT_METHOD")) { - autotest::loadtest "tests/_graphical_input.pm"; + _load_instance("tests/_graphical_input", $instance); } unless (get_var("DESKTOP")) { - autotest::loadtest "tests/_console_wait_login.pm"; + _load_instance("tests/_console_wait_login", $instance); } } @@ -219,7 +236,7 @@ sub load_postinstall_tests() { if (get_var("ADVISORY")) { autotest::loadtest "tests/_advisory_update.pm"; # now load the early boot tests again, as _advisory_update reboots - _load_early_postinstall_tests(); + _load_early_postinstall_tests(2); } # from now on, we have fully installed and booted system with root/specified user logged in diff --git a/tests/_console_wait_login_2.pm b/tests/_console_wait_login_2.pm new file mode 120000 index 00000000..37ffaba1 --- /dev/null +++ b/tests/_console_wait_login_2.pm @@ -0,0 +1 @@ +_console_wait_login.pm \ No newline at end of file diff --git a/tests/_graphical_input_2.pm b/tests/_graphical_input_2.pm new file mode 120000 index 00000000..0f18350e --- /dev/null +++ b/tests/_graphical_input_2.pm @@ -0,0 +1 @@ +_graphical_input.pm \ No newline at end of file diff --git a/tests/_graphical_wait_login_2.pm b/tests/_graphical_wait_login_2.pm new file mode 120000 index 00000000..425b2119 --- /dev/null +++ b/tests/_graphical_wait_login_2.pm @@ -0,0 +1 @@ +_graphical_wait_login.pm \ No newline at end of file diff --git a/tests/disk_guided_encrypted_postinstall_2.pm b/tests/disk_guided_encrypted_postinstall_2.pm new file mode 120000 index 00000000..a6333710 --- /dev/null +++ b/tests/disk_guided_encrypted_postinstall_2.pm @@ -0,0 +1 @@ +disk_guided_encrypted_postinstall.pm \ No newline at end of file