From 57ac40a495c9bc9b87a4332390fe00b37974b414 Mon Sep 17 00:00:00 2001 From: Dominik Gedon Date: Tue, 17 Oct 2023 17:12:27 +0200 Subject: [PATCH] QE: Fix server hostname rename test Signed-off-by: Dominik Gedon --- testsuite/.rubocop_todo.yml | 1 + .../secondary/srv_rename_hostname.feature | 84 +++++++++++++++++++ .../step_definitions/command_steps.rb | 11 --- .../features/step_definitions/salt_steps.rb | 11 +++ 4 files changed, 96 insertions(+), 11 deletions(-) diff --git a/testsuite/.rubocop_todo.yml b/testsuite/.rubocop_todo.yml index 778958c7ae13..7eda687fb5c2 100644 --- a/testsuite/.rubocop_todo.yml +++ b/testsuite/.rubocop_todo.yml @@ -342,6 +342,7 @@ Style/AndOr: - 'features/step_definitions/common_steps.rb' - 'features/step_definitions/file_management_steps.rb' - 'features/step_definitions/retail_steps.rb' + - 'features/step_definitions/salt_steps.rb' - 'features/step_definitions/setup_steps.rb' # Offense count: 1 diff --git a/testsuite/features/secondary/srv_rename_hostname.feature b/testsuite/features/secondary/srv_rename_hostname.feature index 08acb7e2575f..27b294e3692b 100644 --- a/testsuite/features/secondary/srv_rename_hostname.feature +++ b/testsuite/features/secondary/srv_rename_hostname.feature @@ -21,6 +21,48 @@ Feature: Reconfigure the server's hostname When I change the server's short hostname from hosts and hostname files And I run spacewalk-hostname-rename command on the server +@proxy + Scenario: Copy the new server keys and configure the proxy + When I copy server's keys to the proxy + And I configure the proxy + Then I should see "proxy" via spacecmd + And I restart the "salt-minion" service on "proxy" + Then service "salt-minion" is active on "proxy" + And I restart the "salt-broker" service on "proxy" + Then service "salt-broker" is active on "proxy" + +@proxy + Scenario: Apply high state on the proxy to populate new server CA + When I apply highstate on "proxy" + +@sle_minion + Scenario: Apply high state on the SUSE Minion to populate new server CA + When I apply highstate on "sle_minion" + +@ssh_minion + Scenario: Apply high state on the SUSE SSH Minion to populate new server CA + When I apply highstate on "ssh_minion" + +@rhlike_minion + Scenario: Apply high state on the Red Hat-like Minion to populate new server CA + When I apply highstate on "rhlike_minion" + +@deblike_minion + Scenario: Apply high state on the Debian-like Minion to populate new server CA + When I apply highstate on "deblike_minion" + +@buildhost + Scenario: Apply high state on the build host to populate new server CA + When I apply highstate on "build_host" + +@virthost_kvm + Scenario: Apply high state on the virthost to populate new server CA + When I apply highstate on "kvm_server" + +@pxeboot_minion + Scenario: Apply high state on the PXE boot minion to populate new server CA + When I apply highstate on "pxeboot_minion" + Scenario: Do some minimal smoke test on the renamed server Given I am on the Systems overview page of this "sle_minion" When I follow "Details" in the content area @@ -40,3 +82,45 @@ Feature: Reconfigure the server's hostname Scenario: Change hostname back and reboot server When I change back the server's hostname And I run spacewalk-hostname-rename command on the server + +@proxy + Scenario: Copy the new server keys and configure the proxy + When I copy server's keys to the proxy + And I configure the proxy + Then I should see "proxy" via spacecmd + And I restart the "salt-minion" service on "proxy" + Then service "salt-minion" is active on "proxy" + And I restart the "salt-broker" service on "proxy" + Then service "salt-broker" is active on "proxy" + +@proxy + Scenario: Apply high state on the proxy to populate new server CA + When I apply highstate on "proxy" + +@sle_minion + Scenario: Apply high state on the SUSE Minion to populate new server CA + When I apply highstate on "sle_minion" + +@ssh_minion + Scenario: Apply high state on the SUSE SSH Minion to populate new server CA + When I apply highstate on "ssh_minion" + +@rhlike_minion + Scenario: Apply high state on the Red Hat-like Minion to populate new server CA + When I apply highstate on "rhlike_minion" + +@deblike_minion + Scenario: Apply high state on the Debian-like Minion to populate new server CA + When I apply highstate on "deblike_minion" + +@buildhost + Scenario: Apply high state on the build host to populate new server CA + When I apply highstate on "build_host" + +@virthost_kvm + Scenario: Apply high state on the virthost to populate new server CA + When I apply highstate on "kvm_server" + +@pxeboot_minion + Scenario: Apply high state on the PXE boot minion to populate new server CA + When I apply highstate on "pxeboot_minion" diff --git a/testsuite/features/step_definitions/command_steps.rb b/testsuite/features/step_definitions/command_steps.rb index b2bb6d284a5b..062d9561a88f 100644 --- a/testsuite/features/step_definitions/command_steps.rb +++ b/testsuite/features/step_definitions/command_steps.rb @@ -238,16 +238,6 @@ raise 'Vendor change option not found in logs' unless return_code.zero? end -When(/^I apply highstate on "([^"]*)"$/) do |host| - system_name = get_system_name(host) - if host.include? 'ssh_minion' - cmd = 'mgr-salt-ssh' - elsif host.include? 'minion' or host.include? 'build' - cmd = 'salt' - end - get_target('server').run_until_ok("#{cmd} #{system_name} state.highstate") -end - When(/^I wait until "([^"]*)" service is active on "([^"]*)"$/) do |service, host| node = get_target(host) cmd = "systemctl is-active #{service}" @@ -1544,7 +1534,6 @@ # Update the server CA certificate since it changed, otherwise all API and browser uses will fail update_ca('controller') - update_ca('proxy') # Reset the API client to take the new CA into account reset_api_client diff --git a/testsuite/features/step_definitions/salt_steps.rb b/testsuite/features/step_definitions/salt_steps.rb index 6ab7a29e3011..09dd8e173258 100644 --- a/testsuite/features/step_definitions/salt_steps.rb +++ b/testsuite/features/step_definitions/salt_steps.rb @@ -578,3 +578,14 @@ def pillar_get(key, minion) cleanup = %(salt #{system_name} state.apply util.mgr_switch_to_venv_minion pillar='{"mgr_purge_non_venv_salt_files": True, "mgr_purge_non_venv_salt": True}') get_target('server').run(cleanup, check_errors: true, verbose: true) end + +When(/^I apply highstate on "([^"]*)"$/) do |host| + system_name = get_system_name(host) + if host.include? 'ssh_minion' + cmd = 'mgr-salt-ssh' + elsif host.include? 'minion' or host.include? 'build' or host.include? 'proxy' + cmd = 'salt' + end + log "#{cmd} #{system_name} state.highstate" + get_target('server').run_until_ok("#{cmd} #{system_name} state.highstate") +end