From 59f32b0776e90a34c4b039128bb36355b41c9a0e Mon Sep 17 00:00:00 2001 From: Eric Bischoff Date: Fri, 31 Jan 2025 17:35:27 +0100 Subject: [PATCH] Adapt HTTP proxy test to UI change --- testsuite/documentation/test-architecture.md | 10 +++ .../allcli_update_activationkeys.feature | 20 ------ .../reposync/srv_sync_products.feature | 16 +++++ .../min_ansible_control_node.feature | 24 ++----- .../secondary/min_deblike_monitoring.feature | 8 --- .../min_deblike_openscap_audit.feature | 4 +- .../features/secondary/min_monitoring.feature | 13 +--- .../secondary/min_rhlike_monitoring.feature | 16 ++--- .../min_rhlike_openscap_audit.feature | 4 +- .../minssh_ansible_control_node.feature | 21 ++---- .../step_definitions/command_steps.rb | 64 ++++++++++--------- .../features/step_definitions/setup_steps.rb | 2 +- testsuite/features/support/commonlib.rb | 37 +++++++++-- testsuite/features/support/constants.rb | 52 +++++++-------- 14 files changed, 139 insertions(+), 152 deletions(-) diff --git a/testsuite/documentation/test-architecture.md b/testsuite/documentation/test-architecture.md index b41e4d64acb2..435ea2d64681 100644 --- a/testsuite/documentation/test-architecture.md +++ b/testsuite/documentation/test-architecture.md @@ -46,6 +46,16 @@ As part of the Salt states configuring the systems, we have a state that injects Those repositories are not directly handled by our server, so during the reposync stage we create custom channels with new custom repositories that will parse and include the repositories injected by Sumaform. These custom channels will be part of the activation keys that we use to bootstrap the different clients. +#### How do we speed up the workflow to onboard the clients? + +Normally a customer will trigger a full synchronization of a product, including all the mandatory and recommended channels. This process can take a long time, depending on the number of packages and the network speed. +In our CI Test Suite we want to speed up this workflow by synchronizing only the necessary packages to generate the bootstrap repository for the clients. + +For now, this only applies to our Leap Minion in our Uyuni flavor, but the plan is to extend this to the MLM and other clients as well: +We first need to trigger a synchronization of the channel through `spacewalk-common-channel`, but then we immediately kill that repo-sync process, we need this as otherwise the following command will fail, warning about a non-existing custom channel. +After that, we run the command `spacewalk-repo-sync -c --include --include ...` for each of the packages that define as part of our bootstrap repository. +This way we can speed up the synchronization process, and we can bootstrap the clients immediately after that. The rest of the product channels will automatically be synchronized by the scheduled tasks when it reaches the time to do so. + #### Overview of Channels and Repositories The current overview of channels and repositories is as follows: diff --git a/testsuite/features/reposync/allcli_update_activationkeys.feature b/testsuite/features/reposync/allcli_update_activationkeys.feature index 162d31678e14..10bde2353751 100644 --- a/testsuite/features/reposync/allcli_update_activationkeys.feature +++ b/testsuite/features/reposync/allcli_update_activationkeys.feature @@ -43,11 +43,6 @@ Feature: Update activation keys And I wait until I do not see "Loading..." text And I select the parent channel for the "sle_minion" from "selectedBaseChannel" And I wait until I do not see "Loading..." text - And I check "openSUSE 15.5 non oss (x86_64)" - And I check "openSUSE Leap 15.5 non oss Updates (x86_64)" - And I check "openSUSE Leap 15.5 Updates (x86_64)" - And I check "Update repository of openSUSE Leap 15.5 Backports (x86_64)" - And I check "Update repository with updates from SUSE Linux Enterprise 15 for openSUSE Leap 15.5 (x86_64)" And I check "Uyuni Client Tools for openSUSE Leap 15.5 (x86_64) (Development)" And I check "Fake-RPM-SUSE-Channel" And I wait until "Fake-RPM-SUSE-Channel" has been checked @@ -81,11 +76,6 @@ Feature: Update activation keys And I wait until I do not see "Loading..." text And I select the parent channel for the "sle_minion" from "selectedBaseChannel" And I wait until I do not see "Loading..." text - And I check "openSUSE 15.5 non oss (x86_64)" - And I check "openSUSE Leap 15.5 non oss Updates (x86_64)" - And I check "openSUSE Leap 15.5 Updates (x86_64)" - And I check "Update repository of openSUSE Leap 15.5 Backports (x86_64)" - And I check "Update repository with updates from SUSE Linux Enterprise 15 for openSUSE Leap 15.5 (x86_64)" And I check "Uyuni Client Tools for openSUSE Leap 15.5 (x86_64) (Development)" And I check "Fake-RPM-SUSE-Channel" And I wait until "Fake-RPM-SUSE-Channel" has been checked @@ -119,11 +109,6 @@ Feature: Update activation keys And I wait until I do not see "Loading..." text And I select the parent channel for the "sle_minion" from "selectedBaseChannel" And I wait until I do not see "Loading..." text - And I check "openSUSE 15.5 non oss (x86_64)" - And I check "openSUSE Leap 15.5 non oss Updates (x86_64)" - And I check "openSUSE Leap 15.5 Updates (x86_64)" - And I check "Update repository of openSUSE Leap 15.5 Backports (x86_64)" - And I check "Update repository with updates from SUSE Linux Enterprise 15 for openSUSE Leap 15.5 (x86_64)" And I check "Uyuni Client Tools for openSUSE Leap 15.5 (x86_64) (Development)" And I check "Fake-RPM-SUSE-Channel" And I wait until "Fake-RPM-SUSE-Channel" has been checked @@ -156,11 +141,6 @@ Feature: Update activation keys And I wait for child channels to appear And I select the parent channel for the "proxy_traditional" from "selectedBaseChannel" And I wait for child channels to appear - And I check "openSUSE 15.5 non oss (x86_64)" - And I check "openSUSE Leap 15.5 non oss Updates (x86_64)" - And I check "openSUSE Leap 15.5 Updates (x86_64)" - And I check "Update repository of openSUSE Leap 15.5 Backports (x86_64)" - And I check "Update repository with updates from SUSE Linux Enterprise 15 for openSUSE Leap 15.5 (x86_64)" And I check "Uyuni Client Tools for openSUSE Leap 15.5 (x86_64) (Development)" And I check "Uyuni Proxy Devel for openSUSE Leap 15.5 (x86_64)" And I click on "Update Activation Key" diff --git a/testsuite/features/reposync/srv_sync_products.feature b/testsuite/features/reposync/srv_sync_products.feature index 57132017ce36..97c748838d91 100644 --- a/testsuite/features/reposync/srv_sync_products.feature +++ b/testsuite/features/reposync/srv_sync_products.feature @@ -73,6 +73,22 @@ Feature: Synchronize products in the products page of the Setup Wizard Then the SLE15 SP4 product should be added When I wait until all synchronized channels for "sles15-sp4" have finished +@uyuni + Scenario: Partially add openSUSE Leap 15.5 product, only including the required packages to generate the bootstrap repository + When I use spacewalk-common-channel to add channel "opensuse_leap15_5" with arch "x86_64" + And I kill running spacewalk-repo-sync for "opensuse_leap15_5-x86_64" channel + And I use spacewalk-repo-sync to sync channel "opensuse_leap15_5-x86_64" including "python3-ply dmidecode libunwind" packages + And I use spacewalk-common-channel to add all "leap15.5-client-tools" channels with arch "x86_64" + And I wait until all synchronized channels for "leap15.5-client-tools-x86_64" have finished + +@containerized_server +@proxy +@uyuni +Scenario: Add openSUSE Leap Micro 5.5 Proxy, including Uyuni Client Tools + # TODO: Refactor the scenarios in order to not require a full synchronization of Uyuni proxy product (OpenSUSE Micro 5.5) + When I use spacewalk-common-channel to add all "uyuni-proxy" channels with arch "x86_64" + And I wait until all synchronized channels for "uyuni-proxy" have finished + @scc_credentials @uyuni Scenario: Synchronize SLES 15 SP4 product with recommended sub-products for Retail feature diff --git a/testsuite/features/secondary/min_ansible_control_node.feature b/testsuite/features/secondary/min_ansible_control_node.feature index acdcff600749..091f7323b388 100644 --- a/testsuite/features/secondary/min_ansible_control_node.feature +++ b/testsuite/features/secondary/min_ansible_control_node.feature @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 SUSE LLC +# Copyright (c) 2021-2025 SUSE LLC # Licensed under the terms of the MIT license. @scope_ansible @@ -9,17 +9,12 @@ Feature: Operate an Ansible control node in a normal minion Scenario: Pre-requisite: Deploy test playbooks and inventory file When I deploy testing playbooks and inventory files to "sle_minion" -@skip_if_github_validation -@susemanager - Scenario: Pre-requisite: Enable client tools repositories - When I enable the repositories "tools_update_repo tools_pool_repo" on this "sle_minion" - And I refresh the metadata for "sle_minion" - # TODO: Check why tools_update_repo is not available on the openSUSE minion +# TODO: Check why tools_update_repo is not available on the openSUSE minion @skip_if_github_validation @uyuni - Scenario: Pre-requisite: Enable client tools repositories - When I enable the repositories "tools_pool_repo os_pool_repo" on this "sle_minion" + Scenario: Pre-requisite: Enable OS pool repository + When I enable repository "os_pool_repo" on this "sle_minion" And I refresh the metadata for "sle_minion" Scenario: Enable "Ansible control node" system type @@ -90,16 +85,9 @@ Feature: Operate an Ansible control node in a normal minion And I remove package "orion-dummy" from this "sle_minion" without error control And I remove "/tmp/file.txt" from "sle_minion" -@skip_if_github_validation -@susemanager - Scenario: Cleanup: Disable client tools repositories - Given I am on the Systems overview page of this "sle_minion" - When I disable the repositories "tools_update_repo tools_pool_repo" on this "sle_minion" - And I refresh the metadata for "sle_minion" - @skip_if_github_validation @uyuni - Scenario: Cleanup: Disable client tools repositories + Scenario: Cleanup: Disable OS pool repository Given I am on the Systems overview page of this "sle_minion" - When I disable the repositories "tools_pool_repo os_pool_repo" on this "sle_minion" + When I disable repository "os_pool_repo" on this "sle_minion" And I refresh the metadata for "sle_minion" diff --git a/testsuite/features/secondary/min_deblike_monitoring.feature b/testsuite/features/secondary/min_deblike_monitoring.feature index 41f56c056c3f..882b6d359d79 100644 --- a/testsuite/features/secondary/min_deblike_monitoring.feature +++ b/testsuite/features/secondary/min_deblike_monitoring.feature @@ -12,10 +12,6 @@ Feature: Monitor SUMA environment with Prometheus on a Debian-like Salt minion As an authorized user I want to enable Prometheus exporters -@skip_if_github_validation - Scenario: Pre-requisite: enable Prometheus exporters repository on the Debian-like minion - When I enable the necessary repositories before installing Prometheus exporters on this "deblike_minion" - Scenario: Log in as org admin user Given I am authorized @@ -69,7 +65,3 @@ Feature: Monitor SUMA environment with Prometheus on a Debian-like Salt minion And I click on "Apply Highstate" Then I should see a "Applying the highstate has been scheduled." text And I wait until event "Apply highstate scheduled" is completed - -@skip_if_github_validation - Scenario: Cleanup: disable Prometheus exporters repository on the Debian-like minion - When I disable the necessary repositories before installing Prometheus exporters on this "deblike_minion" without error control diff --git a/testsuite/features/secondary/min_deblike_openscap_audit.feature b/testsuite/features/secondary/min_deblike_openscap_audit.feature index 1e6d1e85b412..9a34f22b85c0 100644 --- a/testsuite/features/secondary/min_deblike_openscap_audit.feature +++ b/testsuite/features/secondary/min_deblike_openscap_audit.feature @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2023 SUSE LLC +# Copyright (c) 2017-2025 SUSE LLC # Licensed under the terms of the MIT license. @scope_openscap @@ -16,7 +16,6 @@ Feature: OpenSCAP audit of Debian-like Salt minion @skip_if_github_validation Scenario: Enable all the necessary repositories for OpenSCAP on Debian-like minion When I enable Debian-like "universe" repository on "deblike_minion" - And I enable the repositories "tools_update_repo tools_pool_repo" on this "deblike_minion" @skip_if_github_validation Scenario: Install the OpenSCAP packages on the Debian-like minion @@ -84,5 +83,4 @@ Feature: OpenSCAP audit of Debian-like Salt minion @skip_if_github_validation Scenario: Cleanup: remove all the necessary repositories for OpenSCAP on Debian-like minion - When I disable the repositories "tools_update_repo tools_pool_repo" on this "deblike_minion" And I disable Debian-like "universe" repository on "deblike_minion" diff --git a/testsuite/features/secondary/min_monitoring.feature b/testsuite/features/secondary/min_monitoring.feature index e4c7514a45d6..869027cfd322 100644 --- a/testsuite/features/secondary/min_monitoring.feature +++ b/testsuite/features/secondary/min_monitoring.feature @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 SUSE LLC +# Copyright (c) 2022-2025 SUSE LLC # Licensed under the terms of the MIT license. # This feature depends on: # - features/secondary/srv_monitoring.feature : As this feature disable/re-enable monitoring capabilities @@ -11,11 +11,6 @@ Feature: Monitor SUMA environment with Prometheus on a SLE Salt minion As an authorized user I want to enable Prometheus exporters -@skip_if_github_validation - Scenario: Pre-requisite: enable Prometheus exporters repository on the minion - When I enable the necessary repositories before installing Prometheus exporters on this "sle_minion" - And I refresh the metadata for "sle_minion" - Scenario: Log in as org admin user Given I am authorized @@ -56,7 +51,7 @@ Feature: Monitor SUMA environment with Prometheus on a SLE Salt minion Then I should see a "Applying the highstate has been scheduled." text And I wait until event "Apply highstate scheduled" is completed -@skip_if_github_validation +@skip_if_github_validation Scenario: Wait for services When I wait until "prometheus" service is active on "sle_minion" And I wait until "node" exporter service is active on "sle_minion" @@ -82,7 +77,3 @@ Feature: Monitor SUMA environment with Prometheus on a SLE Salt minion And I click on "Apply Highstate" Then I should see a "Applying the highstate has been scheduled." text And I wait until event "Apply highstate scheduled" is completed - -@skip_if_github_validation - Scenario: Cleanup: disable Prometheus exporters repository - When I disable the necessary repositories before installing Prometheus exporters on this "sle_minion" without error control diff --git a/testsuite/features/secondary/min_rhlike_monitoring.feature b/testsuite/features/secondary/min_rhlike_monitoring.feature index a61a6ebd6f88..0b3fd5f22b24 100644 --- a/testsuite/features/secondary/min_rhlike_monitoring.feature +++ b/testsuite/features/secondary/min_rhlike_monitoring.feature @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 SUSE LLC +# Copyright (c) 2022-2025 SUSE LLC # Licensed under the terms of the MIT license. # This feature depends on: # - features/secondary/srv_monitoring.feature: as this feature disables/re-enables monitoring capabilities @@ -12,10 +12,6 @@ Feature: Monitor SUMA environment with Prometheus on a Red Hat-like Salt minion As an authorized user I want to enable Prometheus exporters -@skip_if_github_validation - Scenario: Pre-requisite: enable Prometheus exporters repository on the Red Hat-like minion - When I enable the necessary repositories before installing Prometheus exporters on this "rhlike_minion" - Scenario: Log in as org admin user Given I am authorized @@ -39,14 +35,14 @@ Feature: Monitor SUMA environment with Prometheus on a Red Hat-like Salt minion And I click on "Save" Then I should see a "Formula saved" text -@skip_if_github_validation +@skip_if_github_validation Scenario: Apply highstate for Prometheus exporters on the Red Hat-like minion When I follow "States" in the content area And I click on "Apply Highstate" Then I should see a "Applying the highstate has been scheduled." text And I wait until event "Apply highstate scheduled" is completed -@skip_if_github_validation +@skip_if_github_validation Scenario: Wait for service When I wait until "node" exporter service is active on "rhlike_minion" And I wait until "apache" exporter service is active on "rhlike_minion" @@ -63,13 +59,9 @@ Feature: Monitor SUMA environment with Prometheus on a Red Hat-like Salt minion And I click on "Save" Then I wait until I see "Formula saved" text -@skip_if_github_validation +@skip_if_github_validation Scenario: Cleanup: apply highstate after test monitoring on the Red Hat-like minion When I follow "States" in the content area And I click on "Apply Highstate" Then I should see a "Applying the highstate has been scheduled." text And I wait until event "Apply highstate scheduled" is completed - -@skip_if_github_validation - Scenario: Cleanup: disable Prometheus exporters repository on the Red Hat-like minion - When I disable the necessary repositories before installing Prometheus exporters on this "rhlike_minion" without error control diff --git a/testsuite/features/secondary/min_rhlike_openscap_audit.feature b/testsuite/features/secondary/min_rhlike_openscap_audit.feature index b7760ce71ee0..c4746c8091ba 100644 --- a/testsuite/features/secondary/min_rhlike_openscap_audit.feature +++ b/testsuite/features/secondary/min_rhlike_openscap_audit.feature @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2024 SUSE LLC +# Copyright (c) 2017-2025 SUSE LLC # Licensed under the terms of the MIT license. @scope_openscap @@ -16,7 +16,6 @@ Feature: OpenSCAP audit of Red Hat-like Salt minion @skip_if_github_validation Scenario: Enable repositories for openSCAP on the Red Hat-like minion When I enable the repositories "Rocky-BaseOS Rocky-AppStream" on this "rhlike_minion" - And I enable the repositories "tools_update_repo tools_pool_repo" on this "rhlike_minion" And I refresh the metadata for "rhlike_minion" @skip_if_github_validation @@ -83,7 +82,6 @@ Feature: OpenSCAP audit of Red Hat-like Salt minion Scenario: Cleanup: remove the OpenSCAP packages from the Red Hat-like minion When I remove OpenSCAP dependencies from "rhlike_minion" And I disable repository "Rocky-BaseOS" on this "rhlike_minion" - And I disable the repositories "tools_update_repo tools_pool_repo" on this "rhlike_minion" @skip_if_github_validation Scenario: Cleanup: restore the base channel for the Red Hat-like minion diff --git a/testsuite/features/secondary/minssh_ansible_control_node.feature b/testsuite/features/secondary/minssh_ansible_control_node.feature index 701229a6282a..fef2619c79b8 100644 --- a/testsuite/features/secondary/minssh_ansible_control_node.feature +++ b/testsuite/features/secondary/minssh_ansible_control_node.feature @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 SUSE LLC +# Copyright (c) 2021-2025 SUSE LLC # Licensed under the terms of the MIT license. @skip_if_github_validation @@ -13,15 +13,10 @@ Feature: Operate an Ansible control node in SSH minion Scenario: Pre-requisite: Deploy test playbooks and inventory file When I deploy testing playbooks and inventory files to "ssh_minion" -@susemanager - Scenario: Pre-requisite: Enable client tools repositories - When I enable the repositories "tools_update_repo tools_pool_repo" on this "ssh_minion" - And I refresh the metadata for "ssh_minion" - # TODO: Check why tools_update_repo is not available on the openSUSE minion @uyuni - Scenario: Pre-requisite: Enable client tools repositories - When I enable the repositories "tools_pool_repo os_pool_repo" on this "ssh_minion" + Scenario: Pre-requisite: Enable OS pool repository + When I enable repository "os_pool_repo" on this "ssh_minion" And I refresh the metadata for "ssh_minion" Scenario: Enable "Ansible control node" system type @@ -92,14 +87,8 @@ Feature: Operate an Ansible control node in SSH minion And I remove package "orion-dummy" from this "ssh_minion" without error control And I remove "/tmp/file.txt" from "ssh_minion" -@susemanager - Scenario: Cleanup: Disable client tools repositories - Given I am on the Systems overview page of this "ssh_minion" - When I disable the repositories "tools_update_repo tools_pool_repo" on this "ssh_minion" - And I refresh the metadata for "ssh_minion" - @uyuni - Scenario: Cleanup: Disable client tools repositories + Scenario: Cleanup: Disable OS pool repository Given I am on the Systems overview page of this "ssh_minion" - When I disable the repositories "tools_pool_repo os_pool_repo" on this "ssh_minion" + When I disable repository "os_pool_repo" on this "ssh_minion" And I refresh the metadata for "ssh_minion" diff --git a/testsuite/features/step_definitions/command_steps.rb b/testsuite/features/step_definitions/command_steps.rb index 61b617c3f9e2..001af9ab200a 100644 --- a/testsuite/features/step_definitions/command_steps.rb +++ b/testsuite/features/step_definitions/command_steps.rb @@ -169,19 +169,18 @@ channels_to_synchronize.each do |os_product_version_channel| command = "spacewalk-common-channels -u admin -p admin -a #{architecture} #{os_product_version_channel.gsub("-#{architecture}", '')}" - _out, code = get_target('server').run(command, check_errors: false) - if code.zero? - log "Channel #{os_product_version_channel.gsub("-#{architecture}", '')} added" - else - command = "spacewalk-common-channels -u admin -p admin -a #{architecture} #{os_product_version_channel}" - get_target('server').run(command) - log "Channel #{os_product_version_channel} added" - end + get_target('server').run(command, verbose: true) + log "Channel #{os_product_version_channel} added" end end When(/^I use spacewalk-repo-sync to sync channel "([^"]*)"$/) do |channel| - $command_output, _code = get_target('server').run_until_ok("spacewalk-repo-sync -c #{channel}") + $command_output, _code = get_target('server').run("spacewalk-repo-sync -c #{channel}", check_errors: false, verbose: true) +end + +When(/^I use spacewalk-repo-sync to sync channel "([^"]*)" including "([^"]*)" packages?$/) do |channel, packages| + append_includes = packages.split.map { |pkg| "--include #{pkg}" }.join(' ') + $command_output, _code = get_target('server').run("spacewalk-repo-sync -c #{channel} #{append_includes}", check_errors: false, verbose: true) end When(/^I use spacewalk-repo-sync to sync channel "([^"]*)" including "([^"]*)" packages?$/) do |channel, packages| @@ -356,7 +355,7 @@ # Remove from the list to kill those channels that are already synced channels_to_kill.each do |remaining_channel| - if channel_is_synced(remaining_channel) + if channel_sync_completed?(remaining_channel) log "Channel '#{remaining_channel}' is already synced, so there is no need to kill repo-sync process." channels_to_kill.delete(remaining_channel) end @@ -365,6 +364,28 @@ end end +When(/^I kill running spacewalk-repo-sync for "([^"]*)" channel$/) do |channel| + time_spent = 0 + checking_rate = 5 + repeat_until_timeout(timeout: 60, message: 'Some reposync processes were not killed properly', dont_raise: true) do + command_output, _code = get_target('server').run('ps axo pid,cmd | grep spacewalk-repo-sync | grep -v grep', verbose: true, check_errors: false) + process = command_output.split("\n")[0] + channel_synchronizing = process.split[5].strip + if process.nil? + log "#{time_spent / 60.to_i} minutes waiting for '#{channel}' channel to start its repo-sync processes." if ((time_spent += checking_rate) % 60).zero? + sleep checking_rate + next + elsif channel_synchronizing == channel + pid = process.split[0] + get_target('server').run("kill #{pid}", verbose: true, check_errors: false) + log "Reposync of channel #{channel} killed" + break + else + log "Warning: Repo-sync process for channel '#{channel_synchronizing}' running." + end + end +end + Then(/^the reposync logs should not report errors$/) do result, code = get_target('server').run('grep -i "ERROR:" /var/log/rhn/reposync/*.log', check_errors: false) raise ScriptError, "Errors during reposync:\n#{result}" if code.zero? @@ -406,7 +427,7 @@ end begin repeat_until_timeout(timeout: timeout, message: 'Channel not fully synced') do - break if channel_is_synced(channel) + break if channel_sync_completed?(channel) log "#{time_spent / 60.to_i} minutes out of #{timeout / 60.to_i} waiting for '#{channel}' channel to be synchronized" if ((time_spent += checking_rate) % 60).zero? sleep checking_rate @@ -428,7 +449,7 @@ time_spent = 0 checking_rate = 10 # Let's start with a timeout margin aside from the sum of the timeouts for each channel - timeout = 600 + timeout = 900 channels_to_wait.each do |channel| if TIMEOUT_BY_CHANNEL_NAME[channel].nil? log "Unknown timeout for channel #{channel}, assuming one minute" @@ -440,7 +461,7 @@ begin repeat_until_timeout(timeout: timeout, message: 'Product not fully synced') do channels_to_wait.each do |channel| - if channel_is_synced(channel) + if channel_sync_completed?(channel) channels_to_wait.delete(channel) log "Channel #{channel} finished syncing" end @@ -1310,23 +1331,6 @@ end end -When(/^I (enable|disable) the necessary repositories before installing Prometheus exporters on this "([^"]*)"((?: without error control)?)$/) do |action, host, error_control| - node = get_target(host) - os_version = node.os_version.gsub('-SP', '.') - os_family = node.os_family - # TODO: Check why tools_update_repo is not available on the openSUSE minion - repositories = os_family.match?(/^opensuse/) ? 'tools_pool_repo' : 'tools_pool_repo tools_update_repo' - if (os_family.match?(/^opensuse/) || os_family.match?(/^sles/)) && (product != 'Uyuni') - repositories.concat(' tools_additional_repo') - # Needed because in SLES15SP3 and openSUSE 15.3 and higher, firewalld will replace this package. - # But the tools_update_repo's priority doesn't allow to cope with the obsoletes option from firewalld. - if os_version.to_f >= 15.3 - node.run('zypper addlock -r tools_additional_repo firewalld-prometheus-config') - end - end - step %(I #{action} the repositories "#{repositories}" on this "#{host}"#{error_control}) -end - When(/^I apply "([^"]*)" local salt state on "([^"]*)"$/) do |state, host| node = get_target(host) salt_call = use_salt_bundle ? 'venv-salt-call' : 'salt-call' diff --git a/testsuite/features/step_definitions/setup_steps.rb b/testsuite/features/step_definitions/setup_steps.rb index f714ebe96a32..98e12ea0eed9 100644 --- a/testsuite/features/step_definitions/setup_steps.rb +++ b/testsuite/features/step_definitions/setup_steps.rb @@ -7,7 +7,7 @@ # setup wizard Then(/^HTTP proxy verification should have succeeded$/) do - raise ScriptError, 'Success icon not found' unless find('i.text-success', wait: DEFAULT_TIMEOUT) + raise ScriptError, 'Success icon not found' unless find('div.alert-success', wait: DEFAULT_TIMEOUT) end When(/^I enter the address of the HTTP proxy as "([^"]*)"$/) do |hostname| diff --git a/testsuite/features/support/commonlib.rb b/testsuite/features/support/commonlib.rb index c7a2e65def91..de1e02c3847f 100644 --- a/testsuite/features/support/commonlib.rb +++ b/testsuite/features/support/commonlib.rb @@ -584,11 +584,36 @@ def update_controller_ca certutil -d sql:/root/.pki/nssdb -A -t TC -n "susemanager" -i /etc/pki/trust/anchors/#{server_name}.cert` end +# This method checks if the synchronization for the given channel is completed +# +# @param channel_name [String] the channel to check +# @return [Boolean] true if the synchronization is completed, false otherwise +def channel_sync_completed?(channel_name) + log_tmp_file = '/tmp/reposync.log' + get_target('server').extract('/var/log/rhn/reposync.log', log_tmp_file) + raise ScriptError, 'The file with repository synchronization logs doesn\'t exist or is empty' if !File.exist?(log_tmp_file) || File.empty?(log_tmp_file) + + log_content = File.readlines(log_tmp_file) + channel_found = false + log_content.each do |line| + if line.include?('Channel: ') && line.include?(channel_name) + channel_found = true + elsif line.include?('Channel: ') && !line.include?(channel_name) + channel_found = false + elsif line.include?('Sync of channel completed.') && channel_found + return true + end + end + + false +end + +# TODO: This method is not used anywhere, consider removing it # Determines whether a channel is synchronized on the server. # # @param channel [String] The name of the channel to check. # @return [Boolean] Returns true if the channel is synchronized, false otherwise. -def channel_is_synced(channel) +def channel_is_synced?(channel) sync_status = false # solv is the last file to be written when the server synchronizes a channel, therefore we wait until it exist result, code = get_target('server').run("dumpsolv /var/cache/rhn/repodata/#{channel}/solv", verbose: false, check_errors: false) @@ -736,9 +761,13 @@ def wait_action_complete(actionid, timeout: DEFAULT_TIMEOUT) # @param channels [Array] The list of channels to filter. # @param filters [Array] The list of filters to apply. def filter_channels(channels, filters = []) - filtered_channels = channels.clone - filters.each do |filter| - filtered_channels.delete_if { |channel| channel.include? filter } + if channels.nil? || channels.empty? + puts 'Warning: No channels to filter' + else + filtered_channels = channels.clone + filters.each do |filter| + filtered_channels.delete_if { |channel| channel.include? filter } + end end filtered_channels end diff --git a/testsuite/features/support/constants.rb b/testsuite/features/support/constants.rb index 9d7652c0a779..1033e343cf49 100644 --- a/testsuite/features/support/constants.rb +++ b/testsuite/features/support/constants.rb @@ -1432,9 +1432,9 @@ 'opensuse_leap15_5-aarch64-non-oss-updates' => 60, 'opensuse_leap15_5-aarch64-sle-updates' => 4140, 'opensuse_leap15_5-aarch64-updates' => 60, - 'opensuse_leap15_5-uyuni-client-devel-aarch64' => 60, - 'opensuse_leap15_5-uyuni-client-devel-x86_64' => 60, - 'opensuse_leap15_5-uyuni-client-x86_64' => 60, + 'opensuse_leap15_5-uyuni-client-devel-aarch64' => 120, + 'opensuse_leap15_5-uyuni-client-devel-x86_64' => 120, + 'opensuse_leap15_5-uyuni-client-x86_64' => 120, 'opensuse_leap15_5-x86_64' => 10_380, 'opensuse_leap15_5-x86_64-backports-updates' => 360, 'opensuse_leap15_5-x86_64-non-oss' => 60, @@ -1447,9 +1447,9 @@ 'opensuse_leap15_6-aarch64-non-oss-updates' => 60, 'opensuse_leap15_6-aarch64-sle-updates' => 4140, 'opensuse_leap15_6-aarch64-updates' => 60, - 'opensuse_leap15_6-uyuni-client-devel-aarch64' => 60, - 'opensuse_leap15_6-uyuni-client-devel-x86_64' => 60, - 'opensuse_leap15_6-uyuni-client-x86_64' => 60, + 'opensuse_leap15_6-uyuni-client-devel-aarch64' => 120, + 'opensuse_leap15_6-uyuni-client-devel-x86_64' => 120, + 'opensuse_leap15_6-uyuni-client-x86_64' => 120, 'opensuse_leap15_6-x86_64' => 10_380, 'opensuse_leap15_6-x86_64-backports-updates' => 360, 'opensuse_leap15_6-x86_64-non-oss' => 60, @@ -1460,25 +1460,25 @@ 'opensuse-leap-15.6-updates-aarch64' => 60, 'opensuse-backports-15.6-updates-aarch64' => 60, 'opensuse-sle-15.6-updates-aarch64' => 60, - 'opensuse_micro5_5-uyuni-client-x86_64' => 60, - 'opensuse_micro5_5-uyuni-client-devel-x86_64' => 60, + 'opensuse_micro5_5-uyuni-client-x86_64' => 120, + 'opensuse_micro5_5-uyuni-client-devel-x86_64' => 120, 'opensuse_micro5_5-x86_64' => 240, 'opensuse_micro5_5-x86_64-sle-updates' => 5400, 'oraclelinux9-appstream-x86_64' => 2100, - 'oraclelinux9-uyuni-client-devel-x86_64' => 60, + 'oraclelinux9-uyuni-client-devel-x86_64' => 120, 'oraclelinux9-x86_64' => 840, 'res-7-ltss-updates-x86_64' => 960, 'res-7-suse-manager-tools-x86_64-lbt7' => 120, 'res7-suse-manager-tools-x86_64' => 300, 'res7-x86_64' => 21_000, 'rhel-x86_64-server-7' => 60, - 'rockylinux8-uyuni-client-devel-x86_64' => 60, + 'rockylinux8-uyuni-client-devel-x86_64' => 120, 'rocky-8-iso' => 600, 'rockylinux8-x86_64' => 600, 'rockylinux8-x86_64-appstream' => 1260, 'rockylinux8-x86_64-extras' => 420, 'rockylinux9-appstream-x86_64' => 480, - 'rockylinux9-uyuni-client-devel-x86_64' => 60, + 'rockylinux9-uyuni-client-devel-x86_64' => 120, 'rockylinux9-x86_64' => 120, 'rockylinux9-x86_64-extras' => 120, 'sle15-sp2-installer-updates-x86_64' => 60, @@ -1513,19 +1513,19 @@ 'sle-manager-tools-for-micro5-updates-x86_64-5.3' => 120, 'sle-manager-tools-for-micro5-updates-x86_64-5.4' => 120, 'sle-manager-tools-for-micro5-updates-x86_64-5.5' => 120, - 'sle-micro-5.3-devel-uyuni-client-x86_64' => 60, + 'sle-micro-5.3-devel-uyuni-client-x86_64' => 120, 'sle-micro-5.3-pool-x86_64' => 120, 'sle-micro-5.3-updates-x86_64' => 240, - 'sle-micro-5.4-devel-uyuni-client-x86_64' => 60, + 'sle-micro-5.4-devel-uyuni-client-x86_64' => 120, 'sle-micro-5.4-pool-x86_64' => 60, 'sle-micro-5.4-updates-x86_64' => 60, - 'sle-micro-5.5-devel-uyuni-client-x86_64' => 60, + 'sle-micro-5.5-devel-uyuni-client-x86_64' => 120, 'sle-micro-5.5-pool-x86_64' => 120, 'sle-micro-5.5-updates-x86_64' => 120, 'sl-micro-6.0-pool-x86_64' => 120, - 'sl-micro-6.0-devel-uyuni-client-x86_64' => 60, + 'sl-micro-6.0-devel-uyuni-client-x86_64' => 120, 'sl-micro-6.1-pool-x86_64' => 120, - 'sl-micro-6.1-devel-uyuni-client-x86_64' => 60, + 'sl-micro-6.1-devel-uyuni-client-x86_64' => 120, 'sle-module-basesystem15-sp2-pool-x86_64' => 180, 'sle-module-basesystem15-sp2-updates-x86_64' => 660, 'sle-module-basesystem15-sp3-pool-x86_64' => 240, @@ -1610,11 +1610,11 @@ 'sles12-sp5-pool-x86_64' => 180, 'sles12-sp5-updates-x86_64' => 2280, 'sles12-sp5-uyuni-client-devel-x86_64' => 120, - 'sles15-sp2-devel-uyuni-client-x86_64' => 60, - 'sles15-sp3-devel-uyuni-client-x86_64' => 60, - 'sles15-sp4-devel-uyuni-client-x86_64' => 60, - 'sles15-sp5-devel-uyuni-client-x86_64' => 60, - 'sles15-sp6-devel-uyuni-client-x86_64' => 60, + 'sles15-sp2-devel-uyuni-client-x86_64' => 120, + 'sles15-sp3-devel-uyuni-client-x86_64' => 120, + 'sles15-sp4-devel-uyuni-client-x86_64' => 120, + 'sles15-sp5-devel-uyuni-client-x86_64' => 120, + 'sles15-sp6-devel-uyuni-client-x86_64' => 120, 'sll-9-updates-x86_64' => 720, 'sll-as-9-updates-x86_64' => 1620, 'sll-cb-9-updates-x86_64' => 2640, @@ -1622,10 +1622,10 @@ 'suse-manager-proxy-5.0-updates-x86_64' => 60, 'suse-manager-retail-branch-server-5.0-pool-x86_64' => 60, 'suse-manager-retail-branch-server-5.0-updates-x86_64' => 60, - 'suse-microos-5.1-devel-uyuni-client-x86_64' => 60, + 'suse-microos-5.1-devel-uyuni-client-x86_64' => 120, 'suse-microos-5.1-pool-x86_64' => 60, 'suse-microos-5.1-updates-x86_64' => 300, - 'suse-microos-5.2-devel-uyuni-client-x86_64' => 60, + 'suse-microos-5.2-devel-uyuni-client-x86_64' => 120, 'suse-microos-5.2-pool-x86_64' => 60, 'suse-microos-5.2-updates-x86_64' => 60, 'suse-manager-tools-for-sl-micro-6.0-x86_64' => 60, @@ -1641,7 +1641,7 @@ 'ubuntu-2004-amd64-universe-security-uyuni' => 900, 'ubuntu-2004-amd64-universe-updates-uyuni' => 240, 'ubuntu-2004-amd64-universe-uyuni' => 19_560, - 'ubuntu-2004-amd64-uyuni-client-devel' => 60, + 'ubuntu-2004-amd64-uyuni-client-devel' => 120, 'ubuntu-2004-pool-amd64-uyuni' => 60, 'ubuntu-20.04-suse-manager-tools-amd64' => 120, 'ubuntu-2204-amd64-main-amd64' => 780, @@ -1654,7 +1654,7 @@ 'ubuntu-2204-amd64-universe-security-uyuni' => 1020, 'ubuntu-2204-amd64-universe-updates-uyuni' => 240, 'ubuntu-2204-amd64-universe-uyuni' => 24_000, - 'ubuntu-2204-amd64-uyuni-client-devel' => 60, + 'ubuntu-2204-amd64-uyuni-client-devel' => 120, 'ubuntu-2204-pool-amd64-uyuni' => 60, 'ubuntu-22.04-suse-manager-tools-amd64' => 120, 'ubuntu-2404-amd64-main-amd64' => 780, @@ -1667,7 +1667,7 @@ 'ubuntu-2404-amd64-universe-security-uyuni' => 1020, 'ubuntu-2404-amd64-universe-updates-uyuni' => 240, 'ubuntu-2404-amd64-universe-uyuni' => 24_000, - 'ubuntu-2404-amd64-uyuni-client-devel' => 60, + 'ubuntu-2404-amd64-uyuni-client-devel' => 120, 'ubuntu-2404-pool-amd64-uyuni' => 60, 'ubuntu-24.04-suse-manager-tools-amd64' => 120, 'uyuni-proxy-devel-leap-x86_64' => 60,