From 180a3f1adb0d1c786e6bc3b377e3c83bc2bcf9c0 Mon Sep 17 00:00:00 2001 From: Aria Li Date: Thu, 15 Feb 2024 09:03:45 -0800 Subject: [PATCH 1/2] (PA-5781) Use Beaker 5 in modules This commit updates .sync.yml and Gemfile to use newer beaker dependencies: beaker 5.x beaker-abs 1.x beaker-puppet 3.x This commit also removes beaker-pe. --- .sync.yml | 7 +++---- Gemfile | 59 +++++++++++++++++++++++++++---------------------------- 2 files changed, 32 insertions(+), 34 deletions(-) diff --git a/.sync.yml b/.sync.yml index 334198a..1357ca4 100644 --- a/.sync.yml +++ b/.sync.yml @@ -24,19 +24,18 @@ Gemfile: optional: ":development": - gem: beaker - version: '~> 4.30' + version: '~> 5.0' from_env: BEAKER_VERSION - gem: beaker-abs from_env: BEAKER_ABS_VERSION - version: '~> 0.9' - - gem: beaker-pe + version: '~> 1.0' - gem: beaker-hostgenerator from_env: BEAKER_HOSTGENERATOR_VERSION - gem: beaker-rspec from_env: BEAKER_RSPEC_VERSION - gem: beaker-puppet from_env: BEAKER_PUPPET_VERSION - version: '~> 1.22' + version: '~> 3.0' - gem: async version: '~> 1' - gem: beaker-module_install_helper diff --git a/Gemfile b/Gemfile index 7739688..2bb910c 100644 --- a/Gemfile +++ b/Gemfile @@ -14,38 +14,37 @@ def location_for(place_or_version, fake_version = nil) end group :development do - gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.3.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.5.1', require: false if Gem::Requirement.create(['>= 3.0.0', '< 3.0.5']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.6.1', require: false if Gem::Requirement.create(['>= 3.1.0', '< 3.1.3']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.6.3', require: false if Gem::Requirement.create(['>= 3.2.0', '< 4.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "racc", '~> 1.4.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "voxpupuli-puppet-lint-plugins", '~> 5.0', require: false - gem "facterdb", '~> 1.18', require: false - gem "metadata-json-lint", '~> 3.0', require: false - gem "puppetlabs_spec_helper", '~> 6.0', require: false - gem "rspec-puppet-facts", '~> 2.0', require: false - gem "codecov", '~> 0.2', require: false - gem "dependency_checker", '~> 1.0.0', require: false - gem "parallel_tests", '= 3.12.1', require: false - gem "pry", '~> 0.10', require: false - gem "simplecov-console", '~> 0.5', require: false - gem "puppet-debugger", '~> 1.0', require: false - gem "rubocop", '= 1.48.1', require: false - gem "rubocop-performance", '= 1.16.0', require: false - gem "rubocop-rspec", '= 2.19.0', require: false - gem "puppet-strings", '~> 4.0', require: false - gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 4.30') - gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.9') - gem "beaker-pe", require: false + gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "json", '= 2.3.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "json", '= 2.5.1', require: false if Gem::Requirement.create(['>= 3.0.0', '< 3.0.5']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "json", '= 2.6.1', require: false if Gem::Requirement.create(['>= 3.1.0', '< 3.1.3']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "json", '= 2.6.3', require: false if Gem::Requirement.create(['>= 3.2.0', '< 4.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "racc", '~> 1.4.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "voxpupuli-puppet-lint-plugins", '~> 5.0', require: false + gem "facterdb", '~> 1.18', require: false + gem "metadata-json-lint", '~> 3.0', require: false + gem "puppetlabs_spec_helper", '~> 6.0', require: false + gem "rspec-puppet-facts", '~> 2.0', require: false + gem "codecov", '~> 0.2', require: false + gem "dependency_checker", '~> 1.0.0', require: false + gem "parallel_tests", '= 3.12.1', require: false + gem "pry", '~> 0.10', require: false + gem "simplecov-console", '~> 0.5', require: false + gem "puppet-debugger", '~> 1.0', require: false + gem "rubocop", '= 1.48.1', require: false + gem "rubocop-performance", '= 1.16.0', require: false + gem "rubocop-rspec", '= 2.19.0', require: false + gem "puppet-strings", '~> 4.0', require: false + gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] + gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 5.0') + gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 1.0') gem "beaker-hostgenerator" gem "beaker-rspec" - gem "beaker-puppet", *location_for(ENV['BEAKER_PUPPET_VERSION'] || '~> 1.22') - gem "async", '~> 1', require: false - gem "beaker-module_install_helper", require: false - gem "beaker-puppet_install_helper", require: false - gem "nokogiri", require: false + gem "beaker-puppet", *location_for(ENV['BEAKER_PUPPET_VERSION'] || '~> 3.0') + gem "async", '~> 1', require: false + gem "beaker-module_install_helper", require: false + gem "beaker-puppet_install_helper", require: false + gem "nokogiri", require: false end group :system_tests do gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw] From 9f45ae0e7b80b9d15ad779ddc45b099213b13440 Mon Sep 17 00:00:00 2001 From: Aria Li Date: Thu, 15 Feb 2024 09:23:22 -0800 Subject: [PATCH 2/2] (PA-5781) Configure host type as AIO Previously, when running with beaker 5 and latest beaker-puppet, tests failed with: cannot add defaults of type pe for host redhat7-64-1 (add_pe_defaults_on not present) The error came from beaker-puppet when it tried to configure the host as a PE agent[1]. The root cause is beaker defaults its options to `pe`[2]. When `beaker-puppet` calls the `configure_type_defaults_on` method, it calls the appropriate `add__defaults_on` method. This works when using beaker 4 as `beaker-pe` is pulled in as a dependency and its `add_pe_defaults_on` method[3] is included into the tests. However, when running with beaker5, beaker-pe is not loaded, so the method is undefined. It appears beaker-puppet_install_helper is responsible for the whether beaker-pe is loaded or not, but only when using beaker-puppet_install_helper 0.9.4. Since these tests don't actually depend on PE, drop beaker-pe, require 'beaker-puppet' directly (so the install_from_build_data_url method exists) and configure the host type directly. [1] https://github.com/puppetlabs/beaker-puppet/blob/7175b5c1acb5cddb3a31ddcc114f09cddd3b83d0/lib/beaker-puppet/install_utils/puppet_utils.rb#L167 [2] https://github.com/voxpupuli/beaker/blob/c61ee381d3801bad70989d9b3cbf970771e6f330/lib/beaker/options/presets.rb#L139 [3] https://github.com/puppetlabs/beaker-pe/blob/3bfe913b8d57c805cc0c51ae899fff174224d5f5/lib/beaker-pe/install/pe_defaults.rb#L93 Commit originally from joshcooper/puppetlabs-cron_core@d456d2a23897f91f6829a9bd89831ee918f2017e --- spec/spec_helper_acceptance.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index ec87a7b..ec14b2a 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,4 +1,5 @@ require 'beaker-rspec' +require 'beaker-puppet' require 'beaker/module_install_helper' require 'beaker/puppet_install_helper' require 'voxpupuli/acceptance/spec_helper_acceptance' @@ -58,6 +59,7 @@ counter += 5 end end + hosts.each { |host| host[:type] = 'aio' } run_puppet_install_helper install_module_on(hosts) install_module_dependencies_on(hosts)