beaker 4.40.1 → 4.41.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +1 -1
- data/CHANGELOG.md +27 -6
- data/acceptance/lib/helpers/test_helper.rb +2 -2
- data/lib/beaker/host/unix/exec.rb +3 -3
- data/lib/beaker/host/unix/file.rb +2 -2
- data/lib/beaker/host/unix/pkg.rb +25 -25
- data/lib/beaker/host_prebuilt_steps.rb +12 -9
- data/lib/beaker/perf.rb +3 -3
- data/lib/beaker/platform.rb +19 -16
- data/lib/beaker/test_case.rb +1 -1
- data/lib/beaker/version.rb +1 -1
- data/lib/beaker.rb +1 -1
- data/spec/beaker/dsl/assertions_spec.rb +1 -1
- data/spec/beaker/dsl/structure_spec.rb +5 -5
- data/spec/beaker/host/mac/group_spec.rb +1 -1
- data/spec/beaker/host/mac/user_spec.rb +1 -1
- data/spec/beaker/host/unix/file_spec.rb +2 -4
- data/spec/beaker/host/unix/pkg_spec.rb +22 -7
- data/spec/beaker/host_prebuilt_steps_spec.rb +33 -6
- data/spec/beaker/platform_spec.rb +14 -0
- data/spec/helpers.rb +11 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 525b6a9075032237a7a0432d2c7e016d60864f5bffa4cf1be154f55b80a295ab
|
4
|
+
data.tar.gz: c0bc73ad7426ec048475bd55cbb9338349cb3b498ae03e281a2be5acef923e5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67890b5331b7474ac34566e3f6781f9eef91b4993238520b0c4a3584acfde5a41a2adafaa8eccd80aca32fbcdc4cbfabca51da40c5e07f3eb6e12cf9ad0b0d03
|
7
|
+
data.tar.gz: a4996b26068c591881df3b2d8bc88ccb88b08f4501250765488a5f30553d2346e7a2f42e63133a0b39183f3679d7debace57140b4601855b6646e9d050ed03e3
|
data/.rubocop_todo.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,25 @@
|
|
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
|
+
|
11
|
+
## [4.40.2](https://github.com/voxpupuli/beaker/tree/4.40.2) (2023-07-26)
|
12
|
+
|
13
|
+
[Full Changelog](https://github.com/voxpupuli/beaker/compare/4.40.1...4.40.2)
|
14
|
+
|
15
|
+
**Fixed bugs:**
|
16
|
+
|
17
|
+
- Fix Minitest capitalization [\#1818](https://github.com/voxpupuli/beaker/pull/1818) ([mhashizume](https://github.com/mhashizume))
|
18
|
+
|
3
19
|
## [4.40.1](https://github.com/voxpupuli/beaker/tree/4.40.1) (2023-05-05)
|
4
20
|
|
21
|
+
[Full Changelog](https://github.com/voxpupuli/beaker/compare/4.40.0...4.40.1)
|
22
|
+
|
5
23
|
**Merged Changes:**
|
6
24
|
|
7
25
|
- in-parallel: Allow 1.x [\#1813](https://github.com/voxpupuli/beaker/pull/1813) ([bastelfreak](https://github.com/bastelfreak))
|
@@ -18,20 +36,23 @@
|
|
18
36
|
|
19
37
|
[Full Changelog](https://github.com/voxpupuli/beaker/compare/4.38.1...4.39.0)
|
20
38
|
|
21
|
-
**Fixed bugs:**
|
22
|
-
|
23
|
-
- Extend list of permitted classes for YAML safe load and allow aliases [\#1758](https://github.com/voxpupuli/beaker/pull/1758) ([nmburgan](https://github.com/nmburgan))
|
24
|
-
|
25
39
|
**Implemented enhancements:**
|
26
40
|
|
27
|
-
- Add Rubocop [\#1761](https://github.com/voxpupuli/beaker/pull/1761) ([ekohl](https://github.com/ekohl))
|
28
|
-
- Update net-scp requirement from >= 1.2, < 4.0 to >= 1.2, < 5.0 [\#1757](https://github.com/voxpupuli/beaker/pull/1757)
|
29
41
|
- \(maint\) StringInclude Rubocop corrections [\#1765](https://github.com/voxpupuli/beaker/pull/1765) ([mhashizume](https://github.com/mhashizume))
|
42
|
+
- Add Rubocop [\#1761](https://github.com/voxpupuli/beaker/pull/1761) ([ekohl](https://github.com/ekohl))
|
43
|
+
|
44
|
+
**Fixed bugs:**
|
45
|
+
|
46
|
+
- Extend list of permitted classes for YAML safe load and allow aliases [\#1758](https://github.com/voxpupuli/beaker/pull/1758) ([nmburgan](https://github.com/nmburgan))
|
30
47
|
|
31
48
|
**Closed issues:**
|
32
49
|
|
33
50
|
- Ruby 3.1/Psych 4 compatibility issues [\#1753](https://github.com/voxpupuli/beaker/issues/1753)
|
34
51
|
|
52
|
+
**Merged pull requests:**
|
53
|
+
|
54
|
+
- Update net-scp requirement from \>= 1.2, \< 4.0 to \>= 1.2, \< 5.0 [\#1757](https://github.com/voxpupuli/beaker/pull/1757) ([dependabot[bot]](https://github.com/apps/dependabot))
|
55
|
+
|
35
56
|
## [4.38.1](https://github.com/voxpupuli/beaker/tree/4.38.1) (2022-09-21)
|
36
57
|
|
37
58
|
[Full Changelog](https://github.com/voxpupuli/beaker/compare/4.38.0...4.38.1)
|
@@ -59,7 +59,7 @@ end
|
|
59
59
|
# assert_equal expected, user
|
60
60
|
# end
|
61
61
|
#
|
62
|
-
# Absorbs any
|
62
|
+
# Absorbs any Minitest::Assertion from a failing test assertion in the block.
|
63
63
|
# This implies that the intermittent failure is caught and the suite will not
|
64
64
|
# go red for this failure. Intended to be used with the Jenkins Build Failure
|
65
65
|
# Analyzer (or similar), to detect these failures without failing the build.
|
@@ -69,7 +69,7 @@ def fails_intermittently(issue_link, args = {})
|
|
69
69
|
raise ArgumentError, "provide a Jira ticket link" unless issue_link
|
70
70
|
raise ArgumentError, "a block is required" unless block_given?
|
71
71
|
yield
|
72
|
-
rescue
|
72
|
+
rescue Minitest::Assertion, StandardError, SignalException # we have a test failure!
|
73
73
|
STDERR.puts "\n\nIntermittent test failure! See: #{issue_link}"
|
74
74
|
|
75
75
|
if args.empty?
|
@@ -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'
|
data/lib/beaker/host/unix/pkg.rb
CHANGED
@@ -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
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
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
|
-
|
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
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
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
|
data/lib/beaker/platform.rb
CHANGED
@@ -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 => { "
|
10
|
-
"
|
11
|
-
"
|
12
|
-
"
|
13
|
-
"
|
14
|
-
"
|
15
|
-
|
16
|
-
|
17
|
-
"
|
18
|
-
|
19
|
-
"
|
20
|
-
"
|
21
|
-
"
|
22
|
-
"
|
23
|
-
"
|
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
|
data/lib/beaker/test_case.rb
CHANGED
@@ -22,7 +22,7 @@ module Beaker
|
|
22
22
|
include Beaker::DSL
|
23
23
|
|
24
24
|
# The Exception raised by Ruby's STDLIB's test framework (Ruby 1.9)
|
25
|
-
TEST_EXCEPTION_CLASS = ::
|
25
|
+
TEST_EXCEPTION_CLASS = ::Minitest::Assertion
|
26
26
|
|
27
27
|
# Necessary for implementing {Beaker::DSL::Helpers#confine}.
|
28
28
|
# Assumed to be an array of valid {Beaker::Host} objects for
|
data/lib/beaker/version.rb
CHANGED
data/lib/beaker.rb
CHANGED
@@ -79,7 +79,7 @@ EXPECT
|
|
79
79
|
expect( result ).to receive( :output ).and_return( output )
|
80
80
|
|
81
81
|
expect( subject ).to receive( :result ).at_least( :once ).and_return( result )
|
82
|
-
expect { subject.assert_output expectation }.to raise_error(
|
82
|
+
expect { subject.assert_output expectation }.to raise_error( Minitest::Assertion )
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
@@ -197,11 +197,11 @@ describe ClassMixedWithDSLStructure do
|
|
197
197
|
end
|
198
198
|
|
199
199
|
describe '#expect_failure' do
|
200
|
-
it 'passes when a
|
200
|
+
it 'passes when a Minitest assertion is raised' do
|
201
201
|
expect( subject ).to receive( :logger ).and_return( logger )
|
202
202
|
expect( logger ).to receive( :notify )
|
203
203
|
# We changed this lambda to use the simplest assert possible; using assert_equal
|
204
|
-
# caused an error in
|
204
|
+
# caused an error in Minitest 5.9.0 trying to write to the file system.
|
205
205
|
block = lambda { assert(false, 'this assertion should be caught') }
|
206
206
|
expect{ subject.expect_failure 'this is an expected failure', &block }.not_to raise_error
|
207
207
|
end
|
@@ -213,9 +213,9 @@ describe ClassMixedWithDSLStructure do
|
|
213
213
|
expect{ subject.expect_failure 'this is an expected failure', &block }.not_to raise_error
|
214
214
|
end
|
215
215
|
|
216
|
-
it 'fails when a non-Beaker, non-
|
217
|
-
block = lambda { raise 'not a Beaker or
|
218
|
-
expect{ subject.expect_failure 'this has a non-Beaker, non-
|
216
|
+
it 'fails when a non-Beaker, non-Minitest assertion is raised' do
|
217
|
+
block = lambda { raise 'not a Beaker or Minitest error' }
|
218
|
+
expect{ subject.expect_failure 'this has a non-Beaker, non-Minitest exception', &block }.to raise_error(RuntimeError, /not a Beaker or Minitest error/)
|
219
219
|
end
|
220
220
|
|
221
221
|
it 'fails when no assertion is raised' do
|
@@ -52,7 +52,7 @@ EOS
|
|
52
52
|
result.stdout = ''
|
53
53
|
group_name = 'any_name'
|
54
54
|
expect( subject ).to receive( :execute ).and_yield(result)
|
55
|
-
expect { subject.group_get(group_name) }.to raise_error(
|
55
|
+
expect { subject.group_get(group_name) }.to raise_error(Minitest::Assertion, "failed to get group #{group_name}")
|
56
56
|
end
|
57
57
|
|
58
58
|
it 'parses mac dscacheutil output into /etc/group format correctly' do
|
@@ -63,7 +63,7 @@ EOS
|
|
63
63
|
result.stdout = ''
|
64
64
|
user_name = 'any_name'
|
65
65
|
expect( subject ).to receive( :execute ).and_yield(result)
|
66
|
-
expect { subject.user_get(user_name) }.to raise_error(
|
66
|
+
expect { subject.user_get(user_name) }.to raise_error(Minitest::Assertion, "failed to get user #{user_name}")
|
67
67
|
end
|
68
68
|
|
69
69
|
it 'yields correctly with the result object' do
|
@@ -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
|
-
[
|
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(
|
274
|
-
expect(
|
275
|
-
expect(
|
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(
|
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
|
-
|
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(
|
153
|
+
hosts = make_hosts({ :platform => 'sles-13.1-x64' })
|
148
154
|
|
149
|
-
expect(
|
155
|
+
expect(Beaker::Command).to receive(:new).with("sntp #{ntpserver}").exactly(3).times
|
150
156
|
|
151
|
-
subject.timesync(
|
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
|
-
[
|
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
|
-
[
|
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 = [
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
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.
|
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-
|
11
|
+
date: 2023-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fakefs
|