diff --git a/lib/utils.pm b/lib/utils.pm index eee519af..6e855bc5 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -7,7 +7,7 @@ use Exporter; use lockapi; use testapi; -our @EXPORT = qw/run_with_error_check type_safely type_very_safely desktop_vt boot_to_login_screen console_login console_switch_layout desktop_switch_layout console_loadkeys_us do_bootloader boot_decrypt check_release menu_launch_type repo_setup setup_workaround_repo cleanup_workaround_repo console_initial_setup gnome_initial_setup anaconda_create_user check_desktop download_modularity_tests quit_firefox advisory_get_installed_packages advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut lo_dismiss_tip disable_firefox_studies select_rescue_mode copy_devcdrom_as_isofile bypass_1691487 get_release_number check_left_bar check_top_bar check_prerelease check_version spell_version_number _assert_and_click is_branched rec_log click_unwanted_notifications repos_mirrorlist register_application get_registered_applications solidify_wallpaper/; +our @EXPORT = qw/run_with_error_check type_safely type_very_safely desktop_vt boot_to_login_screen console_login console_switch_layout desktop_switch_layout console_loadkeys_us do_bootloader boot_decrypt check_release menu_launch_type repo_setup setup_workaround_repo cleanup_workaround_repo console_initial_setup gnome_initial_setup anaconda_create_user check_desktop download_modularity_tests quit_firefox advisory_get_installed_packages advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut lo_dismiss_tip disable_firefox_studies select_rescue_mode copy_devcdrom_as_isofile bypass_1691487 get_release_number check_left_bar check_top_bar check_prerelease check_version spell_version_number _assert_and_click is_branched rec_log click_unwanted_notifications repos_mirrorlist register_application get_registered_applications solidify_wallpaper setup_dhcp_server/; # We introduce this global variable to hold the list of applications that have # registered during the apps_startstop_test when they have sucessfully run. @@ -1387,4 +1387,24 @@ sub solidify_wallpaper { } } +# Shared by some of the support tests that need to act as DHCP/DNS +sub setup_dhcp_server { + # disable systemd-resolved, it conflicts with dnsmasq + unless (script_run "systemctl is-active systemd-resolved.service") { + script_run "systemctl stop systemd-resolved.service"; + script_run "systemctl disable systemd-resolved.service"; + script_run "rm -f /etc/resolv.conf"; + script_run "systemctl restart NetworkManager"; + } + ## DNS / DHCP (dnsmasq) + # create config + assert_script_run "printf 'domain=domain.local\ndhcp-range=172.16.2.150,172.16.2.199\ndhcp-option=option:router,172.16.2.2\n' > /etc/dnsmasq.conf"; + # open firewall ports + assert_script_run "firewall-cmd --add-service=dhcp"; + assert_script_run "firewall-cmd --add-service=dns"; + # start server + assert_script_run "systemctl restart dnsmasq.service"; + assert_script_run "systemctl is-active dnsmasq.service"; +} + 1; diff --git a/tests/_nfs_server.pm b/tests/_nfs_server.pm index 66c2c071..a051482f 100644 --- a/tests/_nfs_server.pm +++ b/tests/_nfs_server.pm @@ -6,27 +6,9 @@ use mmapi; use utils; sub run { - my $self=shift; - # disable systemd-resolved, it conflicts with dnsmasq - unless (script_run "systemctl is-active systemd-resolved.service") { - script_run "systemctl stop systemd-resolved.service"; - script_run "systemctl disable systemd-resolved.service"; - script_run "rm -f /etc/resolv.conf"; - script_run "systemctl restart NetworkManager"; - } - ## DNS / DHCP (dnsmasq) - # create config - assert_script_run "printf 'domain=domain.local\ndhcp-range=172.16.2.150,172.16.2.199\ndhcp-option=option:router,172.16.2.2\n' > /etc/dnsmasq.conf"; - # open firewall ports - assert_script_run "firewall-cmd --add-service=dhcp"; - assert_script_run "firewall-cmd --add-service=dns"; - # start server - assert_script_run "systemctl restart dnsmasq.service"; - assert_script_run "systemctl is-active dnsmasq.service"; - - - ## NFS - + my $self = shift; + # set up as a DHCP/DNS server + setup_dhcp_server; # create the file share assert_script_run "mkdir -p /export"; # get the kickstart diff --git a/tests/_pxe_server.pm b/tests/_pxe_server.pm index 7f4219e6..da3e5ba4 100644 --- a/tests/_pxe_server.pm +++ b/tests/_pxe_server.pm @@ -7,7 +7,9 @@ use utils; sub run { my $self = shift; - # set up PXE server (via dnsmasq) + # set up as a DHCP/DNS server + setup_dhcp_server; + # set up as a PXE server (via dnsmasq) # don't get hung up on slow mirrors when DNFing... repos_mirrorlist; # create necessary dirs