diff --git a/main.pm b/main.pm index 40daf304..1fecee4f 100644 --- a/main.pm +++ b/main.pm @@ -291,6 +291,11 @@ sub load_postinstall_tests() { # load the early tests _load_early_postinstall_tests(); + ## enable staging repos if requested + if (get_var("DNF_CONTENTDIR")) { + autotest::loadtest "tests/_staging_repos_enable.pm"; + } + # do standard post-install static network config if the var is set # and this is not an upgrade test (this is done elsewhere in the # upgrade workflow) diff --git a/tests/_staging_repos_disable.pm b/tests/_staging_repos_disable.pm new file mode 100644 index 00000000..6cbe8b8f --- /dev/null +++ b/tests/_staging_repos_disable.pm @@ -0,0 +1,23 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +sub run { + my $self = shift; + $self->root_console(tty=>4); + # Point at default repositories by modifying contentdir + # NOTE: This will leave repos pointing at primary dl server instead + # of mirrorlist. + script_run 'printf "pub/rocky\n" > /etc/dnf/vars/contentdir'; + script_run 'dnf clean all'; + script_run 'dnf repoinfo' +} + +sub test_flags { + return { fatal => 1 }; +} + +1; + +# vim: set sw=4 et: diff --git a/tests/_staging_repos_enable.pm b/tests/_staging_repos_enable.pm new file mode 100644 index 00000000..4acd328f --- /dev/null +++ b/tests/_staging_repos_enable.pm @@ -0,0 +1,25 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +sub run { + my $self = shift; + $self->root_console(tty=>4); + # Point at staging repositories by modifying contentdir + if (get_version_major() < 9) { + script_run "sed -i 's/^mirrorlist/#mirrorlist/g' /etc/yum.repos.d/Rocky-*"; + script_run "sed -i 's,^#\(baseurl=http[s]*://\),\1,g' /etc/yum.repos.d/Rocky-*"; + } + script_run 'printf "stg/rocky\n" > /etc/dnf/vars/contentdir'; + script_run 'dnf clean all'; + script_run 'dnf repoinfo'; +} + +sub test_flags { + return { fatal => 1 }; +} + +1; + +# vim: set sw=4 et: