1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-12-11 05:43:11 +00:00
os-autoinst-distri-fedora/tests/_nfs_server.pm
Adam Williamson c645d0da88 Share DNS/DHCP server setup between nfs and pxe servers
They both need to be DNS/DHCP servers, I think, so split the
code into a shared function.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2020-11-18 16:07:22 -08:00

62 lines
2.1 KiB
Perl

use base "installedtest";
use strict;
use testapi;
use lockapi;
use mmapi;
use utils;
sub run {
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
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('nfs_server_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: