From f752b4c00a3c48136a00d1c695a31222cabf6363 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Wed, 7 Dec 2022 15:24:02 -0800 Subject: [PATCH] Don't snapshot after wait_login tests (usually) We currently snapshot after every run of _console_wait_login or _graphical_wait_login, which means we snapshot *twice* on most update tests as those modules get run twice. However, we almost never use those snapshots. Snapshotting takes quite some time, and hits the disk pretty hard, so we should avoid it unless it is really needed. We only have a few modules that are not fatal (and so might use the snapshots), and most of those don't run after one of these tests, or run after a later module that's also a milestone. Best I can tell, only two test suites really need to use a snapshot from a login test: server_cockpit_updates and modularity_tests. To handle these and potential future cases, we'll add a new module that does nothing, but is marked 'milestone', so it will take a snapshot, and load that test after the login test if the var LOGIN_SNAPSHOT is set, and set that var for those two suites. Signed-off-by: Adam Williamson --- main.pm | 2 ++ templates.fif.json | 2 ++ tests/_console_avc_crash.pm | 2 +- tests/_console_wait_login.pm | 2 +- tests/_graphical_wait_login.pm | 2 +- tests/_snapshot_only.pm | 16 ++++++++++++++++ 6 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 tests/_snapshot_only.pm diff --git a/main.pm b/main.pm index f7756835..6347ca9a 100644 --- a/main.pm +++ b/main.pm @@ -246,6 +246,7 @@ sub _load_early_postinstall_tests { # Appropriate login method for install type if (get_var("DESKTOP")) { _load_instance("tests/_graphical_wait_login", $instance); + _load_instance("tests/_snapshot_only") if (get_var("LOGIN_SNAPSHOT")); } # Test non-US input at this point, on language tests if (get_var("SWITCHED_LAYOUT") || get_var("INPUT_METHOD")) { @@ -261,6 +262,7 @@ sub _load_early_postinstall_tests { # the installation is interrupted on purpose. unless (get_var("DESKTOP") || get_var("CRASH_REPORT")) { _load_instance("tests/_console_wait_login", $instance); + _load_instance("tests/_snapshot_only") if (get_var("LOGIN_SNAPSHOT")); } } diff --git a/templates.fif.json b/templates.fif.json index 086a54cb..d2120387 100644 --- a/templates.fif.json +++ b/templates.fif.json @@ -2237,6 +2237,7 @@ "settings": { "BOOTFROM": "c", "HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2", + "LOGIN_SNAPSHOT": "1", "POSTINSTALL": "modularity_module_list modularity_enable_disable_module modularity_install_module", "ROOT_PASSWORD": "weakpassword", "START_AFTER_TEST": "%DEPLOY_UPLOAD_TEST%", @@ -2385,6 +2386,7 @@ "+HDD_1": "disk_%MACHINE%_cockpit.qcow2", "+START_AFTER_TEST": "server_cockpit_default", "BOOTFROM": "c", + "LOGIN_SNAPSHOT": "1", "POSTINSTALL": "server_cockpit_updates server_cockpit_autoupdate", "ROOT_PASSWORD": "weakpassword", "USER_LOGIN": "false" diff --git a/tests/_console_avc_crash.pm b/tests/_console_avc_crash.pm index a47bfbd2..28e78106 100644 --- a/tests/_console_avc_crash.pm +++ b/tests/_console_avc_crash.pm @@ -32,7 +32,7 @@ sub run { } sub test_flags { - return {}; + return {fatal => 1}; } 1; diff --git a/tests/_console_wait_login.pm b/tests/_console_wait_login.pm index 8c1498d2..0395d89d 100644 --- a/tests/_console_wait_login.pm +++ b/tests/_console_wait_login.pm @@ -37,7 +37,7 @@ sub run { } sub test_flags { - return {fatal => 1, milestone => 1}; + return {fatal => 1}; } 1; diff --git a/tests/_graphical_wait_login.pm b/tests/_graphical_wait_login.pm index 9c0323f5..9025acff 100644 --- a/tests/_graphical_wait_login.pm +++ b/tests/_graphical_wait_login.pm @@ -121,7 +121,7 @@ sub run { } sub test_flags { - return {fatal => 1, milestone => 1}; + return {fatal => 1}; } 1; diff --git a/tests/_snapshot_only.pm b/tests/_snapshot_only.pm new file mode 100644 index 00000000..084f537d --- /dev/null +++ b/tests/_snapshot_only.pm @@ -0,0 +1,16 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +sub run { + my $self = shift; +} + +sub test_flags { + return {fatal => 1, milestone => 1}; +} + +1; + +# vim: set sw=4 et: