diff --git a/testsuite/features/build_validation/init_clients/proxy.feature b/testsuite/features/build_validation/init_clients/proxy.feature index 9f4baeaaf83d..5502ada9d83e 100644 --- a/testsuite/features/build_validation/init_clients/proxy.feature +++ b/testsuite/features/build_validation/init_clients/proxy.feature @@ -39,6 +39,10 @@ Feature: Setup containerized proxy Scenario: Wait until the proxy host appears When I wait until onboarding is completed for "proxy" + Scenario: Upgrade mgrpxy tool + Then I upgrade "proxy" with the last "mgrpxy" version + And I reboot the "proxy" minion through the web UI + Scenario: Generate containerized proxy configuration When I generate the configuration "/tmp/proxy_container_config.tar.gz" of containerized proxy on the server And I copy the configuration "/tmp/proxy_container_config.tar.gz" of containerized proxy from the server to the proxy diff --git a/testsuite/features/step_definitions/command_steps.rb b/testsuite/features/step_definitions/command_steps.rb index e7f02813067f..afa8bce0d831 100644 --- a/testsuite/features/step_definitions/command_steps.rb +++ b/testsuite/features/step_definitions/command_steps.rb @@ -1769,3 +1769,15 @@ occurences = count.to_i raise "The word #{word} occured #{occurences} times, which is more more than #{threshold} times in file #{path}" if occurences > threshold end + +Then(/^I upgrade "([^"]*)" with the last "([^"]*)" version$/) do |host, package| + system_name = get_system_name(host) + last_event_before_upgrade = get_last_event(host) + last_event = last_event_before_upgrade + trigger_upgrade(system_name, package) + repeat_until_timeout(timeout: DEFAULT_TIMEOUT, message: 'Waiting for the new event to be created') do + last_event = get_last_event(host) + break if last_event['id'] > last_event_before_upgrade['id'] && (last_event['summary'].include? 'Package Install/Upgrade') + end + wait_action_complete(last_event['id']) +end diff --git a/testsuite/features/support/commonlib.rb b/testsuite/features/support/commonlib.rb index 4d3bf339c0cd..2d6d9efe5343 100644 --- a/testsuite/features/support/commonlib.rb +++ b/testsuite/features/support/commonlib.rb @@ -751,3 +751,20 @@ def api_unlock file.flock(File::LOCK_UN) end end + +# Function to get the highest event ID (latest event) +# +# @param host String The hostname of the system from requested +def get_last_event(host) + node = get_target(host) + system_id = get_system_id(node) + $api_test.system.get_event_history(system_id, 0, 1)[0] +end + +# Function to trigger the upgrade command +# +# @param hostname String The hostname of the system from requested +# @param package String The package name where it will trigger an upgrade +def trigger_upgrade(hostname, package) + get_target('server').run("spacecmd -u admin -p admin system_upgradepackage #{hostname} #{package} -y", check_errors: true) +end