beaker 2.14.1 → 2.15.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 +8 -8
- data/HISTORY.md +286 -27
- data/beaker.gemspec +1 -0
- data/lib/beaker/answers.rb +1 -1
- data/lib/beaker/answers/version40.rb +7 -5
- data/lib/beaker/cli.rb +2 -2
- data/lib/beaker/dsl/helpers/puppet_helpers.rb +24 -2
- data/lib/beaker/dsl/helpers/web_helpers.rb +3 -1
- data/lib/beaker/dsl/install_utils/foss_defaults.rb +11 -1
- data/lib/beaker/dsl/install_utils/foss_utils.rb +358 -248
- data/lib/beaker/dsl/install_utils/module_utils.rb +1 -7
- data/lib/beaker/dsl/install_utils/pe_defaults.rb +1 -1
- data/lib/beaker/dsl/install_utils/pe_utils.rb +63 -9
- data/lib/beaker/dsl/install_utils/puppet_utils.rb +40 -0
- data/lib/beaker/dsl/structure.rb +35 -0
- data/lib/beaker/host/pswindows/exec.rb +9 -0
- data/lib/beaker/host/unix/exec.rb +10 -1
- data/lib/beaker/host/unix/pkg.rb +0 -2
- data/lib/beaker/host_prebuilt_steps.rb +2 -2
- data/lib/beaker/hypervisor/aws_sdk.rb +1 -1
- data/lib/beaker/options/command_line_parser.rb +7 -0
- data/lib/beaker/options/parser.rb +28 -8
- data/lib/beaker/options/presets.rb +4 -3
- data/lib/beaker/shared/semvar.rb +23 -2
- data/lib/beaker/test_suite.rb +2 -2
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/cli_spec.rb +35 -34
- data/spec/beaker/dsl/helpers/puppet_helpers_spec.rb +78 -7
- data/spec/beaker/dsl/install_utils/foss_utils_spec.rb +126 -17
- data/spec/beaker/dsl/install_utils/module_utils_spec.rb +2 -2
- data/spec/beaker/dsl/install_utils/pe_utils_spec.rb +106 -0
- data/spec/beaker/dsl/install_utils/puppet_utils_spec.rb +73 -0
- data/spec/beaker/dsl/structure_spec.rb +67 -0
- data/spec/beaker/host/unix/exec_spec.rb +53 -0
- data/spec/beaker/host/windows/exec_spec.rb +53 -0
- data/spec/beaker/host_prebuilt_steps_spec.rb +13 -0
- data/spec/beaker/hypervisor/aws_sdk_spec.rb +65 -0
- data/spec/beaker/options/command_line_parser_spec.rb +2 -2
- data/spec/beaker/options/parser_spec.rb +126 -1
- data/spec/beaker/shared/semvar_spec.rb +43 -0
- data/spec/beaker/test_suite_spec.rb +21 -0
- data/spec/helpers.rb +4 -0
- metadata +19 -2
@@ -6,8 +6,8 @@ module Beaker
|
|
6
6
|
|
7
7
|
let(:parser) {Beaker::Options::CommandLineParser.new}
|
8
8
|
let(:test_opts) {["-h", "vcloud.cfg", "--debug", "--tests", "test.rb", "--help"]}
|
9
|
-
let(:full_opts_in) {["--hosts", "host.cfg", "--options", "opts_file", "--helper", "path_to_helper", "--load-path", "load_path", "--tests", "test1.rb,test2.rb,test3.rb", "--pre-suite", "pre_suite.rb", "--post-suite", "post_suite.rb", "--no-provision", "--preserve-hosts", "always", "--root-keys", "--keyfile", "../.ssh/id_rsa", "--install", "gitrepopath", "-m", "module", "-q", "--dry-run", "--no-ntp", "--repo-proxy", "--add-el-extras", "--config", "anotherfile.cfg", "--fail-mode", "fast", "--no-color", "--version", "--log-level", "info", "--package-proxy", "http://192.168.100.1:3128", "--collect-perf-data", "--parse-only", "--validate", "--timeout", "40", "--log-prefix", "pants", "--configure"]}
|
10
|
-
let(:full_opts_out) {{:hosts_file=>"anotherfile.cfg",:options_file=>"opts_file", :helper => "path_to_helper", :load_path => "load_path", :tests => "test1.rb,test2.rb,test3.rb", :pre_suite => "pre_suite.rb", :post_suite => "post_suite.rb", :provision=>false, :preserve_hosts => "always", :root_keys=>true, :keyfile => "../.ssh/id_rsa", :install => "gitrepopath", :modules=>"module", :quiet=>true, :dry_run=>true, :timesync=>false, :repo_proxy=>true, :add_el_extras=>true, :fail_mode => "fast", :color=>false, :version=>true, :log_level => "info", :package_proxy => "http://192.168.100.1:3128", :collect_perf_data=>true, :parse_only=>true, :validate=>true, :timeout => "40", :log_prefix => "pants", :configure => true}}
|
9
|
+
let(:full_opts_in) {["--hosts", "host.cfg", "--options", "opts_file", "--helper", "path_to_helper", "--load-path", "load_path", "--tests", "test1.rb,test2.rb,test3.rb", "--pre-suite", "pre_suite.rb", "--post-suite", "post_suite.rb", "--no-provision", "--preserve-hosts", "always", "--root-keys", "--keyfile", "../.ssh/id_rsa", "--install", "gitrepopath", "-m", "module", "-q", "--dry-run", "--no-ntp", "--repo-proxy", "--add-el-extras", "--config", "anotherfile.cfg", "--fail-mode", "fast", "--no-color", "--version", "--log-level", "info", "--package-proxy", "http://192.168.100.1:3128", "--collect-perf-data", "--parse-only", "--validate", "--timeout", "40", "--log-prefix", "pants", "--configure", "--tag", "1,2,3", "--exclude-tag", "4,5,6"]}
|
10
|
+
let(:full_opts_out) {{:hosts_file=>"anotherfile.cfg",:options_file=>"opts_file", :helper => "path_to_helper", :load_path => "load_path", :tests => "test1.rb,test2.rb,test3.rb", :pre_suite => "pre_suite.rb", :post_suite => "post_suite.rb", :provision=>false, :preserve_hosts => "always", :root_keys=>true, :keyfile => "../.ssh/id_rsa", :install => "gitrepopath", :modules=>"module", :quiet=>true, :dry_run=>true, :timesync=>false, :repo_proxy=>true, :add_el_extras=>true, :fail_mode => "fast", :color=>false, :version=>true, :log_level => "info", :package_proxy => "http://192.168.100.1:3128", :collect_perf_data=>true, :parse_only=>true, :validate=>true, :timeout => "40", :log_prefix => "pants", :configure => true, :tag_includes => "1,2,3", :tag_excludes => "4,5,6"}}
|
11
11
|
let(:validate_true) {["--validate"]}
|
12
12
|
let(:validate_false) {["--no-validate"]}
|
13
13
|
let(:configure_true) {['--configure']}
|
@@ -137,7 +137,7 @@ module Beaker
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
|
-
describe 'parse_args' do
|
140
|
+
describe '#parse_args' do
|
141
141
|
before { FakeFS.deactivate! }
|
142
142
|
|
143
143
|
it 'pulls the args into key called :command_line' do
|
@@ -145,6 +145,72 @@ module Beaker
|
|
145
145
|
expect(parser.parse_args( my_args )[:command_line]).to include(my_args.join(' '))
|
146
146
|
end
|
147
147
|
|
148
|
+
describe 'does prioritization correctly' do
|
149
|
+
let(:env) { @env || {:level => 'highest'} }
|
150
|
+
let(:argv) { @argv || {:level => 'second'} }
|
151
|
+
let(:host_file) { @host_file || {:level => 'third'} }
|
152
|
+
let(:opt_file) { @opt_file || {:level => 'fourth' } }
|
153
|
+
let(:presets) { {:level => 'lowest' } }
|
154
|
+
|
155
|
+
before :each do
|
156
|
+
expect(parser).to receive( :normalize_args ).and_return( true )
|
157
|
+
end
|
158
|
+
|
159
|
+
def mock_out_parsing
|
160
|
+
presets_obj = double()
|
161
|
+
allow( presets_obj ).to receive( :presets ).and_return( presets )
|
162
|
+
allow( presets_obj ).to receive( :env_vars ).and_return( env )
|
163
|
+
parser.instance_variable_set( :@presets, presets_obj )
|
164
|
+
|
165
|
+
command_line_parser_obj = double()
|
166
|
+
allow( command_line_parser_obj ).to receive( :parse ).and_return( argv )
|
167
|
+
parser.instance_variable_set( :@command_line_parser, command_line_parser_obj )
|
168
|
+
|
169
|
+
allow( OptionsFileParser ).to receive( :parse_options_file ).and_return( opt_file )
|
170
|
+
allow( HostsFileParser ).to receive( :parse_hosts_file ).and_return( host_file )
|
171
|
+
end
|
172
|
+
|
173
|
+
it 'presets have the lowest priority' do
|
174
|
+
@env = @argv = @host_file = @opt_file = {}
|
175
|
+
mock_out_parsing
|
176
|
+
|
177
|
+
opts = parser.parse_args([])
|
178
|
+
expect( opts[:level] ).to be == 'lowest'
|
179
|
+
end
|
180
|
+
|
181
|
+
it 'options file has fourth priority' do
|
182
|
+
@env = @argv = @host_file = {}
|
183
|
+
mock_out_parsing
|
184
|
+
|
185
|
+
opts = parser.parse_args([])
|
186
|
+
expect( opts[:level] ).to be == 'fourth'
|
187
|
+
end
|
188
|
+
|
189
|
+
it 'host file CONFIG section has third priority' do
|
190
|
+
@env = @argv = {}
|
191
|
+
mock_out_parsing
|
192
|
+
|
193
|
+
opts = parser.parse_args([])
|
194
|
+
expect( opts[:level] ).to be == 'third'
|
195
|
+
end
|
196
|
+
|
197
|
+
it 'command line arguments have second priority' do
|
198
|
+
@env = {}
|
199
|
+
mock_out_parsing
|
200
|
+
|
201
|
+
opts = parser.parse_args([])
|
202
|
+
expect( opts[:level] ).to be == 'second'
|
203
|
+
end
|
204
|
+
|
205
|
+
it 'env vars have highest priority' do
|
206
|
+
mock_out_parsing
|
207
|
+
|
208
|
+
opts = parser.parse_args([])
|
209
|
+
expect( opts[:level] ).to be == 'highest'
|
210
|
+
end
|
211
|
+
|
212
|
+
end
|
213
|
+
|
148
214
|
it "can correctly combine arguments from different sources" do
|
149
215
|
build_url = 'http://my.build.url/'
|
150
216
|
type = 'git'
|
@@ -277,6 +343,65 @@ module Beaker
|
|
277
343
|
end
|
278
344
|
|
279
345
|
end
|
346
|
+
|
347
|
+
describe '#normalize_and_validate_tags' do
|
348
|
+
let ( :tag_includes ) { @tag_includes || [] }
|
349
|
+
let ( :tag_excludes ) { @tag_excludes || [] }
|
350
|
+
let ( :options ) {
|
351
|
+
opts = Beaker::Options::OptionsHash.new
|
352
|
+
opts[:tag_includes] = tag_includes
|
353
|
+
opts[:tag_excludes] = tag_excludes
|
354
|
+
opts
|
355
|
+
}
|
356
|
+
|
357
|
+
it 'does not error if no tags overlap' do
|
358
|
+
@tag_includes = 'can,tommies,potatoes,plant'
|
359
|
+
@tag_excludes = 'joey,long_running,pants'
|
360
|
+
parser.instance_variable_set(:@options, options)
|
361
|
+
|
362
|
+
expect( parser ).to_not receive( :parser_error )
|
363
|
+
parser.normalize_and_validate_tags()
|
364
|
+
end
|
365
|
+
|
366
|
+
it 'does error if tags overlap' do
|
367
|
+
@tag_includes = 'can,tommies,should_error,potatoes,plant'
|
368
|
+
@tag_excludes = 'joey,long_running,pants,should_error'
|
369
|
+
parser.instance_variable_set(:@options, options)
|
370
|
+
|
371
|
+
expect( parser ).to receive( :parser_error )
|
372
|
+
parser.normalize_and_validate_tags()
|
373
|
+
end
|
374
|
+
|
375
|
+
it 'splits the basic case correctly' do
|
376
|
+
@tag_includes = 'can,tommies,potatoes,plant'
|
377
|
+
@tag_excludes = 'joey,long_running,pants'
|
378
|
+
parser.instance_variable_set(:@options, options)
|
379
|
+
|
380
|
+
parser.normalize_and_validate_tags()
|
381
|
+
expect( options[:tag_includes] ).to be === ['can', 'tommies', 'potatoes', 'plant']
|
382
|
+
expect( options[:tag_excludes] ).to be === ['joey', 'long_running', 'pants']
|
383
|
+
end
|
384
|
+
|
385
|
+
it 'returns empty arrays for empty strings' do
|
386
|
+
@tag_includes = ''
|
387
|
+
@tag_excludes = ''
|
388
|
+
parser.instance_variable_set(:@options, options)
|
389
|
+
|
390
|
+
parser.normalize_and_validate_tags()
|
391
|
+
expect( options[:tag_includes] ).to be === []
|
392
|
+
expect( options[:tag_excludes] ).to be === []
|
393
|
+
end
|
394
|
+
|
395
|
+
it 'lowercases all tags correctly for later use' do
|
396
|
+
@tag_includes = 'jeRRy_And_tOM,PARka'
|
397
|
+
@tag_excludes = 'lEet_spEAK,pOland'
|
398
|
+
parser.instance_variable_set(:@options, options)
|
399
|
+
|
400
|
+
parser.normalize_and_validate_tags()
|
401
|
+
expect( options[:tag_includes] ).to be === ['jerry_and_tom', 'parka']
|
402
|
+
expect( options[:tag_excludes] ).to be === ['leet_speak', 'poland']
|
403
|
+
end
|
404
|
+
end
|
280
405
|
end
|
281
406
|
end
|
282
407
|
end
|
@@ -6,6 +6,18 @@ module Beaker
|
|
6
6
|
|
7
7
|
describe 'version_is_less' do
|
8
8
|
|
9
|
+
it 'reports 2015.3.0-rc0-8-gf80879a is less than 2016' do
|
10
|
+
expect( subject.version_is_less( '2015.3.0-rc0-8-gf80879a', '2016' ) ).to be === true
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'reports 2015.3.0-rc0-8-gf80879a is not less than 2015.3.0' do
|
14
|
+
expect( subject.version_is_less( '2015.3.0-rc0-8-gf80879a', '2015.3.0' ) ).to be === false
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'reports 2015.3.0-rc0-8-gf80879a is not less than 3.0.0' do
|
18
|
+
expect( subject.version_is_less( '2015.3.0-rc0-8-gf80879a', '3.0.0' ) ).to be === false
|
19
|
+
end
|
20
|
+
|
9
21
|
it 'reports 3.0.0-160-gac44cfb is not less than 3.0.0' do
|
10
22
|
expect( subject.version_is_less( '3.0.0-160-gac44cfb', '3.0.0' ) ).to be === false
|
11
23
|
end
|
@@ -30,6 +42,37 @@ module Beaker
|
|
30
42
|
expect( subject.version_is_less( '2.8', '2.9' ) ).to be === true
|
31
43
|
end
|
32
44
|
end
|
45
|
+
|
46
|
+
describe 'max_version' do
|
47
|
+
|
48
|
+
it 'returns nil if versions isn\'t defined' do
|
49
|
+
expect( subject.max_version(nil) ).to be_nil
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'returns nil if versions is empty' do
|
53
|
+
expect( subject.max_version([]) ).to be_nil
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'allows you to set the default, & will return it with faulty input' do
|
57
|
+
expect( subject.max_version([], '5.9') ).to be === '5.9'
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'returns the one value if given a length 1 array' do
|
61
|
+
expect( subject.max_version(['7.3']) ).to be === '7.3'
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'does not mangle the versions array passed in' do
|
65
|
+
first_array = ['1.4.3', '8.4.5', '3.5.7', '2.7.5']
|
66
|
+
array_to_pass = first_array.dup
|
67
|
+
subject.max_version(array_to_pass)
|
68
|
+
expect( array_to_pass ).to be === first_array
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'returns 5.8.9 from [5.8.9, 1.2.3, 0.3.5, 5.7.11]' do
|
72
|
+
expect( subject.max_version(['5.8.9', '1.2.3', '0.3.5', '5.7.11']) ).to be === '5.8.9'
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
33
76
|
end
|
34
77
|
|
35
78
|
end
|
@@ -24,6 +24,27 @@ module Beaker
|
|
24
24
|
expect(tfs).to include rb_test
|
25
25
|
end
|
26
26
|
|
27
|
+
it 'defaults to :slow fail_mode if not provided through parameter or options' do
|
28
|
+
@files = [ rb_test ]
|
29
|
+
ts = Beaker::TestSuite.new('name', 'hosts', options, Time.now)
|
30
|
+
tfm = ts.instance_variable_get(:@fail_mode)
|
31
|
+
expect(tfm).to be == :slow
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'uses provided parameter fail_mode' do
|
35
|
+
@files = [ rb_test ]
|
36
|
+
ts = Beaker::TestSuite.new('name', 'hosts', options, Time.now, :fast)
|
37
|
+
tfm = ts.instance_variable_get(:@fail_mode)
|
38
|
+
expect(tfm).to be == :fast
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'uses options fail_mode if fail_mode parameter is not provided' do
|
42
|
+
@files = [ rb_test ]
|
43
|
+
options[:fail_mode] = :fast
|
44
|
+
ts = Beaker::TestSuite.new('name', 'hosts', options, Time.now)
|
45
|
+
tfm = ts.instance_variable_get(:@fail_mode)
|
46
|
+
expect(tfm).to be == :fast
|
47
|
+
end
|
27
48
|
end
|
28
49
|
|
29
50
|
context 'run' do
|
data/spec/helpers.rb
CHANGED
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: 2.
|
4
|
+
version: 2.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppetlabs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -234,6 +234,20 @@ dependencies:
|
|
234
234
|
- - ~>
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: 1.0.9
|
237
|
+
- !ruby/object:Gem::Dependency
|
238
|
+
name: open_uri_redirections
|
239
|
+
requirement: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - ~>
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: 0.2.1
|
244
|
+
type: :runtime
|
245
|
+
prerelease: false
|
246
|
+
version_requirements: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - ~>
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: 0.2.1
|
237
251
|
- !ruby/object:Gem::Dependency
|
238
252
|
name: rbvmomi
|
239
253
|
requirement: !ruby/object:Gem::Requirement
|
@@ -518,6 +532,7 @@ files:
|
|
518
532
|
- spec/beaker/dsl/install_utils/module_utils_spec.rb
|
519
533
|
- spec/beaker/dsl/install_utils/pe_defaults_spec.rb
|
520
534
|
- spec/beaker/dsl/install_utils/pe_utils_spec.rb
|
535
|
+
- spec/beaker/dsl/install_utils/puppet_utils_spec.rb
|
521
536
|
- spec/beaker/dsl/outcomes_spec.rb
|
522
537
|
- spec/beaker/dsl/roles_spec.rb
|
523
538
|
- spec/beaker/dsl/structure_spec.rb
|
@@ -525,7 +540,9 @@ files:
|
|
525
540
|
- spec/beaker/host/freebsd/exec_spec.rb
|
526
541
|
- spec/beaker/host/mac/group_spec.rb
|
527
542
|
- spec/beaker/host/mac/user_spec.rb
|
543
|
+
- spec/beaker/host/unix/exec_spec.rb
|
528
544
|
- spec/beaker/host/unix/pkg_spec.rb
|
545
|
+
- spec/beaker/host/windows/exec_spec.rb
|
529
546
|
- spec/beaker/host/windows/group_spec.rb
|
530
547
|
- spec/beaker/host_prebuilt_steps_spec.rb
|
531
548
|
- spec/beaker/host_spec.rb
|