1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-12-04 11:03:11 +00:00
os-autoinst-distri-fedora/tests/_support_server.pm
Adam Williamson 79518c5d33 Split PXE server out from support_server
Similar to how we split out iSCSI server, and for the same
purpose. This drops two tests from the cluster on x86_64, the
BIOS and UEFI tests.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2020-11-18 15:38:34 -08:00

80 lines
2.8 KiB
Perl

use base "installedtest";
use strict;
use testapi;
use lockapi;
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
# create the file share
assert_script_run "mkdir -p /export";
# get the kickstart
assert_script_run "curl -o /export/root-user-crypted-net.ks https://jskladan.fedorapeople.org/kickstarts/root-user-crypted-net.ks";
# for update tests, set up the update repository and export it
if (get_var("ADVISORY_OR_TASK")) {
assert_script_run "echo '/opt/update_repo 172.16.2.0/24(ro)' >> /etc/exports";
}
# for compose tests, we do all this stuff
else {
# create the repo share
assert_script_run "mkdir -p /repo";
# create a mount point for the ISO
assert_script_run "mkdir -p /mnt/iso";
# mount the ISO there
assert_script_run "mount /dev/cdrom /mnt/iso";
# copy the contents of the ISO to the repo share
assert_script_run "dnf -y install rsync", 180;
assert_script_run "rsync -av /mnt/iso/ /repo", 180;
# put the updates image in the NFS repo (for testing this update
# image delivery method)
assert_script_run "curl -o /repo/images/updates.img https://fedorapeople.org/groups/qa/updates/updates-openqa.img";
# create the iso share
assert_script_run "mkdir -p /iso";
# recreate an iso file
copy_devcdrom_as_isofile('/iso/image.iso');
# set up the exports
assert_script_run "printf '/export 172.16.2.0/24(ro)\n/repo 172.16.2.0/24(ro)\n/iso 172.16.2.0/24(ro)' > /etc/exports";
}
# open firewall port
assert_script_run "firewall-cmd --add-service=nfs";
# start the server
assert_script_run "systemctl restart nfs-server.service";
assert_script_run "systemctl is-active nfs-server.service";
# report ready, wait for children
mutex_create('support_ready');
wait_for_children;
# upload logs in case of child failures
$self->post_fail_hook();
}
sub test_flags {
return { fatal => 1 };
}
1;
# vim: set sw=4 et: