beaker 4.40.2 → 4.41.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: f20284823ba7135cb7d216cb4c5680fc96846ed43eb9103f015e183070049041
4
- data.tar.gz: a4b459893307c1a792a53c7794ca5bb86d8997b87f928103511b96fe84e328cf
3
+ metadata.gz: 525b6a9075032237a7a0432d2c7e016d60864f5bffa4cf1be154f55b80a295ab
4
+ data.tar.gz: c0bc73ad7426ec048475bd55cbb9338349cb3b498ae03e281a2be5acef923e5a
5
5
  SHA512:
6
- metadata.gz: '00409a147c67f50a438215422b247fa691918dd58d48951f984f1e25223b368e29bccda577aee39a71befaee233c5ce1a28afa87b297f537fa4590bc5b833a16'
7
- data.tar.gz: 56a82b85aa6da9f4344cee95ffe92ab3e9a7d6d9a24f7dda5bdf61c7b552541420045646f644e47ecce0b239e6e99b81a1202dcd1336fc0bcbee9fe80b85c3bd
6
+ metadata.gz: 67890b5331b7474ac34566e3f6781f9eef91b4993238520b0c4a3584acfde5a41a2adafaa8eccd80aca32fbcdc4cbfabca51da40c5e07f3eb6e12cf9ad0b0d03
7
+ data.tar.gz: a4996b26068c591881df3b2d8bc88ccb88b08f4501250765488a5f30553d2346e7a2f42e63133a0b39183f3679d7debace57140b4601855b6646e9d050ed03e3
data/.rubocop_todo.yml CHANGED
@@ -151,7 +151,7 @@ RSpec/MultipleDescribes:
151
151
 
152
152
  # Configuration parameters: AllowSubject.
153
153
  RSpec/MultipleMemoizedHelpers:
154
- Max: 19
154
+ Max: 20
155
155
 
156
156
  # Configuration parameters: IgnoreSharedExamples.
157
157
  RSpec/NamedSubject:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.41.0](https://github.com/voxpupuli/beaker/tree/4.41.0) (2023-11-15)
4
+
5
+ [Full Changelog](https://github.com/voxpupuli/beaker/compare/4.40.2...4.41.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - \[PA-5938\] Add support for debian & amazon linux in beaker 4.x [\#1828](https://github.com/voxpupuli/beaker/pull/1828) ([span786](https://github.com/span786))
10
+
3
11
  ## [4.40.2](https://github.com/voxpupuli/beaker/tree/4.40.2) (2023-07-26)
4
12
 
5
13
  [Full Changelog](https://github.com/voxpupuli/beaker/compare/4.40.1...4.40.2)
@@ -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-7|centos-7|redhat-7|oracle-7|scientific-7|eos-7|el-8|centos-8|redhat-8|oracle-8|fedora-(1[4-9]|2[0-9]|3[0-9])|archlinux-/
283
+ when /amazon|el-7|centos-7|redhat-7|oracle-7|scientific-7|eos-7|el-8|centos-8|redhat-8|oracle-8|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,8 +302,8 @@ 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/
306
- directory = tmpdir()
305
+ when /amazon|debian|ubuntu|cumulus|huaweios|archlinux|el-|centos|fedora|redhat|oracle|scientific|eos|opensuse|sles|solaris/
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"))
309
309
  exec(Beaker::Command.new("echo '' >/etc/environment")) if /ubuntu-2(0|2).04/.match?(self['platform'])
@@ -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/'
@@ -154,7 +154,7 @@ module Unix::File
154
154
  # @return [String] Type of repo (rpm|deb)
155
155
  def repo_type
156
156
  case self['platform']
157
- when /fedora|el-|redhat|centos|opensuse|sles/
157
+ when /amazon|fedora|el-|redhat|centos|opensuse|sles/
158
158
  'rpm'
159
159
  when /debian|ubuntu|cumulus|huaweios/
160
160
  '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 }
@@ -96,7 +96,7 @@ module Unix::Pkg
96
96
  name = "#{name}-#{version}"
97
97
  end
98
98
  execute("dnf -y #{cmdline_args} install #{name}", opts)
99
- when /cisco|fedora|centos|redhat|eos|el-/
99
+ when /amazon|cisco|fedora|centos|redhat|eos|el-/
100
100
  if version
101
101
  name = "#{name}-#{version}"
102
102
  end
@@ -179,26 +179,26 @@ module Unix::Pkg
179
179
 
180
180
  def uninstall_package(name, cmdline_args = '', opts = {})
181
181
  case self['platform']
182
- when /opensuse|sles-/
183
- execute("zypper --non-interactive rm #{name}", opts)
184
- when /el-4/
185
- @logger.debug("Package uninstallation not supported on rhel4")
186
- when /edora-(2[2-9]|3[0-9])/
187
- execute("dnf -y #{cmdline_args} remove #{name}", opts)
188
- when /cisco|fedora|centos|redhat|eos|el-/
189
- execute("yum -y #{cmdline_args} remove #{name}", opts)
190
- when /ubuntu|debian|cumulus|huaweios/
191
- execute("apt-get purge #{cmdline_args} -y #{name}", opts)
192
- when /solaris-11/
193
- execute("pkg #{cmdline_args} uninstall #{name}", opts)
194
- when /solaris-10/
195
- execute("pkgrm -n #{cmdline_args} #{name}", opts)
196
- when /aix/
197
- execute("rpm #{cmdline_args} -e #{name}", opts)
198
- when /archlinux/
199
- execute("pacman -R --noconfirm #{cmdline_args} #{name}", opts)
200
- else
201
- raise "Package #{name} cannot be installed on #{self}"
182
+ when /opensuse|sles-/
183
+ execute("zypper --non-interactive rm #{name}", opts)
184
+ when /el-4/
185
+ @logger.debug("Package uninstallation not supported on rhel4")
186
+ when /amazon|fedora-(2[2-9]|3[0-9])/
187
+ execute("dnf -y #{cmdline_args} remove #{name}", opts)
188
+ when /cisco|fedora|centos|redhat|eos|el-/
189
+ execute("yum -y #{cmdline_args} remove #{name}", opts)
190
+ when /ubuntu|debian|cumulus|huaweios/
191
+ execute("apt-get purge #{cmdline_args} -y #{name}", opts)
192
+ when /solaris-11/
193
+ execute("pkg #{cmdline_args} uninstall #{name}", opts)
194
+ when /solaris-10/
195
+ execute("pkgrm -n #{cmdline_args} #{name}", opts)
196
+ when /aix/
197
+ execute("rpm #{cmdline_args} -e #{name}", opts)
198
+ when /archlinux/
199
+ execute("pacman -R --noconfirm #{cmdline_args} #{name}", opts)
200
+ else
201
+ raise "Package #{name} cannot be installed on #{self}"
202
202
  end
203
203
  end
204
204
 
@@ -527,9 +527,9 @@ module Unix::Pkg
527
527
  def install_local_package(onhost_package_file, onhost_copy_dir = nil)
528
528
  variant, version, _arch, _codename = self['platform'].to_array
529
529
  case variant
530
- when /^(fedora|el|redhat|centos)$/
530
+ when /^(amazon|fedora|el|redhat|centos)$/
531
531
  command_name = 'yum'
532
- command_name = 'dnf' if variant == 'fedora' && version.to_i > 21
532
+ command_name = 'dnf' if (variant == 'fedora' && version.to_i > 21) || (variant == 'amazon' && version.to_i >= 2023)
533
533
  execute("#{command_name} --nogpgcheck localinstall -y #{onhost_package_file}")
534
534
  when /^(opensuse|sles)$/
535
535
  execute("zypper --non-interactive --no-gpg-checks in #{onhost_package_file}")
@@ -557,7 +557,7 @@ module Unix::Pkg
557
557
  def uncompress_local_tarball(onhost_tar_file, onhost_base_dir, download_file)
558
558
  variant, version, _arch, _codename = self['platform'].to_array
559
559
  case variant
560
- when /^(fedora|el|centos|redhat|opensuse|sles|debian|ubuntu|cumulus)$/
560
+ when /^(amazon|fedora|el|centos|redhat|opensuse|sles|debian|ubuntu|cumulus)$/
561
561
  execute("tar -zxvf #{onhost_tar_file} -C #{onhost_base_dir}")
562
562
  when /^solaris$/
563
563
  # uncompress PE puppet-agent tarball
@@ -12,7 +12,8 @@ module Beaker
12
12
  NTPSERVER = 'pool.ntp.org'
13
13
  SLEEPWAIT = 5
14
14
  TRIES = 5
15
- RHEL8_PACKAGES = ['curl', 'chrony']
15
+ AMAZON2023_PACKAGES = %w[curl-minimal chrony]
16
+ RHEL8_PACKAGES = %w[curl chrony]
16
17
  RHEL9_PACKAGES = ['chrony']
17
18
  FEDORA_PACKAGES = ['curl', 'chrony']
18
19
  UNIX_PACKAGES = ['curl', 'ntpdate']
@@ -54,7 +55,7 @@ module Beaker
54
55
  logger.notify "NTP date succeeded on #{host}"
55
56
  else
56
57
  case
57
- when /el-[89]|fedora/.match?(host['platform'])
58
+ when /amazon|el-[89]|fedora/.match?(host['platform'])
58
59
  ntp_command = "chronyc add server #{ntp_server} prefer trust;chronyc makestep;chronyc burst 1/2"
59
60
  when /opensuse-|sles-/.match?(host['platform'])
60
61
  ntp_command = "sntp #{ntp_server}"
@@ -114,6 +115,8 @@ module Beaker
114
115
  # @return [Array<String>] A list of packages to install
115
116
  def host_packages(host)
116
117
  case host['platform']
118
+ when /amazon/
119
+ AMAZON2023_PACKAGES
117
120
  when /el-8/
118
121
  RHEL8_PACKAGES
119
122
  when /el-9/
@@ -461,9 +464,9 @@ module Beaker
461
464
  end
462
465
  #restart sshd
463
466
  if /debian|ubuntu|cumulus/.match?(host['platform'])
464
- host.exec(Command.new("sudo su -c \"service ssh restart\""), {:pty => true})
465
- elsif /arch|(centos|el|redhat)-[789]|fedora-(1[4-9]|2[0-9]|3[0-9])/.match?(host['platform'])
466
- host.exec(Command.new("sudo -E systemctl restart sshd.service"), {:pty => true})
467
+ host.exec(Command.new("sudo su -c \"service ssh restart\""), { :pty => true })
468
+ elsif /amazon|arch|(centos|el|redhat)-[789]|fedora-(1[4-9]|2[0-9]|3[0-9])/.match?(host['platform'])
469
+ host.exec(Command.new("sudo -E systemctl restart sshd.service"), { :pty => true })
467
470
  elsif /centos|el-|redhat|fedora|eos/.match?(host['platform'])
468
471
  host.exec(Command.new("sudo -E /sbin/service sshd reload"), {:pty => true})
469
472
  elsif /(free|open)bsd/.match?(host['platform'])
@@ -520,10 +523,10 @@ module Beaker
520
523
  block_on host do |host|
521
524
  logger.debug("enabling proxy support on #{host.name}")
522
525
  case host['platform']
523
- when /ubuntu/, /debian/, /cumulus/
524
- host.exec(Command.new("echo 'Acquire::http::Proxy \"#{opts[:package_proxy]}/\";' >> /etc/apt/apt.conf.d/10proxy"))
525
- when /^el-/, /centos/, /fedora/, /redhat/, /eos/
526
- host.exec(Command.new("echo 'proxy=#{opts[:package_proxy]}/' >> /etc/yum.conf"))
526
+ when /ubuntu/, /debian/, /cumulus/
527
+ host.exec(Command.new("echo 'Acquire::http::Proxy \"#{opts[:package_proxy]}/\";' >> /etc/apt/apt.conf.d/10proxy"))
528
+ when /amazon/, /^el-/, /centos/, /fedora/, /redhat/, /eos/
529
+ host.exec(Command.new("echo 'proxy=#{opts[:package_proxy]}/' >> /etc/yum.conf"))
527
530
  else
528
531
  logger.debug("Attempting to enable package manager proxy support on non-supported platform: #{host.name}: #{host['platform']}")
529
532
  end
data/lib/beaker/perf.rb CHANGED
@@ -4,8 +4,8 @@ module Beaker
4
4
 
5
5
  PERF_PACKAGES = ['sysstat']
6
6
  # SLES does not treat sysstat as a service that can be started
7
- PERF_SUPPORTED_PLATFORMS = /debian|ubuntu|redhat|centos|oracle|scientific|fedora|el|eos|cumulus|opensuse|sles/
8
- PERF_START_PLATFORMS = /debian|ubuntu|redhat|centos|oracle|scientific|fedora|el|eos|cumulus/
7
+ PERF_SUPPORTED_PLATFORMS = /amazon|debian|ubuntu|redhat|centos|oracle|scientific|fedora|el|eos|cumulus|opensuse|sles/
8
+ PERF_START_PLATFORMS = /amazon|debian|ubuntu|redhat|centos|oracle|scientific|fedora|el|eos|cumulus/
9
9
 
10
10
  # Create the Perf instance and runs setup_perf_on_host on all hosts if --collect-perf-data
11
11
  # was used as an option on the Baker command line invocation. Instances of this class do not
@@ -50,7 +50,7 @@ module Beaker
50
50
  @logger.perf_output("Enabling aggressive sysstat polling")
51
51
  if /debian|ubuntu/.match?(host['platform'])
52
52
  host.exec(Command.new('sed -i s/5-55\\\/10/*/ /etc/cron.d/sysstat'))
53
- elsif /centos|el|fedora|oracle|redhat|scientific/.match?(host['platform'])
53
+ elsif /amazon|centos|el|fedora|oracle|redhat|scientific/.match?(host['platform'])
54
54
  host.exec(Command.new('sed -i s/*\\\/10/*/ /etc/cron.d/sysstat'))
55
55
  end
56
56
  end
@@ -3,24 +3,26 @@ 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
+ 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)\-.+\-.+$/
7
7
  # Platform version numbers vs. codenames conversion hash
8
8
  PLATFORM_VERSION_CODES =
9
- { :debian => { "bullseye" => "11",
10
- "buster" => "10",
11
- "stretch" => "9",
12
- "jessie" => "8",
13
- "wheezy" => "7",
14
- "squeeze" => "6",
15
- },
16
- :ubuntu => { "jammy" => "2204",
17
- "focal" => "2004",
18
- "eoan" => "1910",
19
- "disco" => "1904",
20
- "cosmic" => "1810",
21
- "bionic" => "1804",
22
- "artful" => "1710",
23
- "zesty" => "1704",
9
+ { :debian => { "forky" => "14",
10
+ "trixie" => "13",
11
+ "bookworm" => "12",
12
+ "bullseye" => "11",
13
+ "buster" => "10",
14
+ "stretch" => "9",
15
+ "jessie" => "8",
16
+ "wheezy" => "7",
17
+ "squeeze" => "6", },
18
+ :ubuntu => { "jammy" => "2204",
19
+ "focal" => "2004",
20
+ "eoan" => "1910",
21
+ "disco" => "1904",
22
+ "cosmic" => "1810",
23
+ "bionic" => "1804",
24
+ "artful" => "1710",
25
+ "zesty" => "1704",
24
26
  "yakkety" => "1610",
25
27
  "xenial" => "1604",
26
28
  "wily" => "1510",
@@ -57,6 +59,7 @@ module Beaker
57
59
  # Creates the Platform object. Checks to ensure that the platform String
58
60
  # provided meets the platform formatting rules. Platforms name must be of
59
61
  # the format /^OSFAMILY-VERSION-ARCH.*$/ where OSFAMILY is one of:
62
+ # * amazon
60
63
  # * huaweios
61
64
  # * cisco_nexus
62
65
  # * cisco_ios_xr
@@ -1,5 +1,5 @@
1
1
  module Beaker
2
2
  module Version
3
- STRING = '4.40.2'
3
+ STRING = '4.41.0'
4
4
  end
5
5
  end
@@ -36,8 +36,7 @@ module Beaker
36
36
  let(:instance) { UnixFileTest.new(opts.merge(platform), logger) }
37
37
 
38
38
  describe '#repo_type' do
39
-
40
- ['centos','redhat'].each do |platform|
39
+ %w[amazon centos redhat].each do |platform|
41
40
  it "returns correctly for platform '#{platform}'" do
42
41
  @platform = "#{platform}-5-x86_64"
43
42
  expect( instance.repo_type ).to be === 'rpm'
@@ -58,8 +57,7 @@ module Beaker
58
57
  end
59
58
 
60
59
  describe '#package_config_dir' do
61
-
62
- ['centos','redhat'].each do |platform|
60
+ %w[amazon centos redhat].each do |platform|
63
61
  it "returns correctly for platform '#{platform}'" do
64
62
  @platform = "#{platform}-5-x86_64"
65
63
  expect( instance.package_config_dir ).to be === '/etc/yum.repos.d/'
@@ -127,7 +127,7 @@ module Beaker
127
127
  expect( instance.check_for_package(pkg) ).to be === true
128
128
  end
129
129
 
130
- ['centos','redhat'].each do |platform|
130
+ %w[amazon centos redhat].each do |platform|
131
131
  it "checks correctly on #{platform}" do
132
132
  @opts = {'platform' => "#{platform}-is-me"}
133
133
  pkg = "#{platform}_package"
@@ -267,12 +267,20 @@ module Beaker
267
267
  end
268
268
  end
269
269
 
270
+ it "uses dnf on amazon-2023" do
271
+ @opts = { 'platform' => "amazon-2023-is-me" }
272
+ pkg = 'amazon_package'
273
+ expect(Beaker::Command).to receive(:new).with("yum -y install #{pkg}", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
274
+ expect(instance).to receive(:exec).with('', {}).and_return(generate_result("hello", { :exit_code => 0 }))
275
+ expect(instance.install_package(pkg)).to be == "hello"
276
+ end
277
+
270
278
  it "uses pacman on archlinux" do
271
- @opts = {'platform' => 'archlinux-is-me'}
279
+ @opts = { 'platform' => 'archlinux-is-me' }
272
280
  pkg = 'archlinux_package'
273
- expect( Beaker::Command ).to receive(:new).with("pacman -S --noconfirm #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
274
- expect( instance ).to receive(:exec).with('', {}).and_return(generate_result("hello", {:exit_code => 0}))
275
- expect( instance.install_package(pkg) ).to be == "hello"
281
+ expect(Beaker::Command).to receive(:new).with("pacman -S --noconfirm #{pkg}", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
282
+ expect(instance).to receive(:exec).with('', {}).and_return(generate_result("hello", { :exit_code => 0 }))
283
+ expect(instance.install_package(pkg)).to be == "hello"
276
284
  end
277
285
  end
278
286
 
@@ -531,7 +539,15 @@ module Beaker
531
539
  let( :version ) { @version || 6 }
532
540
 
533
541
  before do
534
- allow( instance ).to receive( :[] ).with( 'platform' ) { Beaker::Platform.new("#{platform}-#{version}-x86_64") }
542
+ allow(instance).to receive(:[]).with('platform') { Beaker::Platform.new("#{platform}-#{version}-x86_64") }
543
+ end
544
+
545
+ it 'amazon-2023: uses dnf' do
546
+ @platform = platform
547
+ @version = '2023'
548
+ package_file = 'test_123.yay'
549
+ expect(instance).to receive(:execute).with(/^dnf.*#{package_file}$/)
550
+ instance.install_local_package(package_file)
535
551
  end
536
552
 
537
553
  it 'Fedora 22-39: uses dnf' do
@@ -654,4 +670,3 @@ module Beaker
654
670
  end
655
671
  end
656
672
  end
657
-
@@ -13,6 +13,7 @@ describe Beaker do
13
13
  let( :sles_only_pkgs ) { Beaker::HostPrebuiltSteps::SLES_PACKAGES }
14
14
  let( :rhel8_packages ) { Beaker::HostPrebuiltSteps::RHEL8_PACKAGES }
15
15
  let( :fedora_packages) { Beaker::HostPrebuiltSteps::FEDORA_PACKAGES }
16
+ let(:amazon2023_packages) { Beaker::HostPrebuiltSteps::AMAZON2023_PACKAGES }
16
17
  let( :platform ) { @platform || 'unix' }
17
18
  let( :ip ) { "ip.address.0.0" }
18
19
  let( :stdout) { @stdout || ip }
@@ -87,7 +88,12 @@ describe Beaker do
87
88
  "if grep \"root::::type=role\" /etc/user_attr; then sudo rolemod -K type=normal root; else echo \"root user already type=normal\"; fi"
88
89
  ], true
89
90
 
90
- ['debian','ubuntu','cumulus'].each do | deb_like |
91
+ it_behaves_like 'enables_root_login', 'amazon-2023', [
92
+ "sudo -E systemctl restart sshd.service",
93
+ "sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\"",
94
+ ]
95
+
96
+ %w[debian ubuntu cumulus].each do |deb_like|
91
97
  it_behaves_like 'enables_root_login', deb_like, [
92
98
  "sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\"",
93
99
  "sudo su -c \"service ssh restart\""
@@ -144,12 +150,20 @@ describe Beaker do
144
150
  end
145
151
 
146
152
  it "can sync time on Sles hosts" do
147
- hosts = make_hosts( { :platform => 'sles-13.1-x64' } )
153
+ hosts = make_hosts({ :platform => 'sles-13.1-x64' })
148
154
 
149
- expect( Beaker::Command ).to receive( :new ).with("sntp #{ntpserver}").exactly( 3 ).times
155
+ expect(Beaker::Command).to receive(:new).with("sntp #{ntpserver}").exactly(3).times
150
156
 
151
- subject.timesync( hosts, options )
157
+ subject.timesync(hosts, options)
158
+ end
152
159
 
160
+ it "can sync time on amazon2023 hosts" do
161
+ hosts = make_hosts(:platform => 'amazon-2023-x86_64')
162
+ expect(Beaker::Command).to receive(:new)
163
+ .with("chronyc add server #{ntpserver} prefer trust;chronyc makestep;chronyc burst 1/2")
164
+ .exactly(3)
165
+ .times
166
+ subject.timesync(hosts, options)
153
167
  end
154
168
 
155
169
  it "can sync time on RHEL8 hosts" do
@@ -489,6 +503,19 @@ describe Beaker do
489
503
  subject.validate_host(hosts, options)
490
504
  end
491
505
 
506
+ it "can validate Amazon hosts" do
507
+ @platform = 'amazon-2023-x86_64'
508
+
509
+ hosts.each do |host|
510
+ amazon2023_packages.each do |pkg|
511
+ expect(host).to receive(:check_for_package).with(pkg).once.and_return(false)
512
+ expect(host).to receive(:install_package).with(pkg).once
513
+ end
514
+ end
515
+
516
+ subject.validate_host(hosts, options)
517
+ end
518
+
492
519
  it 'skips validation on cisco hosts' do
493
520
  host = make_host('cisco-7', { stdout: stdout, platform: 'cisco_nexus-7-x86_64' })
494
521
  expect( subject ).to receive( :check_and_install_packages_if_needed ).with(host, []).once
@@ -533,7 +560,7 @@ describe Beaker do
533
560
  end
534
561
  end
535
562
 
536
- ['centos','redhat'].each do |platform|
563
+ %w[amazon centos redhat].each do |platform|
537
564
  context "on platform '#{platform}'" do
538
565
  let(:host) { make_host( 'name', {
539
566
  :platform => platform,
@@ -635,7 +662,7 @@ describe Beaker do
635
662
  subject.package_proxy(host, options.merge( {'package_proxy' => proxyurl}) )
636
663
  end
637
664
 
638
- ['centos','redhat'].each do |platform|
665
+ %w[amazon centos redhat].each do |platform|
639
666
  it "can set proxy config on a '#{platform}' host" do
640
667
  host = make_host('name', { :platform => platform } )
641
668
 
@@ -66,6 +66,20 @@ module Beaker
66
66
  end
67
67
 
68
68
  context 'with_version_codename' do
69
+ it "can convert debian-14-xxx to debian-forky-xxx" do
70
+ @name = 'debian-14-xxx'
71
+ expect(platform.with_version_codename).to be === 'debian-forky-xxx'
72
+ end
73
+
74
+ it "can convert debian-13-xxx to debian-trixie-xxx" do
75
+ @name = 'debian-13-xxx'
76
+ expect(platform.with_version_codename).to be === 'debian-trixie-xxx'
77
+ end
78
+
79
+ it "can convert debian-12-xxx to debian-bookworm-xxx" do
80
+ @name = 'debian-12-xxx'
81
+ expect(platform.with_version_codename).to be === 'debian-bookworm-xxx'
82
+ end
69
83
 
70
84
  it "can convert debian-11-xxx to debian-bullseye-xxx" do
71
85
  @name = 'debian-11-xxx'
data/spec/helpers.rb CHANGED
@@ -132,16 +132,17 @@ module PlatformHelpers
132
132
 
133
133
  FEDORASYSTEMD = (14..39).to_a.collect! { |i| "fedora-#{i}" }
134
134
 
135
- SYSTEMDPLATFORMS = ['el-7',
136
- 'centos-7',
137
- 'redhat-7',
138
- 'oracle-7',
139
- 'scientific-7',
140
- 'eos-7',
141
- 'el-8',
142
- 'centos-8',
143
- 'redhat-8',
144
- 'oracle-8'].concat(FEDORASYSTEMD)
135
+ SYSTEMDPLATFORMS = %w[amazon-2023
136
+ el-7
137
+ centos-7
138
+ redhat-7
139
+ oracle-7
140
+ scientific-7
141
+ eos-7
142
+ el-8
143
+ centos-8
144
+ redhat-8
145
+ oracle-8].concat(FEDORASYSTEMD)
145
146
 
146
147
  FEDORASYSTEMV = (1..13).to_a.collect! { |i| "fedora-#{i}" }
147
148
 
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: 4.40.2
4
+ version: 4.41.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-07-27 00:00:00.000000000 Z
11
+ date: 2023-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fakefs