add NFS tests (and DHCP/DNS in the support server)

Summary:
Set up the support server to provide DHCP/DNS functionality and
an NFS server, providing a kickstart. Add a kickstart test just
like the other root-user-crypted-net kickstart tests except it
gets the kickstart from the support server via NFS. Also add NFS
repository tests and a second support server for Server-dvd-iso
flavor: this test must run on that flavor to ensure that packages
are actually available. The support server just mounts the
attached 'DVD' and exports it via NFS.

Note we don't need to do anything clever to avoid IP conflicts
between the two support servers, because os-autoinst-openvswitch
ensures each worker group is on its own VLAN.

As part of adding the NFS repo tests, I did a bit of cleanup,
moving little things we were repeating a lot into anacondatest,
and sharing the 'check if the repo was used' logic between all
the tests (by making it into a test step that's loaded for all
of them). I also simplified the 'was repo used' checks a bit,
it seems silly to run a 'grep' command inside the VM then have
os-autoinst do a grep on the output (which is effectively what
we were doing before), instead we'll just use a single grep
within the VM, and clean up the messy quoting/escaping a bit.

Test Plan:
Run all tests - at least all repository tests - and
check they work (make sure the tests are actually still sane,
not just that they pass). I've done runs of all the repo tests
and they look good to me, but please double-check. I'm currently
re-running the whole 24-20160609.n.0 test on staging with these
changes.

Reviewers: jskladan, garretraziel

Reviewed By: garretraziel

Subscribers: tflink

Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D888
This commit is contained in:
Adam Williamson 2016-06-13 08:42:30 -07:00
parent 7a8ae3a357
commit 0da6652287
15 changed files with 215 additions and 65 deletions

View File

@ -192,6 +192,21 @@ sub switch_layout {
assert_screen "anaconda_layout_$layout", 3;
}
sub get_full_repo {
my ($self, $repourl) = @_;
# trivial thing we kept repeating: fill out an HTTP or HTTPS
# repo URL with flavor and arch, leave NFS ones alone (as for
# NFS tests we just use a mounted ISO and the URL is complete)
if ($repourl !~ m/^nfs/) {
$repourl .= "/".lc(get_var("VERSION"))."/Everything/".get_var("ARCH")."/os";
}
return $repourl;
}
sub get_mirrorlist_url {
return "mirrors.fedoraproject.org/mirrorlist?repo=fedora-" . lc(get_var("VERSION")) . "&arch=" . get_var('ARCH')
}
1;
# vim: set sw=4 et:

View File

@ -127,9 +127,10 @@ sub load_install_tests() {
## Installation source
if (get_var('MIRRORLIST_GRAPHICAL') || get_var("REPOSITORY_GRAPHICAL")) {
autotest::loadtest "tests/install_source_graphical.pm";
autotest::loadtest "tests/_check_install_source.pm";
}
if (get_var("REPOSITORY_VARIATION")){
autotest::loadtest "tests/install_source_variation.pm";
autotest::loadtest "tests/_check_install_source.pm";
}
if (get_var('LIVE')) {

View File

@ -1,6 +1,6 @@
{
"tags": [
"anaconda_install_source_http_selected",
"anaconda_install_source_selected",
"ENV-DISTRI-fedora",
"ENV-FLAVOR-server"
],

View File

@ -17,7 +17,7 @@
}
],
"tags": [
"anaconda_install_source_http_selected",
"anaconda_install_source_selected",
"ENV-DISTRI-fedora",
"ENV-FLAVOR-server"
]

View File

@ -16,7 +16,7 @@
}
],
"tags": [
"anaconda_install_source_http_selected",
"anaconda_install_source_selected",
"ENV-DISTRI-fedora",
"ENV-FLAVOR-server"
],

View File

