Skip to content

Commit fb66919

Browse files
committed
(maint) Simplify how options are passed
The `set_up_initial_agent_on` method is only ever called with the name of the collection, so remove the code that allowed an arbitrary version to be specified.
1 parent 036d0bb commit fb66919

File tree

3 files changed

+5
-16
lines changed

3 files changed

+5
-16
lines changed

acceptance/helpers.rb

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,8 @@ def host_to_info_s(host)
207207
# purpose to facilitate an upgrade scenario.
208208
#
209209
# @param [Beaker::Host] host The host
210-
# @param [String] initial_package_version_or_collection Either a version
211-
# of puppet-agent or the name of a puppet collection to install the agent from.
212-
def set_up_initial_agent_on(host, initial_package_version_or_collection)
210+
# @param [Hash] options Install options
211+
def set_up_initial_agent_on(host, options)
213212
master_agent_version = fact_on(master, 'aio_agent_version')
214213
unless master_agent_version
215214
fail_test('Expected puppet-agent to already be installed on the master, but it was not. ' \
@@ -224,17 +223,7 @@ def set_up_initial_agent_on(host, initial_package_version_or_collection)
224223

225224
step 'Set-up the agents to upgrade' do
226225
step '(Agent) Install the puppet-agent package' do
227-
initial_package_version_or_collection ||= master_agent_version
228-
agent_install_options = if %r{(^pc1$|^puppet\d+)}i.match?(initial_package_version_or_collection)
229-
{ puppet_collection: initial_package_version_or_collection }
230-
else
231-
{
232-
puppet_agent_version: initial_package_version_or_collection,
233-
puppet_collection: puppet_collection_for(:puppet_agent, initial_package_version_or_collection)
234-
}
235-
end
236-
237-
install_puppet_agent_on(host, agent_install_options)
226+
install_puppet_agent_on(host, options)
238227

239228
# beaker-puppet doesn't add signing information to the apt source list, but this module does.
240229
# This discrepancy causes apt to error, so we manually add signing info.

acceptance/tests/test_upgrade_puppet6_to_puppet7.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class { puppet_agent:
3737
end
3838

3939
agents_only.each do |agent|
40-
set_up_initial_agent_on(agent, 'puppet6-nightly') do
40+
set_up_initial_agent_on(agent, puppet_collection: 'puppet6-nightly') do
4141
step '(Agent) Change agent environment to testing environment' do
4242
on(agent, puppet("config --section agent set environment #{puppet_testing_environment}"))
4343
on(agent, puppet('config --section user set environment production'))

acceptance/tests/test_upgrade_puppet7_to_puppet8.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class { puppet_agent:
3737
end
3838

3939
agents_only.each do |agent|
40-
set_up_initial_agent_on(agent, 'puppet7-nightly') do
40+
set_up_initial_agent_on(agent, puppet_collection: 'puppet7-nightly') do
4141
step '(Agent) Change agent environment to testing environment' do
4242
on(agent, puppet("config --section agent set environment #{puppet_testing_environment}"))
4343
on(agent, puppet('config --section user set environment production'))

0 commit comments

Comments
 (0)