beaker 5.4.0 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bfd2ad07fea03a806838c759f62a7d8012f47da31b9e408d8caf5eae018a7353
4
- data.tar.gz: ef99fa2273d9ed94a4fa5ccb9f6b43157e270e2cd72d685ce08016a14b8ba5b6
3
+ metadata.gz: 8f99a4862979da16eeca708167851a6cc41356ef28f5093ffaf8b486687eb8ea
4
+ data.tar.gz: e9ca97f27f048c0aae5bba989ab7ed23491cb9ca111ab359b1b1b791c72fbf96
5
5
  SHA512:
6
- metadata.gz: 4ef30fb6d9538ec1d4cc2644e0a4231a8788e93f36a657205ec5f11b030462fa1bf429a6dead72db0a98118928f51dd610c675489b8a7f0a0955ed2aa7c645f6
7
- data.tar.gz: 443b0624611e79c3d3a4bb3f10148bee8b2a9a96d0a01364f2b62399a288bee5f05364bdfb33b31a9064b5bcd893bf918867f4063817c63487cfbb58bf672250
6
+ metadata.gz: 29286dc6b82ff7f399dc24757be5a45770d1fa144d99c9287f6abadabda0bb1330acc7a67ee71b196029f68ae7ca5f526a79725ef281ff25ae64f81f110d48d5
7
+ data.tar.gz: 160d6a88237f9f53b6ee0b384858ab0c411eeb477f331e3262aba5f179c6f07e1c3f72cb2c3a8ad3fef2366609004198f58c1421c1e15f08c79fb3578a159251
data/.rubocop_todo.yml CHANGED
@@ -199,7 +199,7 @@ RSpec/MultipleDescribes:
199
199
  # Offense count: 134
200
200
  # Configuration parameters: AllowSubject.
201
201
  RSpec/MultipleMemoizedHelpers:
202
- Max: 17
202
+ Max: 18
203
203
 
204
204
  # Offense count: 500
205
205
  # Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.6.0](https://github.com/voxpupuli/beaker/tree/5.6.0) (2023-11-23)
