Skip to content

Commit

Permalink
Merge pull request #650 from mhashizume/PA-5336/main/puppet-8
Browse files Browse the repository at this point in the history
(PA-5336) Update tests and tasks for puppet8
  • Loading branch information
joshcooper authored Apr 27, 2023
2 parents 8aa3d76 + 9491ce2 commit 8a029a3
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/task_acceptance_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
os: [ 'centos-7', 'ubuntu-20.04', 'rocky-8' ]

env:
ruby_version: 2.5
ruby_version: '3.1'
GEM_BOLT: true
BEAKER_debug: true
BEAKER_set: docker/${{ matrix.os }}
Expand Down
12 changes: 2 additions & 10 deletions acceptance/tests/test_upgrade_puppet7_to_puppet8.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,10 @@
puppet_testing_environment = new_puppet_testing_environment

step 'Create new site.pp with upgrade manifest' do
# In previous versions of this manifest, Windows and macOS downloaded the package with the latest SHA
# Due to issues with versioning Puppet 8 in its prerelease stage, we'll use auto for now.
manifest = <<-PP
node default {
if $facts['os']['family'] in ['solaris', 'aix'] {
if $facts['os']['family'] =~ /^(?i:windows|solaris|aix|darwin)$/ {
$_package_version = '#{latest_version}'
} elsif $facts['os']['family'] in ['darwin', 'windows'] {
$_package_version = 'auto'
} else {
$_package_version = 'latest'
}
Expand Down Expand Up @@ -53,11 +49,7 @@ class { puppet_agent:
agents_only.each do |agent|
on(agent, puppet('agent -t --debug'), acceptable_exit_codes: 2)
wait_for_installation_pid(agent)
# The aio_agent_version fact reports the wrong version for puppet8 prerelease nightlies
# Use this statement instead after the Puppet 8.0.0 release
# assert(puppet_agent_version_on(agent) =~ %r{^8\.\d+\.\d+.*})
puppet_version = on(agent, puppet('--version')).output
assert(puppet_version.start_with?('8.'))
assert(puppet_agent_version_on(agent) =~ %r{^8\.\d+\.\d+.*})
end
end

Expand Down
26 changes: 4 additions & 22 deletions task_spec/spec/acceptance/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ def log_output_errors(result)
# puppet_8_collection = 'puppet8-nightly'
# else
puppet_7_collection = 'puppet7'
# We currently only have nightly builds of puppet8 available. Update
# this to the normal collection once we have a release.
puppet_8_collection = 'puppet8-nightly'
puppet_8_collection = 'puppet8'
# end

# We can only test puppet 7 -> 7 upgrades if multiple Puppet releases
Expand Down Expand Up @@ -203,29 +201,13 @@ def log_output_errors(result)

# Verify that it upgraded
installed_version = nil
# With prerelease puppet8, the puppet_agent::version task returns the wrong
# output. To temporarily work around this, we'll run puppet --version.
# Revert this change once Puppet 8.0.0 has been released.
# results = run_task('puppet_agent::version', 'target', {})
results = if %r{win}.match?(target_platform)
run_command('c:/"program files"/"puppet labs"/puppet/bin/puppet --version', 'target')
else
run_command('/opt/puppetlabs/bin/puppet --version', 'target')
end
results = run_task('puppet_agent::version', 'target', {})
results.each do |res|
expect(res).to include('status' => 'success')
installed_version = res['value']['stdout']
installed_version = res['value']['version']
expect(installed_version).not_to match(%r{^7\.\d+\.\d+})
expect(installed_version).to match(%r{^8\.\d+\.\d+})
# We don't get the expected output with prerelease puppet8
# expect(res['value']['source']).to be
end

# More prerelease puppet8 workarounds, this block can also be deleted
# once Puppet 8.0.0 has been released.
results = run_task('puppet_agent::version', 'target', {})
results.each do |res|
installed_version = res['value']['version']
expect(res['value']['source']).to be
end

# Try installing the same version again
Expand Down
2 changes: 1 addition & 1 deletion tasks/install.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"collection": {
"description": "The Puppet collection to install from (defaults to puppet, which maps to the latest collection released)",
"type": "Optional[Enum[puppet7, puppet, puppet7-nightly, puppet8-nightly, puppet-nightly]]"
"type": "Optional[Enum[puppet7, puppet8, puppet, puppet7-nightly, puppet8-nightly, puppet-nightly]]"
},
"absolute_source": {
"description": "The absolute source location to find the Puppet agent package",
Expand Down
2 changes: 1 addition & 1 deletion tasks/install_powershell.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"collection": {
"description": "The Puppet collection to install from (defaults to puppet, which maps to the latest collection released)",
"type": "Optional[Enum[puppet7, puppet, puppet7-nightly, puppet8-nightly, puppet-nightly]]"
"type": "Optional[Enum[puppet7, puppet8, puppet, puppet7-nightly, puppet8-nightly, puppet-nightly]]"
},
"absolute_source": {
"description": "The absolute source location to find the Puppet agent package",
Expand Down
2 changes: 1 addition & 1 deletion tasks/install_shell.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"collection": {
"description": "The Puppet collection to install from (defaults to puppet, which maps to the latest collection released)",
"type": "Optional[Enum[puppet7, puppet, puppet7-nightly, puppet8-nightly, puppet-nightly]]"
"type": "Optional[Enum[puppet7, puppet8, puppet, puppet7-nightly, puppet8-nightly, puppet-nightly]]"
},
"absolute_source": {
"description": "The absolute source location to find the Puppet agent package",
Expand Down

0 comments on commit 8a029a3

Please sign in to comment.