From aed7ec7c99ef9011681fe75e8f58634c862b02aa Mon Sep 17 00:00:00 2001 From: Michael Hashizume Date: Wed, 26 Apr 2023 12:01:44 -0700 Subject: [PATCH 1/2] (PA-5336) Update tests and tasks for puppet8 This commit updates acceptance tests and tasks for the puppet8 final release. Previously, these things only accounted for the nightly releases. --- .../tests/test_upgrade_puppet7_to_puppet8.rb | 12 ++------- task_spec/spec/acceptance/init_spec.rb | 26 +++---------------- tasks/install.json | 2 +- tasks/install_powershell.json | 2 +- tasks/install_shell.json | 2 +- 5 files changed, 9 insertions(+), 35 deletions(-) diff --git a/acceptance/tests/test_upgrade_puppet7_to_puppet8.rb b/acceptance/tests/test_upgrade_puppet7_to_puppet8.rb index 3aa7a06a..6adf710a 100644 --- a/acceptance/tests/test_upgrade_puppet7_to_puppet8.rb +++ b/acceptance/tests/test_upgrade_puppet7_to_puppet8.rb @@ -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' } @@ -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 diff --git a/task_spec/spec/acceptance/init_spec.rb b/task_spec/spec/acceptance/init_spec.rb index b832cb6b..99b36728 100644 --- a/task_spec/spec/acceptance/init_spec.rb +++ b/task_spec/spec/acceptance/init_spec.rb @@ -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 @@ -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 diff --git a/tasks/install.json b/tasks/install.json index 92fa003d..275f813f 100644 --- a/tasks/install.json +++ b/tasks/install.json @@ -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", diff --git a/tasks/install_powershell.json b/tasks/install_powershell.json index a5ea6ef0..868a95c6 100644 --- a/tasks/install_powershell.json +++ b/tasks/install_powershell.json @@ -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", diff --git a/tasks/install_shell.json b/tasks/install_shell.json index cfdd1fad..879ca7e3 100644 --- a/tasks/install_shell.json +++ b/tasks/install_shell.json @@ -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", From 9491ce2f8d0589e6e9f54e97e1f783799e2c8664 Mon Sep 17 00:00:00 2001 From: Michael Hashizume Date: Wed, 26 Apr 2023 13:31:19 -0700 Subject: [PATCH 2/2] (PA-5336) Update task acceptance Ruby to 3.1 This commit updates the version of Ruby used by the task acceptance tests from 2.5, which is end-of-life and no longer used by any supported version of Puppet, to 3.1, which is the minimum version for Puppet 8. --- .github/workflows/task_acceptance_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/task_acceptance_tests.yaml b/.github/workflows/task_acceptance_tests.yaml index 1e9f7419..849ed2dd 100644 --- a/.github/workflows/task_acceptance_tests.yaml +++ b/.github/workflows/task_acceptance_tests.yaml @@ -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 }}