4
+
5
+ **Implemented enhancements:**
6
+
7
+ - Use DNF for Amazon Linux 2023 [\#1832](https://github.com/voxpupuli/beaker/pull/1832) ([mhashizume](https://github.com/mhashizume))
8
+ - Use DNF for Fedora, newer Enterprise Linux [\#1835](https://github.com/voxpupuli/beaker/pull/1835) ([mhashizume](https://github.com/mhashizume))
9
+
10
+ **Fixed bugs:**
11
+
12
+ - Permit PlatformTagContainer class for beaker hosts [\#1833](https://github.com/voxpupuli/beaker/pull/1833) ([tlehman](https://github.com/tlehman))
13
+
14
+ ## [5.5.0](https://github.com/voxpupuli/beaker/tree/5.5.0) (2023-10-02)
15
+
16
+ [Full Changelog](https://github.com/voxpupuli/beaker/compare/5.4.0...5.5.0)
17
+
18
+ **Implemented enhancements:**
19
+
20
+ - Allow amazon as a platform [\#1824](https://github.com/voxpupuli/beaker/pull/1824) ([yachub](https://github.com/yachub))
21
+
3
22
  ## [5.4.0](https://github.com/voxpupuli/beaker/tree/5.4.0) (2023-09-12)
4
23
 
5
24
  [Full Changelog](https://github.com/voxpupuli/beaker/compare/5.3.0...5.4.0)
data/beaker.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.add_development_dependency 'fakefs', '~> 2.4'
23
23
  s.add_development_dependency 'rake', '~> 13.0'
24
24
  s.add_development_dependency 'rspec', '~> 3.0'
25
- s.add_development_dependency 'voxpupuli-rubocop', '~> 1.1'
25
+ s.add_development_dependency 'voxpupuli-rubocop', '~> 2.0.0'
26
26
 
27
27
  # Run time dependencies
28
28
  s.add_runtime_dependency 'minitar', '~> 0.6'
data/lib/beaker/cli.rb CHANGED
@@ -106,7 +106,7 @@ module Beaker
106
106
  end
107
107
 
108
108
  # Setup perf monitoring if needed
109
- @perf = Beaker::Perf.new(@hosts, @options) if /(aggressive)|(normal)/.match?(@options[:collect_perf_data].to_s)
109
+ @perf = Beaker::Perf.new(@hosts, @options) if /aggressive|normal/.match?(@options[:collect_perf_data].to_s)
110
110
 
111
111
  # pre acceptance phase
112
112
  run_suite(:pre_suite, :fast)
@@ -138,7 +138,7 @@ module Beaker
138
138
  end
139
139
 
140
140
  # cleanup on error
141
- if /(never)|(onpass)/.match?(@options[:preserve_hosts].to_s)
141
+ if /never|onpass/.match?(@options[:preserve_hosts].to_s)
142
142
  @logger.notify "Cleanup: cleaning up after failed run"
143
143
  @network_manager.cleanup if @network_manager
144
144
  else
@@ -159,7 +159,7 @@ module Beaker
159
159
  end
160
160
 
161
161
  # cleanup on success
162
- if /(never)|(onfail)/.match?(@options[:preserve_hosts].to_s)
162
+ if /never|onfail/.match?(@options[:preserve_hosts].to_s)
163
163
  @logger.notify "Cleanup: cleaning up after successful run"
164
164
  @network_manager.cleanup if @network_manager
165
165
  else
@@ -280,7 +280,7 @@ module Unix::Exec
280
280
  case self['platform']
281
281
  when /debian|ubuntu|cumulus|huaweios/
282
282
  exec(Beaker::Command.new("service ssh restart"))
283
- when /(el|centos|redhat|oracle|scientific)-[7-9]|eos-7|fedora-(1[4-9]|2[0-9]|3[0-9])|archlinux-/
283
+ when /amazon|(el|centos|redhat|oracle|scientific)-[7-9]|eos-7|fedora-(1[4-9]|2[0-9]|3[0-9])|archlinux-/
284
284
  exec(Beaker::Command.new("systemctl restart sshd.service"))
285
285
  when /el-|centos|fedora|redhat|oracle|scientific|eos/
286
286
  exec(Beaker::Command.new("/sbin/service sshd restart"))
@@ -302,7 +302,7 @@ module Unix::Exec
302
302
  # (from {#ssh_service_restart}).
303
303
  def ssh_permit_user_environment
304
304
  case self['platform']
305
- when /debian|ubuntu|cumulus|huaweios|archlinux|el-|centos|fedora|redhat|oracle|scientific|eos|opensuse|sles|solaris/
305
+ when /amazon|debian|ubuntu|cumulus|huaweios|archlinux|el-|centos|fedora|redhat|oracle|scientific|eos|opensuse|sles|solaris/
306
306
  directory = tmpdir
307
307
  exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
308
308
  exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
@@ -88,7 +88,7 @@ module Unix::File
88
88
  # @return [String] Path to package config dir
89
89
  def package_config_dir
90
90
  case self['platform']
91
- when /fedora|el-|redhat|centos/
91
+ when /amazon|fedora|el-|redhat|centos/
92
92
  '/etc/yum.repos.d/'
93
93
  when /opensuse|sles/
94
94
  '/etc/zypp/repos.d/'
@@ -149,7 +149,7 @@ module Unix::File
149
149
  # @return [String] Type of repo (rpm|deb)
150
150
  def repo_type
151
151
  case self['platform']
152
- when /fedora|el-|redhat|centos|opensuse|sles/
152
+ when /amazon|fedora|el-|redhat|centos|opensuse|sles/
153
153
  'rpm'
154
154
  when /debian|ubuntu|cumulus|huaweios/
155
155
  'deb'
@@ -40,7 +40,7 @@ module Unix::Pkg
40
40
  when /el-4/
41
41
  @logger.debug("Package query not supported on rhel4")
42
42
  return false
43
- when /cisco|fedora|centos|redhat|eos|el-/
43
+ when /amazon|cisco|fedora|centos|redhat|eos|el-/
44
44
  result = execute("rpm -q #{name}", opts) { |result| result }
45
45
  when /ubuntu|debian|cumulus|huaweios/
46
46
  result = execute("dpkg -s #{name}", opts) { |result| result }
@@ -87,10 +87,10 @@ module Unix::Pkg
87
87
  execute("zypper --non-interactive --gpg-auto-import-keys in #{name}", opts)
88
88
  when /el-4/
89
89
  @logger.debug("Package installation not supported on rhel4")
90
- when /fedora-(2[2-9]|3[0-9])/
90
+ when /amazon-2023|el-(8|9|1[0-9])|fedora/
91
91
  name = "#{name}-#{version}" if version
92
92
  execute("dnf -y #{cmdline_args} install #{name}", opts)
93
- when /cisco|fedora|centos|redhat|eos|el-/
93
+ when /cisco|centos|redhat|eos|el-[1-7]-/
94
94
  name = "#{name}-#{version}" if version
95
95
  execute("yum -y #{cmdline_args} install #{name}", opts)
96
96
  when /ubuntu|debian|cumulus|huaweios/
@@ -172,9 +172,9 @@ module Unix::Pkg
172
172
  execute("zypper --non-interactive rm #{name}", opts)
173
173
  when /el-4/
174
174
  @logger.debug("Package uninstallation not supported on rhel4")
175
- when /edora-(2[2-9]|3[0-9])/
175
+ when /amazon-2023|el-(8|9|1[0-9])|fedora/
176
176
  execute("dnf -y #{cmdline_args} remove #{name}", opts)
177
- when /cisco|fedora|centos|redhat|eos|el-/
177
+ when /cisco|centos|redhat|eos|el-[1-7]-/
178
178
  execute("yum -y #{cmdline_args} remove #{name}", opts)
179
179
  when /ubuntu|debian|cumulus|huaweios/
180
180
  execute("apt-get purge #{cmdline_args} -y #{name}", opts)
@@ -264,9 +264,9 @@ module Unix::Pkg
264
264
  def install_local_package(onhost_package_file, onhost_copy_dir = nil)
265
265
  variant, version, _arch, _codename = self['platform'].to_array
266
266
  case variant
267
- when /^(fedora|el|redhat|centos)$/
267
+ when /^(amazon|fedora|el|redhat|centos)$/
268
268
  command_name = 'yum'
269
- command_name = 'dnf' if variant == 'fedora' && version.to_i > 21
269
+ command_name = 'dnf' if (variant == 'fedora' && version.to_i > 21) || (variant == 'amazon' && version.to_i >= 2023)
270
270
  execute("#{command_name} --nogpgcheck localinstall -y #{onhost_package_file}")
271
271
  when /^(opensuse|sles)$/
272
272
  execute("zypper --non-interactive --no-gpg-checks in #{onhost_package_file}")
@@ -294,7 +294,7 @@ module Unix::Pkg
294
294
  def uncompress_local_tarball(onhost_tar_file, onhost_base_dir, download_file)
295
295
  variant, version, _arch, _codename = self['platform'].to_array
296
296
  case variant
297
- when /^(fedora|el|centos|redhat|opensuse|sles|debian|ubuntu|cumulus)$/
297
+ when /^(amazon|fedora|el|centos|redhat|opensuse|sles|debian|ubuntu|cumulus)$/
298
298
  execute("tar -zxvf #{onhost_tar_file} -C #{onhost_base_dir}")
299
299
  when /^solaris$/
300
300
  # uncompress PE puppet-agent tarball
data/lib/beaker/host.rb CHANGED
@@ -489,11 +489,7 @@ module Beaker
489
489
  # We enable achieve mode and compression
490
490
  rsync_args << "-az"
491
491
 
492
- user = if not self['user']
493
- "root"
494
- else
495
- self['user']
496
- end
492
+ user = self['user'] || 'root'
497
493
  hostname_with_user = "#{user}@#{reachable_name}"
498
494
 
499
495
  Rsync.host = hostname_with_user
@@ -10,6 +10,7 @@ module Beaker
10
10
  NTPSERVER = 'pool.ntp.org'
11
11
  SLEEPWAIT = 5
12
12
  TRIES = 5
13
+ AMAZON2023_PACKAGES = %w[curl-minimal chrony]
13
14
  RHEL8_PACKAGES = %w[curl chrony]
14
15
  RHEL9_PACKAGES = ['chrony']
15
16
  FEDORA_PACKAGES = %w[curl chrony]
@@ -49,7 +50,7 @@ module Beaker
49
50
  host.exec(Command.new("w32tm /resync"))
50
51
  logger.notify "NTP date succeeded on #{host}"
51
52
  else
52
- if /el-[89]|fedora/.match?(host['platform'])
53
+ if /amazon|el-[89]|fedora/.match?(host['platform'])
53
54
  ntp_command = "chronyc add server #{ntp_server} prefer trust;chronyc makestep;chronyc burst 1/2"
54
55
  elsif /opensuse-|sles-/.match?(host['platform'])
55
56
  ntp_command = "sntp #{ntp_server}"
@@ -108,6 +109,8 @@ module Beaker
108
109
  # @return [Array<String>] A list of packages to install
109
110
  def host_packages(host)
110
111
  case host['platform']
112
+ when /amazon/
113
+ AMAZON2023_PACKAGES
111
114
  when /el-8/
112
115
  RHEL8_PACKAGES
113
116
  when /el-9/
@@ -387,7 +390,7 @@ module Beaker
387
390
  # restart sshd
388
391
  if /debian|ubuntu|cumulus/.match?(host['platform'])
389
392
  host.exec(Command.new("sudo su -c \"service ssh restart\""), { :pty => true })
390
- elsif /arch|(centos|el|redhat)-[789]|fedora-(1[4-9]|2[0-9]|3[0-9])/.match?(host['platform'])
393
+ elsif /amazon|arch|(centos|el|redhat)-[789]|fedora-(1[4-9]|2[0-9]|3[0-9])/.match?(host['platform'])
391
394
  host.exec(Command.new("sudo -E systemctl restart sshd.service"), { :pty => true })
392
395
  elsif /centos|el-|redhat|fedora|eos/.match?(host['platform'])
393
396
  host.exec(Command.new("sudo -E /sbin/service sshd reload"), { :pty => true })
@@ -431,7 +434,7 @@ module Beaker
431
434
  case host['platform']
432
435
  when /ubuntu/, /debian/, /cumulus/
433
436
  host.exec(Command.new("echo 'Acquire::http::Proxy \"#{opts[:package_proxy]}/\";' >> /etc/apt/apt.conf.d/10proxy"))
434
- when /^el-/, /centos/, /fedora/, /redhat/, /eos/
437
+ when /amazon/, /^el-/, /centos/, /fedora/, /redhat/, /eos/
435
438
  host.exec(Command.new("echo 'proxy=#{opts[:package_proxy]}/' >> /etc/yum.conf"))
436
439
  when /solaris-11/
437
440
  host.exec(Command.new("/usr/bin/pkg unset-publisher solaris || :"))
@@ -4,6 +4,7 @@ module Beaker
4
4
  module HostsFileParser
5
5
  PERMITTED_YAML_CLASSES = [
6
6
  'Beaker',
7
+ 'Beaker::DSL::TestTagging::PlatformTagConfiner',
7
8
  'Beaker::Logger',
8
9
  'Beaker::Options::OptionsHash',
9
10
  'Beaker::Platform',
data/lib/beaker/perf.rb CHANGED
@@ -3,8 +3,8 @@ module Beaker
3
3
  class Perf
4
4
  PERF_PACKAGES = ['sysstat']
5
5
  # SLES does not treat sysstat as a service that can be started
6
- PERF_SUPPORTED_PLATFORMS = /debian|ubuntu|redhat|centos|oracle|scientific|fedora|el|eos|cumulus|opensuse|sles/
7
- PERF_START_PLATFORMS = /debian|ubuntu|redhat|centos|oracle|scientific|fedora|el|eos|cumulus/
6
+ PERF_SUPPORTED_PLATFORMS = /amazon|debian|ubuntu|redhat|centos|oracle|scientific|fedora|el|eos|cumulus|opensuse|sles/
7
+ PERF_START_PLATFORMS = /amazon|debian|ubuntu|redhat|centos|oracle|scientific|fedora|el|eos|cumulus/
8
8
 
9
9
  # Create the Perf instance and runs setup_perf_on_host on all hosts if --collect-perf-data
10
10
  # was used as an option on the Baker command line invocation. Instances of this class do not
@@ -47,7 +47,7 @@ module Beaker
47
47
  @logger.perf_output("Enabling aggressive sysstat polling")
48
48
  if /debian|ubuntu/.match?(host['platform'])
49
49
  host.exec(Command.new('sed -i s/5-55\\\/10/*/ /etc/cron.d/sysstat'))
50
- elsif /centos|el|fedora|oracle|redhat|scientific/.match?(host['platform'])
50
+ elsif /amazon|centos|el|fedora|oracle|redhat|scientific/.match?(host['platform'])
51
51
  host.exec(Command.new('sed -i s/*\\\/10/*/ /etc/cron.d/sysstat'))
52
52
  end
53
53
  end
@@ -3,7 +3,9 @@ module Beaker
3
3
  # all String methods while adding several platform-specific use cases.
4
4
  class Platform < String
5
5
  # Supported platforms
6
- PLATFORMS = /^(alpine|huaweios|cisco_nexus|cisco_ios_xr|(free|open)bsd|osx|centos|fedora|debian|oracle|redhat|redhatfips|scientific|opensuse|sles|ubuntu|windows|solaris|aix|archlinux|el|eos|cumulus|f5|netscaler)\-.+\-.+$/
6
+ # rubocop:disable Layout/LineLength
7
+ PLATFORMS = /^(alpine|amazon|huaweios|cisco_nexus|cisco_ios_xr|(free|open)bsd|osx|centos|fedora|debian|oracle|redhat|redhatfips|scientific|opensuse|sles|ubuntu|windows|solaris|aix|archlinux|el|eos|cumulus|f5|netscaler)\-.+\-.+$/
8
+ # rubocop:enable Layout/LineLength
7
9
  # Platform version numbers vs. codenames conversion hash
8
10
  PLATFORM_VERSION_CODES =
9
11
  { :debian => { "forky" => "14",
@@ -56,6 +58,7 @@ module Beaker
56
58
  # Creates the Platform object. Checks to ensure that the platform String
57
59
  # provided meets the platform formatting rules. Platforms name must be of
58
60
  # the format /^OSFAMILY-VERSION-ARCH.*$/ where OSFAMILY is one of:
61
+ # * amazon
59
62
  # * huaweios
60
63
  # * cisco_nexus
61
64
  # * cisco_ios_xr
@@ -114,9 +117,7 @@ module Beaker
114
117
  # @example Platform.new('debian-7-xxx').with_version_codename == 'debian-wheezy-xxx'
115
118
  # @return [String] the platform string with the platform version represented as a codename
116
119
  def with_version_codename
117
- version_array = [@variant, @version, @arch]
118
- version_array = [@variant, @codename, @arch] if @codename
119
- return version_array.join('-')
120
+ [@variant, @codename || @version, @arch].join('-')
120
121
  end
121
122
 
122
123
  # Returns the platform string with the platform version as a number. If no conversion is necessary
@@ -1,5 +1,5 @@
1
1
  module Beaker
2
2
  module Version
3
- STRING = '5.4.0'
3
+ STRING = '5.6.0'
4
4
  end
5
5
  end
@@ -33,7 +33,7 @@ module Beaker
33
33
  let(:instance) { UnixFileTest.new(opts.merge(platform), logger) }
34
34
 
35
35
  describe '#repo_type' do
36
- %w[centos redhat].each do |platform|
36
+ %w[amazon centos redhat].each do |platform|
37
37
  it "returns correctly for platform '#{platform}'" do
38
38
  @platform = "#{platform}-5-x86_64"
39
39
  expect(instance.repo_type).to be === 'rpm'
@@ -54,7 +54,7 @@ module Beaker
54
54
  end
55
55
 
56
56
  describe '#package_config_dir' do
57
- %w[centos redhat].each do |platform|
57
+ %w[amazon centos redhat].each do |platform|
58
58
  it "returns correctly for platform '#{platform}'" do
59
59
  @platform = "#{platform}-5-x86_64"
60
60
  expect(instance.package_config_dir).to be === '/etc/yum.repos.d/'
@@ -58,7 +58,7 @@ module Beaker
58
58
  expect(instance.check_for_package(pkg)).to be === true
59
59
  end
60
60
 
61
- %w[centos redhat].each do |platform|
61
+ %w[amazon centos redhat].each do |platform|
62
62
  it "checks correctly on #{platform}" do
63
63
  @opts = { 'platform' => "#{platform}-is-me" }
64
64
  pkg = "#{platform}_package"
@@ -175,24 +175,20 @@ module Beaker
175
175
  end
176
176
  end
177
177
 
178
- (1..21).to_a.each do |fedora_release|
179
- it "uses yum on fedora-#{fedora_release}" do
180
- @opts = { 'platform' => "fedora-#{fedora_release}-is-me" }
181
- pkg = 'fedora_package'
182
- expect(Beaker::Command).to receive(:new).with("yum -y install #{pkg}", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
183
- expect(instance).to receive(:exec).with('', {}).and_return(generate_result("hello", { :exit_code => 0 }))
184
- expect(instance.install_package(pkg)).to be == "hello"
185
- end
178
+ it "uses dnf on fedora" do
179
+ @opts = { 'platform' => "fedora-is-me" }
180
+ pkg = 'fedora_package'
181
+ expect(Beaker::Command).to receive(:new).with("dnf -y install #{pkg}", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
182
+ expect(instance).to receive(:exec).with('', {}).and_return(generate_result("hello", { :exit_code => 0 }))
183
+ expect(instance.install_package(pkg)).to be == "hello"
186
184
  end
187
185
 
188
- (22..39).to_a.each do |fedora_release|
189
- it "uses dnf on fedora-#{fedora_release}" do
190
- @opts = { 'platform' => "fedora-#{fedora_release}-is-me" }
191
- pkg = 'fedora_package'
192
- expect(Beaker::Command).to receive(:new).with("dnf -y install #{pkg}", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
193
- expect(instance).to receive(:exec).with('', {}).and_return(generate_result("hello", { :exit_code => 0 }))
194
- expect(instance.install_package(pkg)).to be == "hello"
195
- end
186
+ it "uses dnf on amazon-2023" do
187
+ @opts = { 'platform' => "amazon-2023-is-me" }
188
+ pkg = 'amazon_package'
189
+ expect(Beaker::Command).to receive(:new).with("dnf -y install #{pkg}", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
190
+ expect(instance).to receive(:exec).with('', {}).and_return(generate_result("hello", { :exit_code => 0 }))
191
+ expect(instance.install_package(pkg)).to be == "hello"
196
192
  end
197
193
 
198
194
  it "uses pacman on archlinux" do
@@ -213,24 +209,12 @@ module Beaker
213
209
  expect(instance.uninstall_package('pkg')).to be == "hello"
214
210
  end
215
211
 
216
- (1..21).to_a.each do |fedora_release|
217
- it "uses yum on fedora-#{fedora_release}" do
218
- @opts = { 'platform' => "fedora-#{fedora_release}-is-me" }
219
- pkg = 'fedora_package'
220
- expect(Beaker::Command).to receive(:new).with("yum -y remove #{pkg}", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
221
- expect(instance).to receive(:exec).with('', {}).and_return(generate_result("hello", { :exit_code => 0 }))
222
- expect(instance.uninstall_package(pkg)).to be == "hello"
223
- end
224
- end
225
-
226
- (22..39).to_a.each do |fedora_release|
227
- it "uses dnf on fedora-#{fedora_release}" do
228
- @opts = { 'platform' => "fedora-#{fedora_release}-is-me" }
229
- pkg = 'fedora_package'
230
- expect(Beaker::Command).to receive(:new).with("dnf -y remove #{pkg}", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
231
- expect(instance).to receive(:exec).with('', {}).and_return(generate_result("hello", { :exit_code => 0 }))
232
- expect(instance.uninstall_package(pkg)).to be == "hello"
233
- end
212
+ it "uses dnf on fedora" do
213
+ @opts = { 'platform' => "fedora-is-me" }
214
+ pkg = 'fedora_package'
215
+ expect(Beaker::Command).to receive(:new).with("dnf -y remove #{pkg}", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
216
+ expect(instance).to receive(:exec).with('', {}).and_return(generate_result("hello", { :exit_code => 0 }))
217
+ expect(instance.uninstall_package(pkg)).to be == "hello"
234
218
  end
235
219
  end
236
220
  end
@@ -291,6 +275,14 @@ module Beaker
291
275
  allow(instance).to receive(:[]).with('platform') { Beaker::Platform.new("#{platform}-#{version}-x86_64") }
292
276
  end
293
277
 
278
+ it 'amazon-2023: uses dnf' do
279
+ @platform = platform
280
+ @version = '2023'
281
+ package_file = 'test_123.yay'
282
+ expect(instance).to receive(:execute).with(/^dnf.*#{package_file}$/)
283
+ instance.install_local_package(package_file)
284
+ end
285
+
294
286
  it 'Fedora 22-39: uses dnf' do
295
287
  (22...39).each do |version|
296
288
  @version = version
@@ -11,6 +11,7 @@ describe Beaker do
11
11
  let(:sles_only_pkgs) { Beaker::HostPrebuiltSteps::SLES_PACKAGES }
12
12
  let(:rhel8_packages) { Beaker::HostPrebuiltSteps::RHEL8_PACKAGES }
13
13
  let(:fedora_packages) { Beaker::HostPrebuiltSteps::FEDORA_PACKAGES }
14
+ let(:amazon2023_packages) { Beaker::HostPrebuiltSteps::AMAZON2023_PACKAGES }
14
15
  let(:platform) { @platform || 'unix' }
15
16
  let(:ip) { "ip.address.0.0" }
16
17
  let(:stdout) { @stdout || ip }
@@ -85,6 +86,11 @@ describe Beaker do
85
86
  "if grep \"root::::type=role\" /etc/user_attr; then sudo rolemod -K type=normal root; else echo \"root user already type=normal\"; fi",
86
87
  ], true
87
88
 
89
+ it_behaves_like 'enables_root_login', 'amazon-2023', [
90
+ "sudo -E systemctl restart sshd.service",
91
+ "sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\"",
92
+ ]
93
+
88
94
  %w[debian ubuntu cumulus].each do |deb_like|
89
95
  it_behaves_like 'enables_root_login', deb_like, [
90
96
  "sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\"",
@@ -147,6 +153,15 @@ describe Beaker do
147
153
  subject.timesync(hosts, options)
148
154
  end
149
155
 
156
+ it "can sync time on amazon2023 hosts" do
157
+ hosts = make_hosts(:platform => 'amazon-2023-x86_64')
158
+ expect(Beaker::Command).to receive(:new)
159
+ .with("chronyc add server #{ntpserver} prefer trust;chronyc makestep;chronyc burst 1/2")
160
+ .exactly(3)
161
+ .times
162
+ subject.timesync(hosts, options)
163
+ end
164
+
150
165
  it "can sync time on RHEL8 hosts" do
151
166
  hosts = make_hosts(:platform => 'el-8-x86_x64')
152
167
  expect(Beaker::Command).to receive(:new)
@@ -358,6 +373,19 @@ describe Beaker do
358
373
  subject.validate_host(hosts, options)
359
374
  end
360
375
 
376
+ it "can validate Amazon hosts" do
377
+ @platform = 'amazon-2023-x86_64'
378
+
379
+ hosts.each do |host|
380
+ amazon2023_packages.each do |pkg|
381
+ expect(host).to receive(:check_for_package).with(pkg).once.and_return(false)
382
+ expect(host).to receive(:install_package).with(pkg).once
383
+ end
384
+ end
385
+
386
+ subject.validate_host(hosts, options)
387
+ end
388
+
361
389
  it 'skips validation on cisco hosts' do
362
390
  host = make_host('cisco-7', { stdout: stdout, platform: 'cisco_nexus-7-x86_64' })
363
391
  expect(subject).to receive(:check_and_install_packages_if_needed).with(host, []).once
@@ -404,7 +432,7 @@ describe Beaker do
404
432
  end
405
433
  end
406
434
 
407
- %w[centos redhat].each do |platform|
435
+ %w[amazon centos redhat].each do |platform|
408
436
  context "on platform '#{platform}'" do
409
437
  let(:host) do
410
438
  make_host('name', {
@@ -483,7 +511,7 @@ describe Beaker do
483
511
  subject.package_proxy(host, options.merge({ 'package_proxy' => proxyurl }))
484
512
  end
485
513
 
486
- %w[centos redhat].each do |platform|
514
+ %w[amazon centos redhat].each do |platform|
487
515
  it "can set proxy config on a '#{platform}' host" do
488
516
  host = make_host('name', { :platform => platform })
489
517
 
data/spec/helpers.rb CHANGED
@@ -127,7 +127,8 @@ module PlatformHelpers
127
127
 
128
128
  FEDORASYSTEMD = (14..39).to_a.collect! { |i| "fedora-#{i}" }
129
129
 
130
- SYSTEMDPLATFORMS = %w[el-7
130
+ SYSTEMDPLATFORMS = %w[amazon-2023
131
+ el-7
131
132
  centos-7
132
133
  redhat-7
133
134
  oracle-7
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.4.0
4
+ version: 5.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-12 00:00:00.000000000 Z
11
+ date: 2023-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fakefs
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.1'
61
+ version: 2.0.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.1'
68
+ version: 2.0.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: minitar
71
71
  requirement: !ruby/object:Gem::Requirement