beaker 6.3.0 → 6.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ddf2ab0309d4f889e899f8814396fe27fdc028ab9b90728b1200c88e490c46e8
4
- data.tar.gz: a21068ae610b4d289ff1a59b8dbde79c2100a3e5df2d4a194a1868aa2425f877
3
+ metadata.gz: 1a02ef74d16885231f54a0de64150eba5ff7cfa6bc944c8e31e833dbeb6ebf0c
4
+ data.tar.gz: 314c9cba9fc50a0966f3bd4d49624041eac4b25dea6dd46cd0e85e1781a95577
5
5
  SHA512:
6
- metadata.gz: a57896118558f839cf191dff39190da4045a57718c2a7fd444bccf61cf666ca3cb5f13b399aef6efee1693d4dfe12124251c24801ddd1ad5a9c7db8e68df4584
7
- data.tar.gz: 4b769798d73e105f17dd6cb10bbf90b8396adc495bc3920b0d6a53c9f4c7396600b92aea99376c70b29e1cf5d281a07ead8fa1cca0761c3c848cfea344e55498
6
+ metadata.gz: da309a092cffe2872e0927d5d304d1beb62a618f0c5c223e2cefc723ac3edb7473a3b3ab42f5e3682af2f75a622e158e150258126d0528453e80d1960d7aee3b
7
+ data.tar.gz: cacc9f2b9679f618c71eda3c4f8de1960f476fb9bbe155a3577a1e7a22cd92d3be9753fc251ac0b7db4e36e214b4da69b4a4cb6c42812aed6f5791d0e9e7fba5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [6.4.0](https://github.com/voxpupuli/beaker/tree/6.4.0) (2024-08-27)
4
+
5
+ **Implemented enhancements:**
6
+
7
+ - Only install timesync packages if needed [\#1853](https://github.com/voxpupuli/beaker/pull/1853)
8
+ - Ensure platform is Beaker::Platform in tests [\#1855](https://github.com/voxpupuli/beaker/pull/1855)
9
+ - Avoid mocking stdout on host and use explicit hosts in host_prebuilt_steps_spec.rb [\#1900](https://github.com/voxpupuli/beaker/pull/1900)
10
+
3
11
  ## [6.3.0](https://github.com/voxpupuli/beaker/tree/6.3.0) (2024-08-13)
4
12
 
5
13
  **Implemented enhancements:**
@@ -1,29 +1,6 @@
1
1
  test_name 'confirm packages on hosts behave correctly'
2
2
  confine :except, :platform => %w(osx)
3
3
 
4
- def get_host_pkg(host)
5
- case host['platform']
6
- when /sles-10/
7
- Beaker::HostPrebuiltSteps::SLES10_PACKAGES
8
- when /opensuse|sles-/
9
- Beaker::HostPrebuiltSteps::SLES_PACKAGES
10
- when /debian/
11
- Beaker::HostPrebuiltSteps::DEBIAN_PACKAGES
12
- when /windows/
13
- host.is_cygwin? ? Beaker::HostPrebuiltSteps::WINDOWS_PACKAGES : Beaker::HostPrebuiltSteps::PSWINDOWS_PACKAGES
14
- when /freebsd/
15
- Beaker::HostPrebuiltSteps::FREEBSD_PACKAGES
16
- when /openbsd/
17
- Beaker::HostPrebuiltSteps::OPENBSD_PACKAGES
18
- when /solaris-10/
19
- Beaker::HostPrebuiltSteps::SOLARIS10_PACKAGES
20
- when /el-[89]/
21
- Beaker::HostPrebuiltSteps::RHEL8_PACKAGES
22
- else
23
- Beaker::HostPrebuiltSteps::UNIX_PACKAGES
24
- end
25
- end
26
-
27
4
  step '#check_for_command : can determine where a command exists'
28
5
  hosts.each do |host|
29
6
  logger.debug "echo package should be installed on #{host}"
@@ -34,7 +11,7 @@ end
34
11
 
35
12
  step '#check_for_package : can determine if a package is installed'
36
13
  hosts.each do |host|
37
- package = get_host_pkg(host)[0]
14
+ package = 'bash'
38
15
 
39
16
  logger.debug "#{package} package should be installed on #{host}"
40
17
  assert(host.check_for_package(package), "'#{package}' should be installed")
@@ -10,20 +10,6 @@ module Beaker
10
10
  NTPSERVER = 'pool.ntp.org'
11
11
  SLEEPWAIT = 5
12
12
  TRIES = 5
13
- AMAZON2023_PACKAGES = %w[chrony]
14
- RHEL8_PACKAGES = %w[chrony iputils] # iputils provides ping. beaker assumes that's present
15
- FEDORA_PACKAGES = %w[chrony iputils]
16
- UNIX_PACKAGES = %w[curl ntpdate]
17
- FREEBSD_PACKAGES = ['curl', 'perl5|perl']
18
- OPENBSD_PACKAGES = ['curl']
19
- ARCHLINUX_PACKAGES = %w[curl ntp net-tools openssh]
20
- WINDOWS_PACKAGES = ['curl']
21
- PSWINDOWS_PACKAGES = []
22
- SLES10_PACKAGES = ['curl']
23
- SLES_PACKAGES = %w[curl ntp]
24
- DEBIAN_PACKAGES = %w[curl ntpdate lsb-release apt-transport-https]
25
- SOLARIS10_PACKAGES = %w[CSWcurl CSWntp wget]
26
- SOLARIS11_PACKAGES = %w[curl ntp]
27
13
  ETC_HOSTS_PATH = "/etc/hosts"
28
14
  ETC_HOSTS_PATH_SOLARIS = "/etc/inet/hosts"
29
15
  ROOT_KEYS_SCRIPT = "https://raw.githubusercontent.com/puppetlabs/puppetlabs-sshkeys/master/templates/scripts/manage_root_authorized_keys"
@@ -48,7 +34,7 @@ module Beaker
48
34
  host.exec(Command.new("w32tm /resync"))
49
35
  logger.notify "NTP date succeeded on #{host}"
50
36
  else
51
- if /amazon|el-[89]|fedora/.match?(host['platform'])
37
+ if host['platform'].uses_chrony?
52
38
  ntp_command = "chronyc add server #{ntp_server} prefer trust;chronyc makestep;chronyc burst 1/2"
53
39
  elsif /opensuse-|sles-/.match?(host['platform'])
54
40
  ntp_command = "sntp #{ntp_server}"
@@ -79,12 +65,6 @@ module Beaker
79
65
  # Validate that hosts are prepared to be used as SUTs, if packages are missing attempt to
80
66
  # install them.
81
67
  #
82
- # Verifies the presence of #{HostPrebuiltSteps::UNIX_PACKAGES} on unix platform hosts,
83
- # {HostPrebuiltSteps::SLES_PACKAGES} on SUSE platform hosts,
84
- # {HostPrebuiltSteps::DEBIAN_PACKAGES} on debian platform hosts,
85
- # {HostPrebuiltSteps::WINDOWS_PACKAGES} on cygwin-installed windows platform hosts,
86
- # and {HostPrebuiltSteps::PSWINDOWS_PACKAGES} on non-cygwin windows platform hosts.
87
- #
88
68
  # @param [Host, Array<Host>, String, Symbol] host One or more hosts to act upon
89
69
  # @param [Hash{Symbol=>String}] opts Options to alter execution.
90
70
  # @option opts [Beaker::Logger] :logger A {Beaker::Logger} object
@@ -102,44 +82,14 @@ module Beaker
102
82
  # @param [Host] host A host return the packages for
103
83
  # @return [Array<String>] A list of packages to install
104
84
  def host_packages(host)
105
- case host['platform']
106
- when /amazon/
107
- AMAZON2023_PACKAGES
108
- when /el-[89]/
109
- RHEL8_PACKAGES
110
- when /sles-10/
111
- SLES10_PACKAGES
112
- when /opensuse|sles-/
113
- SLES_PACKAGES
114
- when /debian/
115
- DEBIAN_PACKAGES
116
- when /windows/
117
- if host.is_cygwin?
118
- raise RuntimeError, "cygwin is not installed on #{host}" if !host.cygwin_installed?
119
-
120
- WINDOWS_PACKAGES
121
- else
122
- PSWINDOWS_PACKAGES
123
- end
124
- when /freebsd/
125
- FREEBSD_PACKAGES
126
- when /openbsd/
127
- OPENBSD_PACKAGES
128
- when /solaris-10/
129
- SOLARIS10_PACKAGES
130
- when /solaris-1[1-9]/
131
- SOLARIS11_PACKAGES
132
- when /archlinux/
133
- ARCHLINUX_PACKAGES
134
- when /fedora/
135
- FEDORA_PACKAGES
136
- else
137
- if !/aix|solaris|osx-/.match?(host['platform'])
138
- UNIX_PACKAGES
139
- else
140
- []
141
- end
85
+ packages = host['platform'].base_packages
86
+ if host.is_cygwin?
87
+ raise RuntimeError, "cygwin is not installed on #{host}" if !host.cygwin_installed?
88
+
89
+ packages << 'curl'
142
90
  end
91
+ packages += host['platform'].timesync_packages if host[:timesync]
92
+ packages
143
93
  end
144
94
 
145
95
  # Installs the given packages if they aren't already on a host
@@ -100,5 +100,60 @@ module Beaker
100
100
  def with_version_number
101
101
  [@variant, @version, @arch].join('-')
102
102
  end
103
+
104
+ def uses_chrony?
105
+ case @variant
106
+ when 'amazon', 'fedora'
107
+ true
108
+ when 'el'
109
+ @version.to_i >= 8
110
+ else
111
+ false
112
+ end
113
+ end
114
+
115
+ # Return a list of packages that should always be present.
116
+ #
117
+ # @return [Array<String>] A list of packages to install
118
+ def base_packages
119
+ case @variant
120
+ when 'el'
121
+ @version.to_i >= 8 ? ['curl-minimal', 'iputils'] : %w[curl]
122
+ when 'debian'
123
+ %w[curl lsb-release apt-transport-https]
124
+ when 'freebsd'
125
+ %w[curl perl5|perl]
126
+ when 'solaris'
127
+ @version.to_i >= 11 ? %w[curl] : %w[CSWcurl wget]
128
+ when 'archlinux'
129
+ %w[curl net-tools openssh]
130
+ when 'amazon', 'fedora'
131
+ ['curl-minimal', 'iputils']
132
+ when 'aix', 'osx', 'windows'
133
+ []
134
+ else
135
+ %w[curl]
136
+ end
137
+ end
138
+
139
+ # Return a list of packages that are needed for timesync
140
+ #
141
+ # @return [Array<String>] A list of packages to install for timesync
142
+ def timesync_packages
143
+ return ['chrony'] if uses_chrony?
144
+
145
+ case @variant
146
+ when 'freebsd', 'openbsd', 'windows', 'aix', 'osx'
147
+ []
148
+ when 'archlinux', 'opensuse'
149
+ ['ntp']
150
+ when 'sles'
151
+ @version.to_i >= 11 ? %w[ntp] : []
152
+ when 'solaris'
153
+ @version.to_i >= 11 ? %w[ntp] : %w[CSWntp]
154
+ else
155
+ %w[ntpdate]
156
+ end
157
+ end
103
158
  end
104
159
  end
@@ -1,5 +1,5 @@
1
1
  module Beaker
2
2
  module Version
3
- STRING = '6.3.0'
3
+ STRING = '6.4.0'
4
4
  end
5
5
  end
@@ -125,7 +125,7 @@ module Beaker
125
125
  allow(h).to receive(:append_commands).and_return('')
126
126
  h
127
127
  end
128
- let(:platform) { @platform || 'unix' }
128
+ let(:platform) { @platform || 'el-9-64' }
129
129
  let(:expression) { @expression || 's/b/s/' }
130
130
  let(:filename) { @filename || '/fakefile' }
131
131
  let(:options) { @options || {} }
@@ -6,7 +6,7 @@ module Beaker
6
6
  let(:group) { 'somegroup' }
7
7
  let(:path) { 'C:\Foo\Bar' }
8
8
  let(:newpath) { '/Foo/Bar' }
9
- let(:host) { make_host('name', { :platform => 'windows' }) }
9
+ let(:host) { make_host('name', { :platform => 'windows-11-64' }) }
10
10
 
11
11
  describe '#chown' do
12
12
  it 'calls cygpath first' do
@@ -60,7 +60,7 @@ module Beaker
60
60
  end
61
61
 
62
62
  it 'replaces backslashes with forward slashes when using BitVise and powershell' do
63
- host = make_host('name', platform: 'windows', is_cygwin: false)
63
+ host = make_host('name', platform: 'windows-11-64', is_cygwin: false)
64
64
  allow(host).to receive(:determine_ssh_server).and_return(:bitvise)
65
65
  expect(host.scp_path(path)).to eq('C:/Windows')
66
66
  end
@@ -6,22 +6,6 @@ describe Beaker do
6
6
  let(:options_ntp) { make_opts.merge({ 'ntp_server' => ntpserver_set }) }
7
7
  let(:ntpserver) { Beaker::HostPrebuiltSteps::NTPSERVER }
8
8
  let(:sync_cmd) { Beaker::HostPrebuiltSteps::ROOT_KEYS_SYNC_CMD }
9
- let(:windows_pkgs) { Beaker::HostPrebuiltSteps::WINDOWS_PACKAGES }
10
- let(:unix_only_pkgs) { Beaker::HostPrebuiltSteps::UNIX_PACKAGES }
11
- let(:sles_only_pkgs) { Beaker::HostPrebuiltSteps::SLES_PACKAGES }
12
- let(:rhel8_packages) { Beaker::HostPrebuiltSteps::RHEL8_PACKAGES }
13
- let(:fedora_packages) { Beaker::HostPrebuiltSteps::FEDORA_PACKAGES }
14
- let(:amazon2023_packages) { Beaker::HostPrebuiltSteps::AMAZON2023_PACKAGES }
15
- let(:platform) { @platform || 'unix' }
16
- let(:ip) { "ip.address.0.0" }
17
- let(:stdout) { @stdout || ip }
18
- let(:hosts) do
19
- hosts = make_hosts({ :stdout => stdout, :platform => platform })
20
- hosts[0][:roles] = ['agent']
21
- hosts[1][:roles] = %w[master dashboard agent database]
22
- hosts[2][:roles] = ['agent']
23
- hosts
24
- end
25
9
  let(:dummy_class) { Class.new { include Beaker::HostPrebuiltSteps } }
26
10
 
27
11
  shared_examples 'enables_root_login' do |platform, commands, non_cygwin|
@@ -41,79 +25,75 @@ describe Beaker do
41
25
  end
42
26
 
43
27
  # Non-cygwin Windows
44
- it_behaves_like 'enables_root_login', 'pswindows', [], false
28
+ it_behaves_like 'enables_root_login', 'windows-11-64', [], false
45
29
 
46
- # Non-cygwin Windows
47
- it_behaves_like 'enables_root_login', 'windows', [
30
+ # cygwin Windows
31
+ it_behaves_like 'enables_root_login', 'windows-11-64', [
48
32
  "sed -ri 's/^#?PermitRootLogin /PermitRootLogin yes/' /etc/sshd_config",
49
33
  ], true
50
34
 
51
35
  # FreeBSD
52
- it_behaves_like 'enables_root_login', 'freesbd', [
53
- "sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\"",
36
+ it_behaves_like 'enables_root_login', 'freebsd-14-64', [
37
+ "sudo sed -i -e 's/#PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config",
38
+ "sudo /etc/rc.d/sshd restart",
54
39
  ], true
55
40
 
56
- it_behaves_like 'enables_root_login', 'osx-10.10', [
41
+ it_behaves_like 'enables_root_login', 'osx-10.10-64', [
57
42
  "sudo sed -i '' 's/#PermitRootLogin yes/PermitRootLogin Yes/g' /etc/sshd_config",
58
43
  "sudo sed -i '' 's/#PermitRootLogin no/PermitRootLogin Yes/g' /etc/sshd_config",
59
44
  ]
60
45
 
61
- it_behaves_like 'enables_root_login', 'osx-10.11', [
46
+ it_behaves_like 'enables_root_login', 'osx-10.11-64', [
62
47
  "sudo sed -i '' 's/#PermitRootLogin yes/PermitRootLogin Yes/g' /private/etc/ssh/sshd_config",
63
48
  "sudo sed -i '' 's/#PermitRootLogin no/PermitRootLogin Yes/g' /private/etc/ssh/sshd_config",
64
49
  ]
65
50
 
66
- it_behaves_like 'enables_root_login', 'osx-10.12', [
51
+ it_behaves_like 'enables_root_login', 'osx-10.12-64', [
67
52
  "sudo sed -i '' 's/#PermitRootLogin yes/PermitRootLogin Yes/g' /private/etc/ssh/sshd_config",
68
53
  "sudo sed -i '' 's/#PermitRootLogin no/PermitRootLogin Yes/g' /private/etc/ssh/sshd_config",
69
54
  ]
70
55
 
71
- it_behaves_like 'enables_root_login', 'osx-10.13', [
56
+ it_behaves_like 'enables_root_login', 'osx-10.13-64', [
72
57
  "sudo sed -i '' 's/#PermitRootLogin yes/PermitRootLogin Yes/g' /private/etc/ssh/sshd_config",
73
58
  "sudo sed -i '' 's/#PermitRootLogin no/PermitRootLogin Yes/g' /private/etc/ssh/sshd_config",
74
59
  ]
75
60
 
76
61
  # Solaris
77
- it_behaves_like 'enables_root_login', 'solaris-10', [
62
+ it_behaves_like 'enables_root_login', 'solaris-10-64', [
78
63
  "sudo -E svcadm restart network/ssh",
79
64
  "sudo gsed -i -e 's/#PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config",
80
65
  ], true
81
66
 
82
- it_behaves_like 'enables_root_login', 'solaris-11', [
67
+ it_behaves_like 'enables_root_login', 'solaris-11-64', [
83
68
  "sudo -E svcadm restart network/ssh",
84
69
  "sudo gsed -i -e 's/PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config",
85
70
  "if grep \"root::::type=role\" /etc/user_attr; then sudo rolemod -K type=normal root; else echo \"root user already type=normal\"; fi",
86
71
  ], true
87
72
 
88
- it_behaves_like 'enables_root_login', 'amazon-2023', [
89
- "sudo -E systemctl restart sshd.service",
73
+ it_behaves_like 'enables_root_login', 'amazon-2023-64', [
90
74
  "sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\"",
75
+ "sudo -E systemctl restart sshd.service",
91
76
  ]
92
77
 
93
- %w[debian ubuntu].each do |deb_like|
78
+ %w[debian-12-64 ubuntu-2204-64].each do |deb_like|
94
79
  it_behaves_like 'enables_root_login', deb_like, [
95
80
  "sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\"",
96
81
  "sudo su -c \"service ssh restart\"",
97
82
  ]
98
83
  end
99
84
 
100
- ['centos', 'el-', 'redhat'].each do |redhat_like|
85
+ ['centos-9-64', 'el-9-64', 'redhat-9-64', 'fedora-39-64'].each do |redhat_like|
101
86
  it_behaves_like 'enables_root_login', redhat_like, [
102
87
  "sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\"",
103
- "sudo -E /sbin/service sshd reload",
88
+ "sudo -E systemctl restart sshd.service",
104
89
  ]
105
90
  end
106
91
 
107
- it_behaves_like 'enables_root_login', 'fedora', [
108
- "sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\"",
109
- "sudo -E systemctl restart sshd.service",
110
- ]
111
-
112
92
  context 'timesync' do
113
93
  subject { dummy_class.new }
114
94
 
115
- it "can sync time on unix hosts" do
116
- hosts = make_hosts({ :platform => 'unix' })
95
+ it "can sync time on el-7 hosts" do
96
+ hosts = make_hosts({ :platform => 'el-7-64' })
117
97
 
118
98
  expect(Beaker::Command).to receive(:new).with("ntpdate -u -t 20 #{ntpserver}").exactly(3).times
119
99
 
@@ -121,7 +101,7 @@ describe Beaker do
121
101
  end
122
102
 
123
103
  it "can retry on failure on unix hosts" do
124
- hosts = make_hosts({ :platform => 'unix', :exit_code => [1, 0] })
104
+ hosts = make_hosts({ :platform => 'el-7-64', :exit_code => [1, 0] })
125
105
  allow(subject).to receive(:sleep).and_return(true)
126
106
 
127
107
  expect(Beaker::Command).to receive(:new).with("ntpdate -u -t 20 #{ntpserver}").exactly(6).times
@@ -130,7 +110,7 @@ describe Beaker do
130
110
  end
131
111
 
132
112
  it "eventually gives up and raises an error when unix hosts can't be synched" do
133
- hosts = make_hosts({ :platform => 'unix', :exit_code => 1 })
113
+ hosts = make_hosts({ :platform => 'el-7-64', :exit_code => 1 })
134
114
  allow(subject).to receive(:sleep).and_return(true)
135
115
 
136
116
  expect(Beaker::Command).to receive(:new).with("ntpdate -u -t 20 #{ntpserver}").exactly(5).times
@@ -139,7 +119,7 @@ describe Beaker do
139
119
  end
140
120
 
141
121
  it "can sync time on windows hosts" do
142
- hosts = make_hosts({ :platform => 'windows' })
122
+ hosts = make_hosts({ :platform => 'windows-11-64' })
143
123
 
144
124
  expect(Beaker::Command).to receive(:new).with("w32tm /register").exactly(3).times
145
125
  expect(Beaker::Command).to receive(:new).with("net start w32time").exactly(3).times
@@ -184,8 +164,8 @@ describe Beaker do
184
164
  subject.timesync(hosts, options)
185
165
  end
186
166
 
187
- it "can set time server on unix hosts" do
188
- hosts = make_hosts({ :platform => 'unix' })
167
+ it "can set time server on el-7 hosts" do
168
+ hosts = make_hosts({ :platform => 'el-7-64' })
189
169
 
190
170
  expect(Beaker::Command).to receive(:new).with("ntpdate -u -t 20 #{ntpserver_set}").exactly(3).times
191
171
 
@@ -193,7 +173,7 @@ describe Beaker do
193
173
  end
194
174
 
195
175
  it "can set time server on windows hosts" do
196
- hosts = make_hosts({ :platform => 'windows' })
176
+ hosts = make_hosts({ :platform => 'windows-11-64' })
197
177
 
198
178
  expect(Beaker::Command).to receive(:new).with("w32tm /register").exactly(3).times
199
179
  expect(Beaker::Command).to receive(:new).with("net start w32time").exactly(3).times
@@ -225,7 +205,7 @@ describe Beaker do
225
205
  subject { dummy_class.new }
226
206
 
227
207
  it "can perform apt-get on ubuntu hosts" do
228
- host = make_host('testhost', { :platform => 'ubuntu' })
208
+ host = make_host('testhost', { :platform => 'ubuntu-2204-64' })
229
209
 
230
210
  expect(Beaker::Command).to receive(:new).with("apt-get update -qq").once
231
211
 
@@ -233,7 +213,7 @@ describe Beaker do
233
213
  end
234
214
 
235
215
  it "can perform apt-get on debian hosts" do
236
- host = make_host('testhost', { :platform => 'debian' })
216
+ host = make_host('testhost', { :platform => 'debian-12-64' })
237
217
 
238
218
  expect(Beaker::Command).to receive(:new).with("apt-get update -qq").once
239
219
 
@@ -241,7 +221,7 @@ describe Beaker do
241
221
  end
242
222
 
243
223
  it "does nothing on non debian/ubuntu hosts" do
244
- host = make_host('testhost', { :platform => 'windows' })
224
+ host = make_host('testhost', { :platform => 'windows-11-64' })
245
225
 
246
226
  expect(Beaker::Command).not_to receive(:new)
247
227
 
@@ -256,7 +236,7 @@ describe Beaker do
256
236
  content = "this is the content"
257
237
  tempfilepath = "/path/to/tempfile"
258
238
  filepath = "/path/to/file"
259
- host = make_host('testhost', { :platform => 'windows' })
239
+ host = make_host('testhost', { :platform => 'windows-11-64' })
260
240
  tempfile = double('tempfile')
261
241
  allow(tempfile).to receive(:path).and_return(tempfilepath)
262
242
  allow(Tempfile).to receive(:open).and_yield(tempfile)
@@ -274,112 +254,101 @@ describe Beaker do
274
254
  subject { dummy_class.new }
275
255
 
276
256
  it "can sync keys on a solaris host" do
277
- @platform = 'solaris'
257
+ host = make_host('host', { 'platform' => 'solaris-11-64' })
278
258
 
279
- expect(Beaker::Command).to receive(:new).with(sync_cmd % "bash").exactly(3).times
259
+ expect(Beaker::Command).to receive(:new).with(sync_cmd % "bash").once
280
260
 
281
- subject.sync_root_keys(hosts, options)
261
+ subject.sync_root_keys(host, options)
282
262
  end
283
263
 
284
264
  it "can sync keys on a non-solaris host" do
285
- expect(Beaker::Command).to receive(:new).with(sync_cmd % "env PATH=\"/usr/gnu/bin:$PATH\" bash").exactly(3).times
265
+ host = make_host('host', { 'platform' => 'el-9-64' })
286
266
 
287
- subject.sync_root_keys(hosts, options)
267
+ expect(Beaker::Command).to receive(:new).with(sync_cmd % "env PATH=\"/usr/gnu/bin:$PATH\" bash").once
268
+
269
+ subject.sync_root_keys(host, options)
288
270
  end
289
271
  end
290
272
 
291
273
  context "validate_host" do
292
274
  subject { dummy_class.new }
293
275
 
294
- it "can validate unix hosts" do
295
- hosts.each do |host|
296
- unix_only_pkgs.each do |pkg|
297
- expect(host).to receive(:check_for_package).with(pkg).once.and_return(false)
298
- expect(host).to receive(:install_package).with(pkg).once
299
- end
276
+ it "can validate el-9 hosts" do
277
+ host = make_host('host', { :platform => 'el-9-64' })
278
+
279
+ ['curl-minimal', 'iputils'].each do |pkg|
280
+ expect(host).to receive(:check_for_package).with(pkg).once.and_return(false)
281
+ expect(host).to receive(:install_package).with(pkg).once
300
282
  end
301
283
 
302
- subject.validate_host(hosts, options)
284
+ subject.validate_host(host, options)
303
285
  end
304
286
 
305
287
  it "can validate windows hosts" do
306
- @platform = 'windows'
307
-
308
- hosts.each do |host|
309
- windows_pkgs.each do |pkg|
310
- allow(host).to receive(:cygwin_installed?).and_return(true)
311
- allow(host).to receive(:is_cygwin?).and_return(true)
312
- expect(host).to receive(:check_for_package).with(pkg).once.and_return(false)
313
- expect(host).to receive(:install_package).with(pkg).once
314
- end
288
+ host = make_host('host', { :platform => 'windows-11-64', :is_cygwin => true })
289
+ allow(host).to receive(:cygwin_installed?).and_return(true)
290
+
291
+ ['curl'].each do |pkg|
292
+ expect(host).to receive(:check_for_package).with(pkg).once.and_return(false)
293
+ expect(host).to receive(:install_package).with(pkg).once
315
294
  end
316
295
 
317
- subject.validate_host(hosts, options)
296
+ subject.validate_host(host, options)
318
297
  end
319
298
 
320
299
  it "can validate SLES hosts" do
321
- @platform = 'sles-13.1-x64'
300
+ host = make_host('host', { :platform => 'sles-13.1-x86_64' })
322
301
 
323
- hosts.each do |host|
324
- sles_only_pkgs.each do |pkg|
325
- expect(host).to receive(:check_for_package).with(pkg).once.and_return(false)
326
- expect(host).to receive(:install_package).with(pkg).once
327
- end
302
+ ['curl'].each do |pkg|
303
+ expect(host).to receive(:check_for_package).with(pkg).once.and_return(false)
304
+ expect(host).to receive(:install_package).with(pkg).once
328
305
  end
329
306
 
330
- subject.validate_host(hosts, options)
307
+ subject.validate_host(host, options)
331
308
  end
332
309
 
333
310
  it "can validate opensuse hosts" do
334
- @platform = 'opensuse-15-x86_x64'
311
+ host = make_host('host', { :platform => 'opensuse-15-x86_x64' })
335
312
 
336
- hosts.each do |host|
337
- sles_only_pkgs.each do |pkg|
338
- expect(host).to receive(:check_for_package).with(pkg).once.and_return(false)
339
- expect(host).to receive(:install_package).with(pkg).once
340
- end
313
+ ['curl'].each do |pkg|
314
+ expect(host).to receive(:check_for_package).with(pkg).once.and_return(false)
315
+ expect(host).to receive(:install_package).with(pkg).once
341
316
  end
342
317
 
343
- subject.validate_host(hosts, options)
318
+ subject.validate_host(host, options)
344
319
  end
345
320
 
346
321
  it "can validate RHEL8 hosts" do
347
- @platform = 'el-8-x86_x64'
322
+ host = make_host('host', { :platform => 'el-8-64' })
348
323
 
349
- hosts.each do |host|
350
- rhel8_packages.each do |pkg|
351
- expect(host).to receive(:check_for_package).with(pkg).once.and_return(false)
352
- expect(host).to receive(:install_package).with(pkg).once
353
- end
324
+ ['curl-minimal', 'iputils'].each do |pkg|
325
+ expect(host).to receive(:check_for_package).with(pkg).once.and_return(false)
326
+ expect(host).to receive(:install_package).with(pkg).once
354
327
  end
355
328
 
356
- subject.validate_host(hosts, options)
329
+ subject.validate_host(host, options)
357
330
  end
358
331
 
359
332
  it "can validate Fedora hosts" do
360
- @platform = 'fedora-32-x86_64'
333
+ host = make_host('host', { :platform => 'fedora-32-x86_64' })
361
334
 
362
- hosts.each do |host|
363
- fedora_packages.each do |pkg|
364
- expect(host).to receive(:check_for_package).with(pkg).once.and_return(false)
365
- expect(host).to receive(:install_package).with(pkg).once
366
- end
335
+ ['curl-minimal', 'iputils'].each do |pkg|
336
+ expect(host).to receive(:check_for_package).with(pkg).once.and_return(false)
337
+ expect(host).to receive(:install_package).with(pkg).once
367
338
  end
368
339
 
369
- subject.validate_host(hosts, options)
340
+ subject.validate_host(host, options)
370
341
  end
371
342
 
372
343
  it "can validate Amazon hosts" do
373
- @platform = 'amazon-2023-x86_64'
344
+ host = make_host('host', { :platform => 'amazon-2023-x86_64' })
374
345
 
375
- hosts.each do |host|
376
- amazon2023_packages.each do |pkg|
377
- expect(host).to receive(:check_for_package).with(pkg).once.and_return(false)
378
- expect(host).to receive(:install_package).with(pkg).once
379
- end
346
+ ['curl-minimal', 'iputils'].each do |pkg|
347
+ expect(host).to receive(:check_for_package).with(pkg).once.and_return(false)
348
+ expect(host).to receive(:install_package).with(pkg).once
380
349
  end
381
350
 
382
- subject.validate_host(hosts, options)
351
+ subject.validate_host(host, options)
383
352
  end
384
353
  end
385
354
 
@@ -388,6 +357,11 @@ describe Beaker do
388
357
 
389
358
  shared_examples 'find domain name' do
390
359
  it "finds the domain name" do
360
+ cmd = instance_double(Beaker::Command)
361
+ expect(Beaker::Command).to receive(:new).with(cat).once.and_return(cmd)
362
+ result = instance_double(Beaker::Result)
363
+ expect(host).to receive(:exec).with(cmd).and_return(result)
364
+ expect(result).to receive(:stdout).and_return(stdout)
391
365
  expect(subject.get_domain_name(host)).to be === "labs.lan"
392
366
  end
393
367
  end
@@ -395,45 +369,32 @@ describe Beaker do
395
369
  context "on windows" do
396
370
  let(:host) do
397
371
  make_host('name', {
398
- :platform => 'windows',
372
+ :platform => 'windows-11-64',
399
373
  :is_cygwin => cygwin,
400
- :stdout => "domain labs.lan d.labs.net dc1.labs.net labs.com\nnameserver 10.16.22.10\nnameserver 10.16.22.11",
401
374
  })
402
375
  end
403
376
 
377
+ let(:stdout) { "domain labs.lan d.labs.net dc1.labs.net labs.com\nnameserver 10.16.22.10\nnameserver 10.16.22.11" }
378
+
404
379
  context "with cygwin" do
405
380
  let(:cygwin) { true }
406
-
407
- before do
408
- expect(Beaker::Command).to receive(:new).with("cat /cygdrive/c/Windows/System32/drivers/etc/hosts").once
409
- end
381
+ let(:cat) { "cat /cygdrive/c/Windows/System32/drivers/etc/hosts" }
410
382
 
411
383
  include_examples 'find domain name'
412
384
  end
413
385
 
414
386
  context "without cygwin" do
415
387
  let(:cygwin) { false }
416
-
417
- before do
418
- expect(Beaker::Command).to receive(:new).with('type C:\Windows\System32\drivers\etc\hosts').once
419
- end
388
+ let(:cat) { 'type C:\Windows\System32\drivers\etc\hosts' }
420
389
 
421
390
  include_examples 'find domain name'
422
391
  end
423
392
  end
424
393
 
425
- %w[amazon centos redhat].each do |platform|
394
+ %w[amazon-2023-64 centos-9-64 redhat-9-64].each do |platform|
426
395
  context "on platform '#{platform}'" do
427
- let(:host) do
428
- make_host('name', {
429
- :platform => platform,
430
- :stdout => stdout,
431
- })
432
- end
433
-
434
- before do
435
- expect(Beaker::Command).to receive(:new).with("cat /etc/resolv.conf").once
436
- end
396
+ let(:host) { make_host('name', { :platform => platform }) }
397
+ let(:cat) { "cat /etc/resolv.conf" }
437
398
 
438
399
  context "with a domain entry" do
439
400
  let(:stdout) { "domain labs.lan d.labs.net dc1.labs.net labs.com\nnameserver 10.16.22.10\nnameserver 10.16.22.11" }
@@ -480,7 +441,7 @@ describe Beaker do
480
441
  subject { dummy_class.new }
481
442
 
482
443
  it "can copy ssh to root in windows hosts with no cygwin" do
483
- host = make_host('testhost', { :platform => 'windows', :is_cygwin => false })
444
+ host = make_host('testhost', { :platform => 'windows-11-64', :is_cygwin => false })
484
445
  expect(Beaker::Command).to receive(:new).with("if exist .ssh (xcopy .ssh C:\\Users\\Administrator\\.ssh /s /e /y /i)").once
485
446
 
486
447
  subject.copy_ssh_to_root(host, options)
@@ -493,7 +454,7 @@ describe Beaker do
493
454
  proxyurl = "http://192.168.2.100:3128"
494
455
 
495
456
  it "can set proxy config on a debian/ubuntu host" do
496
- host = make_host('name', { :platform => 'debian' })
457
+ host = make_host('name', { :platform => 'debian-12-64' })
497
458
 
498
459
  expect(Beaker::Command).to receive(:new).with("echo 'Acquire::http::Proxy \"#{proxyurl}/\";' >> /etc/apt/apt.conf.d/10proxy").once
499
460
  expect(host).to receive(:exec).once
@@ -501,7 +462,7 @@ describe Beaker do
501
462
  subject.package_proxy(host, options.merge({ 'package_proxy' => proxyurl }))
502
463
  end
503
464
 
504
- %w[amazon centos redhat].each do |platform|
465
+ %w[amazon-2023-64 el-9-64].each do |platform|
505
466
  it "can set proxy config on a '#{platform}' host" do
506
467
  host = make_host('name', { :platform => platform })
507
468
 
@@ -517,43 +478,43 @@ describe Beaker do
517
478
  subject { dummy_class.new }
518
479
 
519
480
  it "sets user ssh environment on an OS X 10.10 host" do
520
- test_host_ssh_calls('osx-10.10')
481
+ test_host_ssh_calls('osx-10.10-64')
521
482
  end
522
483
 
523
484
  it "sets user ssh environment on an OS X 10.11 host" do
524
- test_host_ssh_calls('osx-10.11')
485
+ test_host_ssh_calls('osx-10.11-64')
525
486
  end
526
487
 
527
488
  it "sets user ssh environment on an OS X 10.12 host" do
528
- test_host_ssh_calls('osx-10.12')
489
+ test_host_ssh_calls('osx-10.12-64')
529
490
  end
530
491
 
531
492
  it "sets user ssh environment on an OS X 10.13 host" do
532
- test_host_ssh_calls('osx-10.13')
493
+ test_host_ssh_calls('osx-10.13-64')
533
494
  end
534
495
 
535
496
  it "sets user ssh environment on an ssh-based linux host" do
536
- test_host_ssh_calls('ubuntu')
497
+ test_host_ssh_calls('ubuntu-2204-64')
537
498
  end
538
499
 
539
500
  it "sets user ssh environment on an sles host" do
540
- test_host_ssh_calls('sles')
501
+ test_host_ssh_calls('sles-15-64')
541
502
  end
542
503
 
543
504
  it "sets user ssh environment on a solaris host" do
544
- test_host_ssh_calls('solaris')
505
+ test_host_ssh_calls('solaris-11-64')
545
506
  end
546
507
 
547
508
  it "sets user ssh environment on an aix host" do
548
- test_host_ssh_calls('aix')
509
+ test_host_ssh_calls('aix-7.2-power')
549
510
  end
550
511
 
551
512
  it "sets user ssh environment on a FreeBSD host" do
552
- test_host_ssh_calls('freebsd')
513
+ test_host_ssh_calls('freebsd-14-64')
553
514
  end
554
515
 
555
516
  it "sets user ssh environment on a windows host" do
556
- test_host_ssh_calls('windows')
517
+ test_host_ssh_calls('windows-11-64')
557
518
  end
558
519
 
559
520
  def test_host_ssh_calls(platform_name)
@@ -7,7 +7,7 @@ module Beaker
7
7
  let(:host) { make_host('name', options.merge(platform)) }
8
8
 
9
9
  it 'creates a windows host given a windows config' do
10
- @platform = 'windows'
10
+ @platform = 'windows-11-64'
11
11
  expect(host).to be_a Windows::Host
12
12
  end
13
13
 
@@ -109,16 +109,16 @@ module Beaker
109
109
  result.exit_code = 0
110
110
  expect(Beaker::Command).to receive(:new).with(/grep \^key= ~\/\.ssh\/environment/)
111
111
  expect(host).to receive(:exec).and_return(result)
112
- expect(Beaker::SedCommand).to receive(:new).with('unix', 's/^key=/key=\\/my\\/first\\/value:/', '~/.ssh/environment')
112
+ expect(Beaker::SedCommand).to receive(:new).with('el-9-64', 's/^key=/key=\\/my\\/first\\/value:/', '~/.ssh/environment')
113
113
  host.add_env_var('key', '/my/first/value')
114
114
  end
115
115
  end
116
116
 
117
117
  describe "#delete_env_var" do
118
118
  it "deletes env var" do
119
- expect(Beaker::SedCommand).to receive(:new).with('unix', '/key=\\/my\\/first\\/value$/d', '~/.ssh/environment')
120
- expect(Beaker::SedCommand).to receive(:new).with("unix", "s/key=\\(.*\\)[;:]\\/my\\/first\\/value/key=\\1/", "~/.ssh/environment")
121
- expect(Beaker::SedCommand).to receive(:new).with("unix", "s/key=\\/my\\/first\\/value[;:]/key=/", "~/.ssh/environment")
119
+ expect(Beaker::SedCommand).to receive(:new).with('el-9-64', '/key=\\/my\\/first\\/value$/d', '~/.ssh/environment')
120
+ expect(Beaker::SedCommand).to receive(:new).with("el-9-64", "s/key=\\(.*\\)[;:]\\/my\\/first\\/value/key=\\1/", "~/.ssh/environment")
121
+ expect(Beaker::SedCommand).to receive(:new).with("el-9-64", "s/key=\\/my\\/first\\/value[;:]/key=/", "~/.ssh/environment")
122
122
  host.delete_env_var('key', '/my/first/value')
123
123
  end
124
124
  end
@@ -250,7 +250,7 @@ module Beaker
250
250
  describe "#mkdir_p" do
251
251
  it "does the right thing on a bash host, identified as is_cygwin=true" do
252
252
  @options = { :is_cygwin => true }
253
- @platform = 'windows'
253
+ @platform = 'windows-11-64'
254
254
  result = double
255
255
  allow(result).to receive(:exit_code).and_return(0)
256
256
  allow(host).to receive(:exec).and_return(result)
@@ -261,7 +261,7 @@ module Beaker
261
261
 
262
262
  it "does the right thing on a bash host, identified as is_cygwin=nil" do
263
263
  @options = { :is_cygwin => nil }
264
- @platform = 'windows'
264
+ @platform = 'windows-11-64'
265
265
  result = double
266
266
  allow(result).to receive(:exit_code).and_return(0)
267
267
  allow(host).to receive(:exec).and_return(result)
@@ -272,7 +272,7 @@ module Beaker
272
272
 
273
273
  it "does the right thing on a non-bash host, identified as is_cygwin=false (powershell)" do
274
274
  @options = { :is_cygwin => false }
275
- @platform = 'windows'
275
+ @platform = 'windows-11-64'
276
276
  result = double
277
277
  allow(result).to receive(:exit_code).and_return(0)
278
278
  allow(host).to receive(:exec).and_return(result)
@@ -290,19 +290,17 @@ module Beaker
290
290
 
291
291
  describe "#touch" do
292
292
  it "generates the right absolute command for a windows host" do
293
- @platform = 'windows'
293
+ @platform = 'windows-11-64'
294
294
  expect(host.touch('touched_file')).to eq "c:\\\\windows\\\\system32\\\\cmd.exe /c echo. 2> touched_file"
295
295
  end
296
296
 
297
- %w[centos redhat].each do |platform|
298
- it "generates the right absolute command for a #{platform} host" do
299
- @platform = platform
300
- expect(host.touch('touched_file')).to eq "/bin/touch touched_file"
301
- end
297
+ it "generates the right absolute command for an el-9-64 host" do
298
+ @platform = 'el-9-64'
299
+ expect(host.touch('touched_file')).to eq "/bin/touch touched_file"
302
300
  end
303
301
 
304
- it "generates the right absolute command for an osx host" do
305
- @platform = 'osx'
302
+ it "generates the right absolute command for an osx-12-64 host" do
303
+ @platform = 'osx-12-64'
306
304
  expect(host.touch('touched_file')).to eq "/usr/bin/touch touched_file"
307
305
  end
308
306
  end
@@ -762,12 +760,12 @@ module Beaker
762
760
 
763
761
  describe "#fips_mode?" do
764
762
  it 'returns false on non-linux hosts' do
765
- @platform = 'windows'
763
+ @platform = 'windows-11-64'
766
764
  expect(host).to receive(:file_exist?).with('/proc/sys/crypto/fips_enabled').and_return(false)
767
765
  expect(host.fips_mode?).to be false
768
766
  end
769
767
 
770
- platforms = %w[el-7 el-8 centos]
768
+ platforms = %w[el-7-64 el-8-64 centos-9-64]
771
769
 
772
770
  platforms.each do |platform|
773
771
  context "on #{platform}" do
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  module Beaker
4
4
  describe Hypervisor do
5
- let(:hosts) { make_hosts({ :platform => 'el-5' }) }
5
+ let(:hosts) { make_hosts({ :platform => 'el-9-64' }) }
6
6
 
7
7
  describe "#create" do
8
8
  let(:hypervisor) { described_class }
@@ -25,32 +25,34 @@ module Beaker
25
25
  end
26
26
 
27
27
  it 'creates a new Perf object with a single host' do
28
- hosts = [make_host("myHost", @options)]
29
- hosts.each { |host| host['platform'] = "centos-6-x86_64" }
28
+ hosts = [make_host("myHost", @options.merge('platform' => 'centos-6-64'))]
30
29
  @my_logger.remove_destination(STDOUT)
31
30
  perf = described_class.new(hosts, @options)
32
31
  expect(perf).to be_a described_class
33
- expect(@my_io.string).to match(/Setup perf on host: myHost/)
32
+ expect(@my_io.string).to eq("Setup perf on host: myHost\n")
34
33
  end
35
34
 
36
35
  it 'creates a new Perf object with multiple hosts' do
37
- hosts = [make_host("myHost", @options), make_host("myOtherHost", @options)]
38
- hosts.each { |host| host['platform'] = "centos-6-x86_64" }
36
+ hosts = [
37
+ make_host("myHost", @options.merge('platform' => 'centos-6-64')),
38
+ make_host("myOtherHost", @options.merge('platform' => 'centos-6-64')),
39
+ ]
39
40
  @my_logger.remove_destination(STDOUT)
40
41
  perf = described_class.new(hosts, @options)
41
42
  expect(perf).to be_a described_class
42
- expect(@my_io.string).to match(/Setup perf on host: myHost*\nSetup perf on host: myOtherHost/)
43
+ expect(@my_io.string).to eq("Setup perf on host: myHost\nSetup perf on host: myOtherHost\n")
43
44
  end
44
45
 
45
46
  it 'creates a new Perf object with multiple hosts, SLES' do
46
- hosts = [make_host("myHost", @options), make_host("myOtherHost", @options), make_host("myThirdHost", @options)]
47
- hosts[0]['platform'] = "centos-6-x86_64"
48
- hosts[1]['platform'] = "sles-11-x86_64"
49
- hosts[2]['platform'] = "opensuse-15-x86_64"
47
+ hosts = [
48
+ make_host("myHost", @options.merge('platform' => 'centos-6-64')),
49
+ make_host("myOtherHost", @options.merge('platform' => 'sles-11-64')),
50
+ make_host("myThirdHost", @options.merge('platform' => 'opensuse-15-64')),
51
+ ]
50
52
  @my_logger.remove_destination(STDOUT)
51
53
  perf = described_class.new(hosts, @options)
52
54
  expect(perf).to be_a described_class
53
- expect(@my_io.string).to match(/Setup perf on host: myHost\nSetup perf on host: myOtherHost/)
55
+ expect(@my_io.string).to include("Setup perf on host: myHost\nSetup perf on host: myOtherHost\n")
54
56
  end
55
57
  end
56
58
 
@@ -60,7 +62,6 @@ module Beaker
60
62
  @options[:collect_perf_data] = 'normal'
61
63
  @options[:log_level] = :debug
62
64
  @options[:color] = false
63
- @hosts = [make_host("myHost", @options), make_host("myOtherHost", @options)]
64
65
  @my_io = StringIO.new
65
66
  @my_logger = Beaker::Logger.new(@options)
66
67
  @my_logger.add_destination(@my_io)
@@ -68,21 +69,24 @@ module Beaker
68
69
  end
69
70
 
70
71
  it "Does the Right Thing on Linux hosts" do
71
- @hosts[0]['platform'] = "centos-6-x86_64"
72
+ hosts = [make_host("myHost", @options.merge('platform' => 'centos-6-64'))]
72
73
  @my_logger.remove_destination(STDOUT)
73
- perf = described_class.new(@hosts, @options)
74
+ perf = described_class.new(hosts, @options)
74
75
  expect(perf).to be_a described_class
75
76
  perf.print_perf_info
76
- expect(@my_io.string).to match(/Setup perf on host: myHost\nSetup perf on host: myOtherHost\nPerf \(sysstat\) not supported on host: myOtherHost\nGetting perf data for host: myHost\nGetting perf data for host: myOtherHost\nPerf \(sysstat\) not supported on host: myOtherHost/)
77
+ expect(@my_io.string).to eq("Setup perf on host: myHost\nGetting perf data for host: myHost\n")
77
78
  end
78
79
 
79
80
  it "Does the Right Thing on non-Linux hosts" do
80
- @hosts[0]['platform'] = "windows"
81
+ hosts = [
82
+ make_host("myHost", @options.merge('platform' => 'windows-11-64')),
83
+ make_host("myOtherHost", @options.merge('platform' => 'solaris-11-64')),
84
+ ]
81
85
  @my_logger.remove_destination(STDOUT)
82
- perf = described_class.new(@hosts, @options)
86
+ perf = described_class.new(hosts, @options)
83
87
  expect(perf).to be_a described_class
84
88
  perf.print_perf_info
85
- expect(@my_io.string).to match(/Setup perf on host: myHost\nPerf \(sysstat\) not supported on host: myHost\nSetup perf on host: myOtherHost\nPerf \(sysstat\) not supported on host: myOtherHost\nGetting perf data for host: myHost\nPerf \(sysstat\) not supported on host: myHost\nGetting perf data for host: myOtherHost\nPerf \(sysstat\) not supported on host: myOtherHost/)
89
+ expect(@my_io.string).to eq("Setup perf on host: myHost\nPerf (sysstat) not supported on host: myHost\nSetup perf on host: myOtherHost\nPerf (sysstat) not supported on host: myOtherHost\nGetting perf data for host: myHost\nPerf (sysstat) not supported on host: myHost\nGetting perf data for host: myOtherHost\nPerf (sysstat) not supported on host: myOtherHost\n")
86
90
  end
87
91
  end
88
92
  end
@@ -11,7 +11,7 @@ module Beaker
11
11
  let(:logger) { double('logger') }
12
12
  let(:host_handler) { described_class }
13
13
  let(:spec_block) { Proc.new { |arr| arr } }
14
- let(:platform) { @platform || 'unix' }
14
+ let(:platform) { @platform || 'el-9-64' }
15
15
  let(:role0) { "role0" }
16
16
  let(:role1) { :role1 }
17
17
  let(:role2) { :role2 }
data/spec/helpers.rb CHANGED
@@ -24,7 +24,7 @@ module TestFileHelpers
24
24
  end
25
25
 
26
26
  module HostHelpers
27
- HOST_DEFAULTS = { :platform => 'unix',
27
+ HOST_DEFAULTS = { :platform => 'el-9-64',
28
28
  :roles => ['agent'],
29
29
  :snapshot => 'snap',
30
30
  :ip => 'default.ip.address',
@@ -91,6 +91,8 @@ module HostHelpers
91
91
  def make_host name, host_hash
92
92
  host_hash = Beaker::Options::OptionsHash.new.merge(HOST_DEFAULTS.merge(host_hash))
93
93
 
94
+ host_hash['platform'] = Beaker::Platform.new(host_hash['platform']) unless host_hash['platform'].is_a?(Beaker::Platform)
95
+
94
96
  host = Beaker::Host.create(name, host_hash, make_opts)
95
97
 
96
98
  allow(host).to receive(:exec).and_return(generate_result(name, host_hash))
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: 6.3.0
4
+ version: 6.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-13 00:00:00.000000000 Z
11
+ date: 2024-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fakefs