beaker 4.32.0 → 4.35.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: 0c00ec9028362af1b8966b03ad80797dd3e1d2e16bee268482568f399cf94874
4
- data.tar.gz: be92467b94636b65b1b2f37543ca26426d920f36e0182c12fe3fe8a98ef060e1
3
+ metadata.gz: 9a6679daffb138ec6bb59a4b06779db93ce4aada9f4213696ccbc1ea00041e3f
4
+ data.tar.gz: 81d748b81d7ff9ec56e9b7b1309682f38540e0f03c9a861404a2493f592d4313
5
5
  SHA512:
6
- metadata.gz: 4f65220ed8d6144a1a1438f91d7a79a0fb211ac1f3564167da1ceec48c588dc5b5b91c038e3b7ff513373e95d646eba2f47ff8b36e3f424f8450bc9d982e0cdc
7
- data.tar.gz: 91c0890e82571154da9b32fd8a69a6d1545cd505922f24d0bf16e4f1c228c748ff9e2d74de74c5b8529c769b2e2179531645eb0a9f261e4580d09fb86e60bb1c
6
+ metadata.gz: b631a91707d5b1f6ff2dbb855f0cb67cfe8a693f7923b4e6dbe03eb36e6be6a9f37f56a9886eaa9c371879e3d1e4a7d276404079990e7b60c12614811805ff5c
7
+ data.tar.gz: 893a6a7616500aba9df72dcaed0305bcd73038178e5b9687b0cbf2313737801e39e11a49b1bc7d836249d34577dde7bc0a79c7841072c3847bcd6255aaf55624
@@ -19,6 +19,7 @@ jobs:
19
19
  - ruby: "2.6"
20
20
  - ruby: "2.7"
21
21
  - ruby: "3.0"
22
+ - ruby: "3.1"
22
23
  coverage: "yes"
23
24
  env:
24
25
  COVERAGE: ${{ matrix.coverage }}
@@ -29,5 +30,7 @@ jobs:
29
30
  with:
30
31
  ruby-version: ${{ matrix.ruby }}
31
32
  bundler-cache: true
33
+ - name: Build gem
34
+ run: gem build *.gemspec
32
35
  - name: Run tests
33
36
  run: bundle exec rake spec
data/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.35.0](https://github.com/voxpupuli/beaker/tree/4.35.0) (2022-05-13)
4
+
5
+ ## Added
6
+
7
+ - Add Ruby 3.1 support ([#1736](https://github.com/voxpupuli/beaker/pull/1736))
8
+ - Build gem during CI runs ([#1738](https://github.com/voxpupuli/beaker/pull/1738))
9
+
10
+ ## [4.34.0](https://github.com/voxpupuli/beaker/tree/4.34.0) (2022-01-27)
11
+
12
+ ### Added
13
+
14
+ - Extract a host_packages method from validate_host ([#1729](https://github.com/voxpupuli/beaker/pull/1729))
15
+ - Reduce duplication in ssh_permit_user_environment ([#1728](https://github.com/voxpupuli/beaker/pull/1728))
16
+
17
+ ### Fixed
18
+
19
+ - Do not install curl on EL9 ([#1728](https://github.com/voxpupuli/beaker/pull/1732))
20
+ - Drop old Ruby 1.8 compatibility code ([#1728](https://github.com/voxpupuli/beaker/pull/1730))
21
+
22
+ ## [4.33.0](https://github.com/voxpupuli/beaker/tree/4.33.0) (2022-01-21)
23
+
24
+ ### Added
25
+
26
+ - Add ed25519 as runtime dependency ([#1726](https://github.com/voxpupuli/beaker/pull/1726))
27
+
3
28
  ## [4.32.0](https://github.com/voxpupuli/beaker/tree/4.32.0) (2021-12-06)
4
29
 
5
30
  ### Fixed
data/Gemfile CHANGED
@@ -28,3 +28,5 @@ group :coverage, optional: ENV['COVERAGE']!='yes' do
28
28
  gem 'simplecov-console', :require => false
29
29
  gem 'codecov', :require => false
30
30
  end
31
+
32
+ gem 'rdoc' if RUBY_VERSION >= '3.1'
data/beaker.gemspec CHANGED
@@ -39,6 +39,7 @@ Gem::Specification.new do |s|
39
39
 
40
40
  s.add_runtime_dependency 'hocon', '~> 1.0'
41
41
  s.add_runtime_dependency 'net-ssh', '>= 5.0'
42
+ s.add_runtime_dependency 'ed25519', '~> 1.0' # net-ssh compatibility with ed25519 keys
42
43
  s.add_runtime_dependency 'net-scp', '>= 1.2', '< 4.0'
43
44
  s.add_runtime_dependency 'inifile', '~> 3.0'
44
45
 
@@ -302,29 +302,11 @@ 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/
305
+ when /debian|ubuntu|cumulus|huaweios|archlinux|el-|centos|fedora|redhat|oracle|scientific|eos|opensuse|sles|solaris/
306
306
  directory = tmpdir()
307
307
  exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
308
308
  exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
309
309
  exec(Beaker::Command.new("echo '' >/etc/environment")) if self['platform'] =~ /ubuntu-20.04/
310
- when /el-7|centos-7|redhat-7|oracle-7|scientific-7|eos-7|el-8|centos-8|redhat-8|oracle-8/
311
- directory = tmpdir()
312
- exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
313
- exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
314
- when /el-|centos|fedora|redhat|oracle|scientific|eos/
315
- directory = tmpdir()
316
- exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
317
- exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
318
- when /opensuse|sles/
319
- directory = tmpdir()
320
- exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
321
- exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
322
- when /solaris/
323
- # kept solaris here because refactoring it into its own Host module
324
- # conflicts with the solaris hypervisor that already exists
325
- directory = tmpdir()
326
- exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
327
- exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
328
310
  when /(free|open)bsd/
329
311
  exec(Beaker::Command.new("sudo perl -pi -e 's/^#?PermitUserEnvironment no/PermitUserEnvironment yes/' /etc/ssh/sshd_config"), {:pty => true} )
330
312
  else
@@ -13,6 +13,7 @@ module Beaker
13
13
  SLEEPWAIT = 5
14
14
  TRIES = 5
15
15
  RHEL8_PACKAGES = ['curl', 'chrony']
16
+ RHEL9_PACKAGES = ['chrony']
16
17
  FEDORA_PACKAGES = ['curl', 'chrony']
17
18
  UNIX_PACKAGES = ['curl', 'ntpdate']
18
19
  FREEBSD_PACKAGES = ['curl', 'perl5|perl']
@@ -101,42 +102,58 @@ module Beaker
101
102
  def validate_host host, opts
102
103
  logger = opts[:logger]
103
104
  block_on host do |host|
104
- case
105
- when host['platform'] =~ /el-[89]/
106
- check_and_install_packages_if_needed(host, RHEL8_PACKAGES)
107
- when host['platform'] =~ /sles-10/
108
- check_and_install_packages_if_needed(host, SLES10_PACKAGES)
109
- when host['platform'] =~ /opensuse|sles-/
110
- check_and_install_packages_if_needed(host, SLES_PACKAGES)
111
- when host['platform'] =~ /debian/
112
- check_and_install_packages_if_needed(host, DEBIAN_PACKAGES)
113
- when host['platform'] =~ /cumulus/
114
- check_and_install_packages_if_needed(host, CUMULUS_PACKAGES)
115
- when (host['platform'] =~ /windows/ and host.is_cygwin?)
116
- raise RuntimeError, "cygwin is not installed on #{host}" if !host.cygwin_installed?
117
- check_and_install_packages_if_needed(host, WINDOWS_PACKAGES)
118
- when (host['platform'] =~ /windows/ and not host.is_cygwin?)
119
- check_and_install_packages_if_needed(host, PSWINDOWS_PACKAGES)
120
- when host['platform'] =~ /freebsd/
121
- check_and_install_packages_if_needed(host, FREEBSD_PACKAGES)
122
- when host['platform'] =~ /openbsd/
123
- check_and_install_packages_if_needed(host, OPENBSD_PACKAGES)
124
- when host['platform'] =~ /solaris-10/
125
- check_and_install_packages_if_needed(host, SOLARIS10_PACKAGES)
126
- when host['platform'] =~ /solaris-1[1-9]/
127
- check_and_install_packages_if_needed(host, SOLARIS11_PACKAGES)
128
- when host['platform'] =~ /archlinux/
129
- check_and_install_packages_if_needed(host, ARCHLINUX_PACKAGES)
130
- when host['platform'] =~ /fedora/
131
- check_and_install_packages_if_needed(host, FEDORA_PACKAGES)
132
- when host['platform'] !~ /debian|aix|solaris|windows|opensuse-|sles-|osx-|cumulus|f5-|netscaler|cisco_/
133
- check_and_install_packages_if_needed(host, UNIX_PACKAGES)
134
- end
105
+ check_and_install_packages_if_needed(host, host_packages(host))
135
106
  end
136
107
  rescue => e
137
108
  report_and_raise(logger, e, "validate")
138
109
  end
139
110
 
111
+ # Return a list of packages that should be present.
112
+ #
113
+ # @param [Host] host A host return the packages for
114
+ # @return [Array<String>] A list of packages to install
115
+ def host_packages(host)
116
+ case host['platform']
117
+ when /el-8/
118
+ RHEL8_PACKAGES
119
+ when /el-9/
120
+ RHEL9_PACKAGES
121
+ when /sles-10/
122
+ SLES10_PACKAGES
123
+ when /opensuse|sles-/
124
+ SLES_PACKAGES
125
+ when /debian/
126
+ DEBIAN_PACKAGES
127
+ when /cumulus/
128
+ CUMULUS_PACKAGES
129
+ when /windows/
130
+ if host.is_cygwin?
131
+ raise RuntimeError, "cygwin is not installed on #{host}" if !host.cygwin_installed?
132
+ WINDOWS_PACKAGES
133
+ else
134
+ PSWINDOWS_PACKAGES
135
+ end
136
+ when /freebsd/
137
+ FREEBSD_PACKAGES
138
+ when /openbsd/
139
+ OPENBSD_PACKAGES
140
+ when /solaris-10/
141
+ SOLARIS10_PACKAGES
142
+ when /solaris-1[1-9]/
143
+ SOLARIS11_PACKAGES
144
+ when /archlinux/
145
+ ARCHLINUX_PACKAGES
146
+ when /fedora/
147
+ FEDORA_PACKAGES
148
+ else
149
+ if host['platform'] !~ /aix|solaris|osx-|f5-|netscaler|cisco_/
150
+ UNIX_PACKAGES
151
+ else
152
+ []
153
+ end
154
+ end
155
+ end
156
+
140
157
  # Installs the given packages if they aren't already on a host
141
158
  #
142
159
  # @param [Host] host Host to act on
@@ -2,6 +2,7 @@ module Beaker
2
2
  module Options
3
3
  #A set of functions to parse hosts files
4
4
  module HostsFileParser
5
+ PERMITTED_YAML_CLASSES = [Beaker::Options::OptionsHash, Beaker::Platform, Symbol, Time]
5
6
 
6
7
  # Read the contents of the hosts.cfg into an OptionsHash, merge the 'CONFIG' section into the OptionsHash, return OptionsHash
7
8
  # @param [String] hosts_file_path The path to the hosts file
@@ -24,7 +25,7 @@ module Beaker
24
25
 
25
26
  raise "#{hosts_file_path} is not a valid path" unless File.exist?(hosts_file_path)
26
27
 
27
- YAML.load(ERB.new(File.read(hosts_file_path), nil, '-').result(binding))
28
+ process_yaml(File.read(hosts_file_path), binding)
28
29
  }
29
30
  fix_roles_array( host_options )
30
31
  end
@@ -42,7 +43,7 @@ module Beaker
42
43
  return host_options unless hosts_def_yaml
43
44
  error_message = "#{hosts_def_yaml}\nis not a valid YAML string\n\t"
44
45
  host_options = self.merge_hosts_yaml( host_options, error_message ) {
45
- YAML.load(ERB.new(hosts_def_yaml, nil, '-').result(binding))
46
+ process_yaml(hosts_def_yaml, binding)
46
47
  }
47
48
  fix_roles_array( host_options )
48
49
  end
@@ -85,6 +86,23 @@ module Beaker
85
86
  host_options.merge( loaded_host_options )
86
87
  end
87
88
 
89
+ # A helper to parse the YAML file and apply ERB templating
90
+ #
91
+ # @param [String] path Path to the file to read
92
+ # @param [Binding] b The binding to pass to ERB rendering
93
+ # @api private
94
+ def self.process_yaml(template, b)
95
+ erb_obj = if RUBY_VERSION >= '2.7'
96
+ ERB.new(template, trim_mode: '-')
97
+ else
98
+ ERB.new(template, nil, '-')
99
+ end
100
+ if RUBY_VERSION >= '2.6'
101
+ YAML.safe_load(erb_obj.result(b), permitted_classes: PERMITTED_YAML_CLASSES)
102
+ else
103
+ YAML.load(erb_obj.result(b))
104
+ end
105
+ end
88
106
  end
89
107
  end
90
108
  end
@@ -130,14 +130,5 @@ module Beaker
130
130
  def with_version_number
131
131
  [@variant, @version, @arch].join('-')
132
132
  end
133
-
134
- if RUBY_VERSION =~ /^1\.9/
135
- def init_with(coder)
136
- coder.map.each do |ivar, value|
137
- instance_variable_set("@#{ivar}", value)
138
- end
139
- replace("#{@variant}-#{@version}-#{@arch}")
140
- end
141
- end
142
133
  end
143
134
  end
@@ -1,5 +1,5 @@
1
1
  module Beaker
2
2
  module Version
3
- STRING = '4.32.0'
3
+ STRING = '4.35.0'
4
4
  end
5
5
  end
@@ -1,5 +1,15 @@
1
1
  require 'spec_helper'
2
2
 
3
+ def load_yaml_file(path)
4
+ # Ruby 2.x has no safe_load_file
5
+ if YAML.respond_to?(:safe_load_file)
6
+ permitted = [Beaker::Options::OptionsHash, Symbol, RSpec::Mocks::Double, Time]
7
+ YAML.safe_load_file(path, permitted_classes: permitted, aliases: true)
8
+ else
9
+ YAML.load_file(path)
10
+ end
11
+ end
12
+
3
13
  module Beaker
4
14
  describe CLI do
5
15
 
@@ -361,7 +371,7 @@ module Beaker
361
371
  cli.instance_variable_set(:@hosts, hosts)
362
372
 
363
373
  preserved_file = cli.preserve_hosts_file
364
- hosts_yaml = YAML.load_file(preserved_file)
374
+ hosts_yaml = load_yaml_file(preserved_file)
365
375
  expect(hosts_yaml['CONFIG'][:tests]).to be == []
366
376
  expect(hosts_yaml['CONFIG'][:pre_suite]).to be == []
367
377
  expect(hosts_yaml['CONFIG'][:post_suite]).to be == []
@@ -428,7 +438,7 @@ module Beaker
428
438
  cli.execute!
429
439
 
430
440
  copied_hosts_file = File.join(File.absolute_path(dir), 'hosts_preserved.yml')
431
- expect{ YAML.load_file(copied_hosts_file) }.to_not raise_error
441
+ expect{ load_yaml_file(copied_hosts_file) }.to_not raise_error
432
442
  end
433
443
  end
434
444
 
@@ -440,7 +450,7 @@ module Beaker
440
450
  cli.execute!
441
451
 
442
452
  copied_hosts_file = File.join(File.absolute_path(dir), 'hosts_preserved.yml')
443
- yaml_content = YAML.load_file(copied_hosts_file)
453
+ yaml_content = load_yaml_file(copied_hosts_file)
444
454
  expect( yaml_content['CONFIG']['provision'] ).to be_falsy
445
455
  end
446
456
  end
@@ -106,7 +106,7 @@ module Beaker
106
106
  pkg = 'sles_package'
107
107
  expect( Beaker::Command ).to receive( :new ).with( /^rpmkeys.*nightlies.puppetlabs.com.*/, anything, anything ).and_return('').ordered.once
108
108
  expect( Beaker::Command ).to receive(:new).with("zypper --gpg-auto-import-keys se -i --match-exact #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('').ordered.once
109
- expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0})).exactly(2).times
109
+ expect( instance ).to receive(:exec).with('', {:accept_all_exit_codes => true}).and_return(generate_result("hello", {:exit_code => 0})).exactly(2).times
110
110
  expect( instance.check_for_package(pkg) ).to be === true
111
111
  end
112
112
  it "checks correctly on opensuse" do
@@ -114,7 +114,7 @@ module Beaker
114
114
  pkg = 'sles_package'
115
115
  expect( Beaker::Command ).to receive( :new ).with( /^rpmkeys.*nightlies.puppetlabs.com.*/, anything, anything ).and_return('').ordered.once
116
116
  expect( Beaker::Command ).to receive(:new).with("zypper --gpg-auto-import-keys se -i --match-exact #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('').ordered.once
117
- expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0})).exactly(2).times
117
+ expect( instance ).to receive(:exec).with('', {:accept_all_exit_codes => true}).and_return(generate_result("hello", {:exit_code => 0})).exactly(2).times
118
118
  expect( instance.check_for_package(pkg) ).to be === true
119
119
  end
120
120
 
@@ -122,7 +122,7 @@ module Beaker
122
122
  @opts = {'platform' => 'fedora-is-me'}
123
123
  pkg = 'fedora_package'
124
124
  expect( Beaker::Command ).to receive(:new).with("rpm -q #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
125
- expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
125
+ expect( instance ).to receive(:exec).with('', {:accept_all_exit_codes => true}).and_return(generate_result("hello", {:exit_code => 0}))
126
126
  expect( instance.check_for_package(pkg) ).to be === true
127
127
  end
128
128
 
@@ -131,7 +131,7 @@ module Beaker
131
131
  @opts = {'platform' => "#{platform}-is-me"}
132
132
  pkg = "#{platform}_package"
133
133
  expect( Beaker::Command ).to receive(:new).with("rpm -q #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
134
- expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
134
+ expect( instance ).to receive(:exec).with('', {:accept_all_exit_codes => true}).and_return(generate_result("hello", {:exit_code => 0}))
135
135
  expect( instance.check_for_package(pkg) ).to be === true
136
136
  end
137
137
  end
@@ -140,7 +140,7 @@ module Beaker
140
140
  @opts = {'platform' => 'eos-is-me'}
141
141
  pkg = 'eos-package'
142
142
  expect( Beaker::Command ).to receive(:new).with("rpm -q #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
143
- expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
143
+ expect( instance ).to receive(:exec).with('', {:accept_all_exit_codes => true}).and_return(generate_result("hello", {:exit_code => 0}))
144
144
  expect( instance.check_for_package(pkg) ).to be === true
145
145
  end
146
146
 
@@ -148,7 +148,7 @@ module Beaker
148
148
  @opts = {'platform' => 'el-is-me'}
149
149
  pkg = 'el_package'
150
150
  expect( Beaker::Command ).to receive(:new).with("rpm -q #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
151
- expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
151
+ expect( instance ).to receive(:exec).with('', {:accept_all_exit_codes => true}).and_return(generate_result("hello", {:exit_code => 0}))
152
152
  expect( instance.check_for_package(pkg) ).to be === true
153
153
  end
154
154
 
@@ -156,14 +156,14 @@ module Beaker
156
156
  @opts = {'platform' => 'huaweios-is-me'}
157
157
  pkg = 'debian_package'
158
158
  expect( Beaker::Command ).to receive(:new).with("dpkg -s #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
159
- expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
159
+ expect( instance ).to receive(:exec).with('', {:accept_all_exit_codes => true}).and_return(generate_result("hello", {:exit_code => 0}))
160
160
  expect( instance.check_for_package(pkg) ).to be === true
161
161
  end
162
162
  it "checks correctly on debian" do
163
163
  @opts = {'platform' => 'debian-is-me'}
164
164
  pkg = 'debian_package'
165
165
  expect( Beaker::Command ).to receive(:new).with("dpkg -s #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
166
- expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
166
+ expect( instance ).to receive(:exec).with('', {:accept_all_exit_codes => true}).and_return(generate_result("hello", {:exit_code => 0}))
167
167
  expect( instance.check_for_package(pkg) ).to be === true
168
168
  end
169
169
 
@@ -171,7 +171,7 @@ module Beaker
171
171
  @opts = {'platform' => 'ubuntu-is-me'}
172
172
  pkg = 'ubuntu_package'
173
173
  expect( Beaker::Command ).to receive(:new).with("dpkg -s #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
174
- expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
174
+ expect( instance ).to receive(:exec).with('', {:accept_all_exit_codes => true}).and_return(generate_result("hello", {:exit_code => 0}))
175
175
  expect( instance.check_for_package(pkg) ).to be === true
176
176
  end
177
177
 
@@ -179,7 +179,7 @@ module Beaker
179
179
  @opts = {'platform' => 'cumulus-is-me'}
180
180
  pkg = 'cumulus_package'
181
181
  expect( Beaker::Command ).to receive(:new).with("dpkg -s #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
182
- expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
182
+ expect( instance ).to receive(:exec).with('', {:accept_all_exit_codes => true}).and_return(generate_result("hello", {:exit_code => 0}))
183
183
  expect( instance.check_for_package(pkg) ).to be === true
184
184
  end
185
185
 
@@ -187,7 +187,7 @@ module Beaker
187
187
  @opts = {'platform' => 'solaris-11-is-me'}
188
188
  pkg = 'solaris-11_package'
189
189
  expect( Beaker::Command ).to receive(:new).with("pkg info #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
190
- expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
190
+ expect( instance ).to receive(:exec).with('', {:accept_all_exit_codes => true}).and_return(generate_result("hello", {:exit_code => 0}))
191
191
  expect( instance.check_for_package(pkg) ).to be === true
192
192
  end
193
193
 
@@ -195,7 +195,7 @@ module Beaker
195
195
  @opts = {'platform' => 'solaris-10-is-me'}
196
196
  pkg = 'solaris-10_package'
197
197
  expect( Beaker::Command ).to receive(:new).with("pkginfo #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
198
- expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
198
+ expect( instance ).to receive(:exec).with('', {:accept_all_exit_codes => true}).and_return(generate_result("hello", {:exit_code => 0}))
199
199
  expect( instance.check_for_package(pkg) ).to be === true
200
200
  end
201
201
 
@@ -203,7 +203,7 @@ module Beaker
203
203
  @opts = {'platform' => 'archlinux-is-me'}
204
204
  pkg = 'archlinux_package'
205
205
  expect( Beaker::Command ).to receive(:new).with("pacman -Q #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
206
- expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
206
+ expect( instance ).to receive(:exec).with('', {:accept_all_exit_codes => true}).and_return(generate_result("hello", {:exit_code => 0}))
207
207
  expect( instance.check_for_package(pkg) ).to be === true
208
208
  end
209
209
 
@@ -489,9 +489,9 @@ describe Beaker do
489
489
  end
490
490
 
491
491
  it 'skips validation on cisco hosts' do
492
- @platform = 'cisco_nexus-7-x86_64'
493
- expect( subject ).to receive( :check_and_install_packages_if_needed ).never
494
- subject.validate_host(hosts, options)
492
+ host = make_host('cisco-7', { stdout: stdout, platform: 'cisco_nexus-7-x86_64' })
493
+ expect( subject ).to receive( :check_and_install_packages_if_needed ).with(host, []).once
494
+ subject.validate_host(host, options)
495
495
  end
496
496
  end
497
497
 
@@ -17,12 +17,7 @@ module Beaker
17
17
  expect( logger.convert(valid_utf8) ).to be === valid_utf8
18
18
  end
19
19
  it 'strips out invalid utf-8 characters' do
20
- #this is 1.9 behavior only
21
- if RUBY_VERSION.to_f >= 1.9
22
- expect( logger.convert(invalid_utf8) ).to be === valid_utf8
23
- else
24
- pending "not supported in ruby 1.8 (using #{RUBY_VERSION})"
25
- end
20
+ expect( logger.convert(invalid_utf8) ).to be === valid_utf8
26
21
  end
27
22
  it 'supports frozen strings' do
28
23
  valid_utf8.freeze
@@ -66,9 +66,10 @@ module Beaker
66
66
  expect( host_options ).to be === parser.new_host_options
67
67
  end
68
68
 
69
- it 'passes a YAML.load call through to #merge_hosts_yaml' do
69
+ it 'passes a process_yaml call through to #merge_hosts_yaml' do
70
70
  yaml_string = 'not actually yaml, but that wont matter'
71
- expect( YAML ).to receive( :load ).with( yaml_string )
71
+ expect(described_class).to receive(:process_yaml).with(yaml_string, instance_of(Binding))
72
+
72
73
  parser.parse_hosts_string( yaml_string )
73
74
  end
74
75
  end
@@ -145,12 +145,19 @@ module Beaker
145
145
  end
146
146
  end
147
147
 
148
- context 'round tripping from yaml', if: RUBY_VERSION =~ /^1\.9/ do
148
+ context 'round tripping from yaml' do
149
149
  before do
150
150
  @name = 'ubuntu-14.04-x86_64'
151
151
  end
152
152
 
153
- let(:round_tripped) { YAML.load(YAML.dump(platform)) }
153
+ let(:round_tripped) do
154
+ # Ruby 2 has no unsafe_load
155
+ if YAML.respond_to?(:unsafe_load)
156
+ YAML.unsafe_load(YAML.dump(platform))
157
+ else
158
+ YAML.load(YAML.dump(platform))
159
+ end
160
+ end
154
161
 
155
162
  [:variant, :arch, :version, :codename].each do |field|
156
163
  it "deserializes the '#{field}' field" do
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.32.0
4
+ version: 4.35.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-06 00:00:00.000000000 Z
11
+ date: 2022-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -178,6 +178,20 @@ dependencies:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: '5.0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: ed25519
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '1.0'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '1.0'
181
195
  - !ruby/object:Gem::Dependency
182
196
  name: net-scp
183
197
  requirement: !ruby/object:Gem::Requirement
@@ -662,7 +676,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
662
676
  - !ruby/object:Gem::Version
663
677
  version: '0'
664
678
  requirements: []
665
- rubygems_version: 3.2.32
679
+ rubygems_version: 3.2.33
666
680
  signing_key:
667
681
  specification_version: 4
668
682
  summary: Let's test Puppet!