diff --git a/lib/anacondatest.pm b/lib/anacondatest.pm index a6b0d6cc..01802716 100644 --- a/lib/anacondatest.pm +++ b/lib/anacondatest.pm @@ -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: diff --git a/main.pm b/main.pm index 0dc98883..dc60d639 100644 --- a/main.pm +++ b/main.pm @@ -125,11 +125,12 @@ sub load_install_tests() { } ## Installation source - if (get_var('MIRRORLIST_GRAPHICAL') || get_var("REPOSITORY_GRAPHICAL")){ + 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')) { diff --git a/needles/anaconda/install_source/http_selected-cantarell17.json b/needles/anaconda/install_source/http_selected-cantarell17.json index 1e978167..af8dbfad 100644 --- a/needles/anaconda/install_source/http_selected-cantarell17.json +++ b/needles/anaconda/install_source/http_selected-cantarell17.json @@ -1,6 +1,6 @@ { "tags": [ - "anaconda_install_source_http_selected", + "anaconda_install_source_selected", "ENV-DISTRI-fedora", "ENV-FLAVOR-server" ], diff --git a/needles/anaconda/install_source/http_selected-cantarell20.json b/needles/anaconda/install_source/http_selected-cantarell20.json index 9ad9bd46..1651c2d9 100644 --- a/needles/anaconda/install_source/http_selected-cantarell20.json +++ b/needles/anaconda/install_source/http_selected-cantarell20.json @@ -17,7 +17,7 @@ } ], "tags": [ - "anaconda_install_source_http_selected", + "anaconda_install_source_selected", "ENV-DISTRI-fedora", "ENV-FLAVOR-server" ] diff --git a/needles/anaconda/install_source/http_selected-freetype262.json b/needles/anaconda/install_source/http_selected-freetype262.json index 0ce79d1e..9a242760 100644 --- a/needles/anaconda/install_source/http_selected-freetype262.json +++ b/needles/anaconda/install_source/http_selected-freetype262.json @@ -16,7 +16,7 @@ } ], "tags": [ - "anaconda_install_source_http_selected", + "anaconda_install_source_selected", "ENV-DISTRI-fedora", "ENV-FLAVOR-server" ], diff --git a/needles/anaconda/install_source/http_selected.json b/needles/anaconda/install_source/http_selected.json index 4348fff6..050fa7fa 100644 --- a/needles/anaconda/install_source/http_selected.json +++ b/needles/anaconda/install_source/http_selected.json @@ -1,7 +1,7 @@ { "properties": [], "tags": [ - "anaconda_install_source_http_selected", + "anaconda_install_source_selected", "ENV-DISTRI-fedora", "ENV-FLAVOR-server" ], diff --git a/needles/anaconda/install_source/https_selected.json b/needles/anaconda/install_source/https_selected.json index 716cce41..f4a8fb71 100644 --- a/needles/anaconda/install_source/https_selected.json +++ b/needles/anaconda/install_source/https_selected.json @@ -1,7 +1,7 @@ { "properties": [], "tags": [ - "anaconda_install_source_http_selected", + "anaconda_install_source_selected", "ENV-DISTRI-fedora", "ENV-FLAVOR-server" ], diff --git a/needles/anaconda/install_source/nfs_selected.json b/needles/anaconda/install_source/nfs_selected.json new file mode 100644 index 00000000..f91fe686 --- /dev/null +++ b/needles/anaconda/install_source/nfs_selected.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/needles/anaconda/install_source/nfs_selected.png b/needles/anaconda/install_source/nfs_selected.png new file mode 100644 index 00000000..7a25f77e Binary files /dev/null and b/needles/anaconda/install_source/nfs_selected.png differ diff --git a/templates b/templates index dfb0b1e0..f2b82d7e 100755 --- a/templates +++ b/templates @@ -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" }, + ], + }, ], } diff --git a/tests/_boot_to_anaconda.pm b/tests/_boot_to_anaconda.pm index 53c0442a..afd2c3c8 100644 --- a/tests/_boot_to_anaconda.pm +++ b/tests/_boot_to_anaconda.pm @@ -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; diff --git a/tests/_check_install_source.pm b/tests/_check_install_source.pm new file mode 100644 index 00000000..c90e0a25 --- /dev/null +++ b/tests/_check_install_source.pm @@ -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: diff --git a/tests/_support_server_postinstall.pm b/tests/_support_server_postinstall.pm index d06af0b1..7753bbf5 100644 --- a/tests/_support_server_postinstall.pm +++ b/tests/_support_server_postinstall.pm @@ -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 '\n backing-store /dev/vdb\n' > /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; diff --git a/tests/install_source_graphical.pm b/tests/install_source_graphical.pm index 7b41309a..a9bb8c52 100644 --- a/tests/install_source_graphical.pm +++ b/tests/install_source_graphical.pm @@ -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 @@ -25,15 +30,17 @@ 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'); + if (get_var("MIRRORLIST_GRAPHICAL")) { + $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"; + elsif (get_var("REPOSITORY_GRAPHICAL")) { + $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 { diff --git a/tests/install_source_variation.pm b/tests/install_source_variation.pm deleted file mode 100644 index c90fa22c..00000000 --- a/tests/install_source_variation.pm +++ /dev/null @@ -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: