Skip to content

Commit

Permalink
Merge pull request #9540 from maximenoel8/upgrade-mgrpxy-proxy
Browse files Browse the repository at this point in the history
Upgrade mgrpxy tool before installing the containerized proxy.
  • Loading branch information
raulillo82 authored Dec 18, 2024
2 parents 0eaada1 + e815e19 commit dde0d80
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions testsuite/features/step_definitions/command_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 17 additions & 0 deletions testsuite/features/support/commonlib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit dde0d80

Please sign in to comment.