-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #639 from mhashizume/MODULES-11392/main/puppet8-test
(MODULES-11392) Add Puppet 7 to 8 upgrade test
- Loading branch information
Showing
5 changed files
with
85 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
require 'beaker-puppet' | ||
require_relative '../helpers' | ||
|
||
# Tests FOSS upgrades from the latest Puppet 7 (the puppet7-nightly collection) | ||
# to the latest puppet8-nightly build. | ||
test_name 'puppet_agent class: Upgrade agents from puppet7 to puppet8' do | ||
require_master_collection 'puppet8-nightly' | ||
exclude_pe_upgrade_platforms | ||
latest_version = `curl https://builds.delivery.puppetlabs.net/passing-agent-SHAs/puppet-agent-main-version` | ||
|
||
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'] { | ||
$_package_version = '#{latest_version}' | ||
} elsif $facts['os']['family'] in ['darwin', 'windows'] { | ||
$_package_version = 'auto' | ||
} else { | ||
$_package_version = 'latest' | ||
} | ||
class { puppet_agent: | ||
package_version => $_package_version, | ||
apt_source => 'https://nightlies.puppet.com/apt', | ||
yum_source => 'https://nightlies.puppet.com/yum', | ||
mac_source => 'https://nightlies.puppet.com/downloads', | ||
windows_source => 'https://nightlies.puppet.com/downloads', | ||
collection => 'puppet8-nightly', | ||
service_names => [] | ||
} | ||
} | ||
PP | ||
site_pp_path = File.join(environment_location(puppet_testing_environment), 'manifests', 'site.pp') | ||
create_remote_file(master, site_pp_path, manifest) | ||
on(master, %(chown #{puppet_user(master)} "#{site_pp_path}")) | ||
on(master, %(chmod 755 "#{site_pp_path}")) | ||
end | ||
|
||
agents_only.each do |agent| | ||
set_up_initial_agent_on(agent, 'puppet7-nightly') do | ||
step '(Agent) Change agent environment to testing environment' do | ||
on(agent, puppet("config --section agent set environment #{puppet_testing_environment}")) | ||
on(agent, puppet('config --section user set environment production')) | ||
end | ||
end | ||
end | ||
|
||
step 'Upgrade the agents from Puppet 7 to Puppet 8...' do | ||
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.')) | ||
end | ||
end | ||
|
||
step 'Run again for idempotency' do | ||
agents_only.each do |agent| | ||
on(agent, puppet('agent -t --debug'), acceptable_exit_codes: 0) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters