From eb70ce8dae2e8e73f5ca3acd093306635eefa2d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20R=C5=AF=C5=BEi=C4=8Dka?= Date: Tue, 27 Jan 2026 14:00:20 +0100 Subject: [PATCH] Create a basic networking test --- templates.fif.json | 31 +++++++++++++ tests/basic_networking_client.pm | 61 ++++++++++++++++++++++++++ tests/basic_networking_server.pm | 75 ++++++++++++++++++++++++++++++++ 3 files changed, 167 insertions(+) create mode 100644 tests/basic_networking_client.pm create mode 100644 tests/basic_networking_server.pm diff --git a/templates.fif.json b/templates.fif.json index 15b59b6e..5580915f 100644 --- a/templates.fif.json +++ b/templates.fif.json @@ -769,6 +769,37 @@ "USER_LOGIN": "false" } }, + "basic_networking_server": { + "profile_groups": { + "server-dvd-4arch": 30 + }, + "settings": { + "BOOTFROM": "c", + "HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2", + "NICTYPE": "tap", + "POSTINSTALL": "basic_networking_server", + "POST_STATIC": "172.16.2.118 bserver.test.openqa.fedoraproject.org", + "ROOT_PASSWORD": "weakpassword", + "START_AFTER_TEST": "%DEPLOY_UPLOAD_TEST%", + "WORKER_CLASS": "tap" + } + }, + "basic_networking_client": { + "profile_groups": { + "server-dvd-4arch": 30 + }, + "settings": { + "BOOTFROM": "c", + "HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2", + "NICTYPE": "tap", + "POSTINSTALL": "basic_networking_client", + "PARALLEL_WITH": "basic_networking_server", + "POST_STATIC": "172.16.2.119 bclient.test.openqa.fedoraproject.org", + "ROOT_PASSWORD": "weakpassword", + "START_AFTER_TEST": "%DEPLOY_UPLOAD_TEST%", + "WORKER_CLASS": "tap" + } + }, "check_packages_signed": { "profile_groups": { "base-tests-atomic": 10 diff --git a/tests/basic_networking_client.pm b/tests/basic_networking_client.pm new file mode 100644 index 00000000..13150c50 --- /dev/null +++ b/tests/basic_networking_client.pm @@ -0,0 +1,61 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; +use mmapi; +use lockapi; + +# This test uses a Connections application to establish an +# RDP connection to a remote computer running Gnome Workstation. + +sub run { + my $self = shift; + my $password = get_var("USER_PASSWORD", "weakpassword"); + my $rdpuser = get_var("RDP_USER", "geralt"); + my $rdppass = get_var("RDP_PASS", "ciriofcintra"); + my $ip = get_var("RDP_SERVER_IP", "172.16.2.116"); + + # Wait until the RDP server is ready + # and lock parallel connection. + mutex_lock("kaermorhen_opened"); + + # Unlock the session if it has locked in the meantime. + if (check_screen("panel_screen_locked")) { + send_key("up"); + sleep(1); + type_very_safely("$password\n"); + } + + # Open the Connections and start the connection. + connections_connect($ip, $rdpuser, $rdppass); + # we should arrive at the login screen, so login + assert_screen("login_screen"); + wait_still_screen 3; + send_key_until_needlematch("graphical_login_input", "ret", 3, 5); + type_very_safely("$password\n"); + assert_screen(["auth_required_password", "apps_menu_button_active"]); + + # When SELinux is on, the authentication dialog has appeared. + # Wait for it a minute and deal it away. + if (match_has_tag("auth_required_password")) { + type_very_safely("$password\n"); + assert_screen("apps_menu_button_active"); + } + + # Start the terminal + wait_still_screen(3); + type_very_safely("terminal\n"); + + # Check that we are on the correct computer. + # We can tell from the terminal prompt. + assert_screen("desktop_connected"); + + # Unlock the parallel connection + mutex_unlock("kaermorhen_opened"); +} + +sub test_flags { + return {fatal => 1, milestone => 1}; +} +1; +# vim: set sw=4 et: diff --git a/tests/basic_networking_server.pm b/tests/basic_networking_server.pm new file mode 100644 index 00000000..7e27ff4d --- /dev/null +++ b/tests/basic_networking_server.pm @@ -0,0 +1,75 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; +use lockapi; +use mmapi; + +sub run { + my $self = shift; + my $password = get_var("USER_PASSWORD", "weakpassword"); + my $rdpuser = get_var("RDP_USER", "geralt"); + my $rdppass = get_var("RDP_PASS", "ciriofcintra"); + + $self->root_console(tty => 3); + # Make necessary settings for the RDP server. + + # firewall: check whether the RDP port (3389) is allowed directly + # or via the rdp service + if (script_run('firewall-cmd --query-port 3389/tcp') != 0 && script_run('firewall-cmd --query-service rdp') != 0) { + # If not, let's open the port manually and softfail the test + # (we expect the port to be open by default) + assert_script_run("firewall-cmd --add-port=3389/tcp"); + record_soft_failure("The RDP port was not opened, we had to open it manually."); + } + + # Change to Desktop + desktop_vt(); + + # Open Settings and navigate to Remote Login + menu_launch_type("Settings"); + send_key("ctrl-f"); + wait_still_screen(2); + type_very_safely("system"); + assert_and_click("settings_system"); + assert_and_click("settings_remote_desktop"); + assert_and_click("settings_remote_login"); + assert_and_click("gnome_button_unlock"); + assert_screen("auth_required_password", timeout => 60); + type_very_safely("$password\n"); + + # Set up remote login in Gnome Settings. + assert_and_click("settings_switch_remote"); + wait_still_screen(3); + assert_and_click("settings_remote_username"); + type_very_safely($rdpuser); + assert_and_click("settings_remote_password"); + type_very_safely($rdppass); + assert_and_click("gnome_reveal_password"); + wait_still_screen(3); + assert_and_click("settings_button_back"); + send_key("alt-f4"); + + # RDP does not allow connections when the user is still logged in + # locally, so let's reboot the machine to start from anew. + reboot_system(); + + + # Check that the service is running. If the service was not running, + # let's record a soft failure and start the RDP service. + $self->root_console(tty => 3); + if (script_run("systemctl is-active --quiet gnome-remote-desktop")) { + record_soft_failure("The Gnome Remote Desktop service is not running, we had to start it manually."); + assert_script_run("systemctl enable --now gnome-remote-desktop"); + } + + # Create mutex to synchronise with the children. + mutex_create("kaermorhen_opened"); + wait_for_children(); +} + +sub test_flags { + return {fatal => 1}; +} +1; +# vim: set sw=4 et: