beaker 4.34.0 → 4.35.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +3 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile +2 -0
- data/lib/beaker/options/hosts_file_parser.rb +20 -2
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/cli_spec.rb +13 -3
- data/spec/beaker/host/unix/pkg_spec.rb +13 -13
- data/spec/beaker/options/hosts_file_parser_spec.rb +3 -2
- data/spec/beaker/platform_spec.rb +8 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a6679daffb138ec6bb59a4b06779db93ce4aada9f4213696ccbc1ea00041e3f
|
4
|
+
data.tar.gz: 81d748b81d7ff9ec56e9b7b1309682f38540e0f03c9a861404a2493f592d4313
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b631a91707d5b1f6ff2dbb855f0cb67cfe8a693f7923b4e6dbe03eb36e6be6a9f37f56a9886eaa9c371879e3d1e4a7d276404079990e7b60c12614811805ff5c
|
7
|
+
data.tar.gz: 893a6a7616500aba9df72dcaed0305bcd73038178e5b9687b0cbf2313737801e39e11a49b1bc7d836249d34577dde7bc0a79c7841072c3847bcd6255aaf55624
|
data/.github/workflows/test.yml
CHANGED
@@ -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,12 @@
|
|
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
|
+
|
3
10
|
## [4.34.0](https://github.com/voxpupuli/beaker/tree/4.34.0) (2022-01-27)
|
4
11
|
|
5
12
|
### Added
|
data/Gemfile
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
data/lib/beaker/version.rb
CHANGED
data/spec/beaker/cli_spec.rb
CHANGED
@@ -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 =
|
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{
|
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 =
|
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
|
|
@@ -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
|
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(
|
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
|
@@ -150,7 +150,14 @@ module Beaker
|
|
150
150
|
@name = 'ubuntu-14.04-x86_64'
|
151
151
|
end
|
152
152
|
|
153
|
-
let(:round_tripped)
|
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.
|
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: 2022-
|
11
|
+
date: 2022-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -676,7 +676,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
676
676
|
- !ruby/object:Gem::Version
|
677
677
|
version: '0'
|
678
678
|
requirements: []
|
679
|
-
rubygems_version: 3.2.
|
679
|
+
rubygems_version: 3.2.33
|
680
680
|
signing_key:
|
681
681
|
specification_version: 4
|
682
682
|
summary: Let's test Puppet!
|