@ -1,7 +1,7 @@
{
"properties": [],
"tags": [
"anaconda_install_source_http_selected",
"anaconda_install_source_selected",
"ENV-DISTRI-fedora",
"ENV-FLAVOR-server"
],

View File

@ -1,7 +1,7 @@
{
"properties": [],
"tags": [
"anaconda_install_source_http_selected",
"anaconda_install_source_selected",
"ENV-DISTRI-fedora",
"ENV-FLAVOR-server"
],

View File

@ -0,0 +1,22 @@
{
"properties": [],
"tags": [
"anaconda_install_source_selected"
],
"area": [
{
"xpos": 57,
"ypos": 224,
"width": 23,
"height": 14,
"type": "match"
},
{
"xpos": 148,
"ypos": 227,
"width": 14,
"height": 10,
"type": "match"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View File

@ -303,6 +303,39 @@
},
test_suite => { name => "install_package_set_minimal" },
},
{
machine => { name => "64bit" },
prio => 10,
product => {
arch => "x86_64",
distri => "fedora",
flavor => "Server-dvd-iso",
version => "*",
},
test_suite => { name => "support_server" },
},
{
machine => { name => "64bit" },
prio => 30,
product => {
arch => "x86_64",
distri => "fedora",
flavor => "Server-dvd-iso",
version => "*",
},
test_suite => { name => "install_repository_nfs_variation" },
},
{
machine => { name => "64bit" },
prio => 30,
product => {
arch => "x86_64",
distri => "fedora",
flavor => "Server-dvd-iso",
version => "*",
},
test_suite => { name => "install_repository_nfs_graphical" },
},
{
machine => { name => "64bit" },
prio => 40,
@ -886,6 +919,17 @@
},
test_suite => { name => "install_kickstart_firewall_configured" },
},
{
machine => { name => "64bit" },
prio => 40,
product => {
arch => "x86_64",
distri => "fedora",
flavor => "universal",
version => "*",
},
test_suite => { name => "install_kickstart_nfs" },
},
{
machine => { name => "64bit" },
prio => 40,
@ -1285,7 +1329,7 @@
name => "support_server",
settings => [
{ key => "NUMDISKS", value => "2" },
{ key => "HDD_1", value => "disk_f%CURRREL%_support_x86_64.img" },
{ key => "HDD_1", value => "disk_f%CURRREL%_support_2_x86_64.img" },
{ key => "POSTINSTALL", value => "_support_server" },
{ key => "USER_LOGIN", value => "false" },
{ key => "ROOT_PASSWORD", value => "weakpassword" },
@ -1373,12 +1417,32 @@
{ key => "REPOSITORY_GRAPHICAL", value => "http://dl.fedoraproject.org/pub/fedora/linux/development" },
],
},
{
name => "install_repository_nfs_graphical",
settings => [
{ key => "REPOSITORY_GRAPHICAL", value => "nfs:10.0.2.110:/repo" },
{ key => "PARALLEL_WITH", value => "support_server" },
{ key => "INSTALL_UNLOCK", value => "support_ready" },
{ key => "NICTYPE", value => "tap" },
{ key => "WORKER_CLASS", value => "tap" },
],
},
{
name => "install_repository_http_variation",
settings => [
{ key => "REPOSITORY_VARIATION", value => "http://dl.fedoraproject.org/pub/fedora/linux/development" },
],
},
{
name => "install_repository_nfs_variation",
settings => [
{ key => "REPOSITORY_VARIATION", value => "nfs:10.0.2.110:/repo" },
{ key => "PARALLEL_WITH", value => "support_server" },
{ key => "INSTALL_UNLOCK", value => "support_ready" },
{ key => "NICTYPE", value => "tap" },
{ key => "WORKER_CLASS", value => "tap" },
],
},
{
name => "install_delete_partial",
settings => [
@ -1785,5 +1849,18 @@
{ key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" },
],
},
{
name => "install_kickstart_nfs",
settings => [
{ key => "KICKSTART", value => "1" },
{ key => "GRUB", value => "inst.ks=nfs:10.0.2.110:/export/root-user-crypted-net.ks" },
{ key => "USER_LOGIN", value => "false" },
{ key => "ROOT_PASSWORD", value => "111111" },
{ key => "PARALLEL_WITH", value => "support_server" },
{ key => "INSTALL_UNLOCK", value => "support_ready" },
{ key => "NICTYPE", value => "tap" },
{ key => "WORKER_CLASS", value => "tap" },
],
},
],
}

View File

@ -14,10 +14,7 @@ sub run {
# Construct inst.repo arg for REPOSITORY_VARIATION
my $repourl = get_var("REPOSITORY_VARIATION");
if ($repourl) {
my $version = lc(get_var("VERSION", ""));
my $arch = get_var("ARCH", "");
$repourl .= "/$version/Everything/$arch/os";
$params .= "inst.repo=$repourl";
$params .= "inst.repo=" . $self->get_full_repo($repourl);
}
# ternary: set $params to "" if it contains only spaces
$params = $params =~ /^\s+$/ ? "" : $params;

View File

@ -0,0 +1,43 @@
use base "anacondatest";
use strict;
use testapi;
sub run {
my $self = shift;
my $repourl;
if (get_var("MIRRORLIST_GRAPHICAL")) {
$repourl = $self->get_mirrorlist_url();
}
else {
$repourl = get_var("REPOSITORY_VARIATION", get_var("REPOSITORY_GRAPHICAL"));
$repourl = $self->get_full_repo($repourl);
}
# check that the repo was used
$self->root_console;
if ($repourl =~ s/^nfs://) {
# the above both checks if we're dealing with an NFS URL, and
# strips the 'nfs:' from it if so
assert_script_run "grep 'mounting ${repourl}' /tmp/packaging.log";
}
else {
assert_script_run "grep \"added repo: 'anaconda'.*${repourl}\" /tmp/packaging.log";
}
send_key "ctrl-alt-f6";
# Anaconda hub
assert_screen "anaconda_main_hub", 30; #
}
sub test_flags {
# without anything - rollback to 'lastgood' snapshot if failed
# 'fatal' - whole test suite is in danger if this fails
# 'milestone' - after this test succeeds, update 'lastgood'
# 'important' - if this fails, set the overall state to 'fail'
return { fatal => 1 };
}
1;
# vim: set sw=4 et:

View File

@ -13,12 +13,44 @@ sub run {
# set up networking
$self->setup_tap_static("10.0.2.110", "support.domain.local");
$self->clone_host_file("/etc/resolv.conf");
## DNS / DHCP (dnsmasq)
# create config
assert_script_run "printf 'domain=domain.local\ndhcp-range=10.0.2.112,10.0.2.199\ndhcp-option=option:router,10.0.2.2' > /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";
## ISCSI
# start up iscsi target
assert_script_run "printf '<target iqn.2016-06.local.domain:support.target1>\n backing-store /dev/vdb\n</target>' > /etc/tgt/conf.d/openqa.conf";
# open firewall port
assert_script_run "firewall-cmd --add-service=iscsi-target";
assert_script_run "systemctl start tgtd.service";
assert_script_run 'systemctl is-active tgtd.service';
assert_script_run "systemctl restart tgtd.service";
assert_script_run "systemctl is-active tgtd.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";
# create the repo share
assert_script_run "mkdir -p /repo";
# mount the ISO there
assert_script_run "mount /dev/cdrom /repo";
# set up the exports
assert_script_run "printf '/export 10.0.2.0/24(ro)\n/repo 10.0.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;

View File

@ -10,13 +10,18 @@ sub run {
# Go into the Install Source spoke
assert_and_click "anaconda_main_hub_installation_source";
# select "http" on the network
# select appropriate protocol on the network
assert_and_click "anaconda_install_source_on_the_network";
send_key "tab";
for (my $i=0; $i<4; $i++){
# if we have an NFS repo select NFS (one 'up'), otherwise HTTP (four 'ups')
my $num;
$num = get_var("REPOSITORY_GRAPHICAL") =~ m/^nfs:/ ? 1 : 4;
for (my $i=0; $i<$num; $i++){
send_key "up";
}
assert_screen "anaconda_install_source_http_selected";
# let's just accept either NFS or HTTP here, if it's the wrong one the
# test will fail soon anyhow
assert_screen "anaconda_install_source_selected";
# insert the url
@ -26,14 +31,16 @@ sub run {
# if either MIRRORLIST_GRAPHICAL or REPOSITORY_GRAPHICAL is set, type this into
# the repository url input
if (get_var("MIRRORLIST_GRAPHICAL")) {
$repourl = "mirrors.fedoraproject.org/mirrorlist?repo=fedora-".lc(get_var("VERSION"))."&arch=".get_var('ARCH');
$repourl = $self->get_mirrorlist_url();
type_string $repourl;
# select as mirror list
assert_and_click "anaconda_install_source_repo_select_mirrorlist";
}
elsif (get_var("REPOSITORY_GRAPHICAL")) {
$repourl = get_var("REPOSITORY_GRAPHICAL")."/".lc(get_var("VERSION"))."/Everything/".get_var("ARCH")."/os";
$repourl = $self->get_full_repo(get_var("REPOSITORY_GRAPHICAL"));
# strip the 'nfs:' for typing here
$repourl =~ s/^nfs://;
type_string $repourl;
}
@ -41,15 +48,6 @@ sub run {
# Anaconda hub
assert_screen "anaconda_main_hub", 300;
# check that the repo was used
$self->root_console;
validate_script_output "grep \"".$repourl."\" /tmp/packaging.log", sub { $_ =~ m/added repo: 'anaconda'/ };
send_key "ctrl-alt-f6";
# Anaconda hub
assert_screen "anaconda_main_hub", 30; #
}
sub test_flags {

View File

@ -1,35 +0,0 @@
use base "anacondatest";
use strict;
use testapi;
sub run {
# !!! GRUB parameter is set in _boot_to_anaconda.pm !!!
my $self = shift;
# Anaconda hub
assert_screen "anaconda_main_hub";
my $repourl = "";
$repourl = get_var("REPOSITORY_VARIATION")."/".lc(get_var("VERSION"))."/Everything/".get_var("ARCH")."/os";
# check that the repo was used
$self->root_console;
validate_script_output "grep \"".$repourl."\" /tmp/packaging.log", sub { $_ =~ m/added repo: 'anaconda'/ };
send_key "ctrl-alt-f6";
# Anaconda hub
assert_screen "anaconda_main_hub", 30; #
}
sub test_flags {
# without anything - rollback to 'lastgood' snapshot if failed
# 'fatal' - whole test suite is in danger if this fails
# 'milestone' - after this test succeeds, update 'lastgood'
# 'important' - if this fails, set the overall state to 'fail'
return { fatal => 1 };
}
1;
# vim: set sw=4 et: