beaker 1.4.1 → 1.5.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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YWMwOGVmNTJlZTJiMTIzMjc1YmQxOWEyNzhlNmIwMmY1YmQ3ZDBjNQ==
4
+ ODViOGJiN2ZhMDlmNjQ4NmQxNTNkMjZiNjhlYTc5MjI0NzIyNmEzMA==
5
5
  data.tar.gz: !binary |-
6
- YWI3MmJkNzI2NWZhZDlkMDdlY2E4OGZlYTE3MTY2NDY2Yzk4YzZjNQ==
6
+ N2U1MDk2NWUwZjNmNGE2Zjc0MDQ2Y2ZhMzk3M2ZjYTJkMWNhMmJhYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MDk0YmJiMTE2YzQ4NjYwZDNmNDAwM2Q4MTNlYjc3YzM5ZDY1MDA0YzBlN2Mx
10
- Mjc4ZTQzNGVjYTkxOGI5MDkxNTAzOTAxMDk0MWE3YTM2YWQyYTE1Y2Q0NTFl
11
- ZDNlMmQ3MmMwOTQ4ZjcxZDcxOTJlOTAwZjM2MTc5MWY3NjNkZjU=
9
+ Yjg1OTYzNGNmZTBiOTU2YWMwZjA5NjUyOTc5M2JhZjY2NTMwOTQxNzk2NTNk
10
+ OWYzNGU4NzgxNjA0NGIxYmMyNWQzNzYxM2Q4Y2U1MWY4MTE3MDg5M2I1Y2Ey
11
+ NGUwYWI5OTIyZGRlNTU4MjYzYmMwMTkxZTUxMTkwYWFmMDk5NDE=
12
12
  data.tar.gz: !binary |-
13
- MTkyYzUzMGYyNTRkYjRmZWQ3OGY0YzRiMzFhMDMyM2QzMDdiNDAyOTJiYzRi
14
- NWY5YTY2YTM1NTYxMTU4NTZmOGQ1ZGE2M2IwOGYxOWY0OWQwNTg3NDY4OGVh
15
- NDcyYzEzMTAxMjk4NjliNDZiNmE2OThmYWViM2MxZjM1NTM2MGY=
13
+ ZWZjY2FlNzE2MzNmZDE4MDJlMjFiMzEyMjNlOWFiZDZmNDExMjU5Y2U1YWQw
14
+ MDUyODBlMzIwM2VmNDNhMmVjOWZjOWRlMGQxODYzZTFmNzQ2OWVhOWI4MDU0
15
+ Njk1YWEzMDk3M2JlMDlhZjZmMDkxNDNiNjAwZWE5ZWUxODQyZGM=
@@ -67,7 +67,7 @@ module Beaker
67
67
  [:add_master_entry, "Update /etc/hosts on master with master's ip", Proc.new {@setup.add_master_entry}]]
68
68
  begin
69
69
  #setup phase
70
- setup_steps.each do |step|
70
+ setup_steps.each do |step|
71
71
  if (not @options.has_key?(step[0])) or @options[step[0]]
72
72
  @logger.notify ""
73
73
  @logger.notify "Setup: #{step[1]}"
@@ -91,8 +91,10 @@ module Beaker
91
91
  validate
92
92
  setup
93
93
 
94
+ errored = false
95
+
94
96
  #pre acceptance phase
95
- run_suite(:pre_suite, :fail_fast)
97
+ run_suite(:pre_suite, :fast)
96
98
 
97
99
  #testing phase
98
100
  begin
@@ -100,8 +102,10 @@ module Beaker
100
102
  #post acceptance phase
101
103
  rescue => e
102
104
  #post acceptance on failure
103
- #if we error then run the post suite as long as we aren't in fail-stop mode
104
- run_suite(:post_suite) unless @options[:fail_mode] == "stop"
105
+ #run post-suite if we are in fail-slow mode
106
+ if @options[:fail_mode] =~ /slow/
107
+ run_suite(:post_suite)
108
+ end
105
109
  raise e
106
110
  else
107
111
  #post acceptance on success
@@ -110,9 +114,8 @@ module Beaker
110
114
  #cleanup phase
111
115
  rescue => e
112
116
  #cleanup on error
113
- #only do cleanup if we aren't in fail-stop mode
114
- @logger.notify "Cleanup: cleaning up after failed run"
115
- if @options[:fail_mode] != "stop"
117
+ if @options[:preserve_hosts] =~ /(never)/
118
+ @logger.notify "Cleanup: cleaning up after failed run"
116
119
  if @network_manager
117
120
  @network_manager.cleanup
118
121
  end
@@ -120,9 +123,11 @@ module Beaker
120
123
  raise "Failed to execute tests!"
121
124
  else
122
125
  #cleanup on success
123
- @logger.notify "Cleanup: cleaning up after successful run"
124
- if @network_manager
125
- @network_manager.cleanup
126
+ if @options[:preserve_hosts] =~ /(never)|(onfail)/
127
+ @logger.notify "Cleanup: cleaning up after successful run"
128
+ if @network_manager
129
+ @network_manager.cleanup
130
+ end
126
131
  end
127
132
  end
128
133
  end
@@ -238,6 +238,17 @@ module Beaker
238
238
  end
239
239
  end
240
240
 
241
+ #Classify the master so that it can deploy frictionless packages for a given host.
242
+ # @param [Host] host The host to install pacakges for
243
+ # @api private
244
+ def deploy_frictionless_to_master(host)
245
+ klass = host['platform'].gsub(/-/, '_').gsub(/\./,'')
246
+ klass = "pe_repo::platform::#{klass}"
247
+ on dashboard, "cd /opt/puppet/share/puppet-dashboard && /opt/puppet/bin/bundle exec rake nodeclass:add[#{klass},skip]"
248
+ on dashboard, "cd /opt/puppet/share/puppet-dashboard && /opt/puppet/bin/bundle exec rake node:addclass[#{master},#{klass}]"
249
+ on master, "puppet agent -t", :acceptable_exit_codes => [0,2]
250
+ end
251
+
241
252
  #Perform a Puppet Enterprise upgrade or install
242
253
  # @param [Array<Host>] hosts The hosts to install or upgrade PE on
243
254
  # @param [Hash{Symbol=>Symbol, String}] options The options
@@ -289,6 +300,10 @@ module Beaker
289
300
  if (! host['roles'].include? 'frictionless') || version_is_less(version, '3.2.0')
290
301
  answers = Beaker::Answers.answers(options[:pe_ver] || host['pe_ver'], hosts, master_certname, options)
291
302
  create_remote_file host, "#{host['working_dir']}/answers", Beaker::Answers.answer_string(host, answers)
303
+ else
304
+ # If We're *not* running the classic installer, we want
305
+ # to make sure the master has packages for us.
306
+ deploy_frictionless_to_master(host)
292
307
  end
293
308
 
294
309
  on host, installer_cmd(host, options)
@@ -29,7 +29,10 @@ module Beaker
29
29
  hosts_as 'agent'
30
30
  end
31
31
 
32
- # The host for which ['roles'] include 'master'
32
+ # The host for which ['roles'] include 'master'.
33
+ # If no host has the 'master' role, then use the host defined as 'default'.
34
+ # If no host is defined as a 'master' and there is no 'default' host defined then
35
+ # raise an error.
33
36
  #
34
37
  # @return [Array<Host>]
35
38
  # @raise [Beaker::DSL::Outcomes::FailTest] if there are less
@@ -39,7 +42,11 @@ module Beaker
39
42
  # on, master, 'cat /etc/puppet/puppet.conf'
40
43
  #
41
44
  def master
42
- find_only_one :master
45
+ begin
46
+ find_only_one :master
47
+ rescue DSL::Outcomes::FailTest => e
48
+ default
49
+ end
43
50
  end
44
51
 
45
52
  # The host for which ['roles'] include 'database'
@@ -64,16 +64,13 @@ module Beaker
64
64
  end
65
65
 
66
66
  def cleanup
67
- #only cleanup if we aren't preserving hosts
68
67
  #shut down connections
69
68
  @hosts.each {|host| host.close }
70
69
 
71
- if not @options[:preserve_hosts]
72
- if @provisioned_set
73
- @provisioned_set.each_key do |type|
74
- if @provisioned_set[type]
75
- @provisioned_set[type].cleanup
76
- end
70
+ if @provisioned_set
71
+ @provisioned_set.each_key do |type|
72
+ if @provisioned_set[type]
73
+ @provisioned_set[type].cleanup
77
74
  end
78
75
  end
79
76
  end
@@ -66,9 +66,14 @@ module Beaker
66
66
  @cmd_options[:provision] = bool
67
67
  end
68
68
 
69
- opts.on '--[no-]preserve-hosts',
70
- 'Preserve cloud instances' do |value|
71
- @cmd_options[:preserve_hosts] = value
69
+ opts.on '--preserve-hosts [MODE]',
70
+ 'How should SUTs be treated post test',
71
+ 'Possible values:',
72
+ 'always (keep SUTs alive)',
73
+ 'onfail (keep SUTs alive if failures occur during testing)',
74
+ 'never (cleanup SUTs - shutdown and destroy any changes made during testing)',
75
+ '(default: never)' do |mode|
76
+ @cmd_options[:preserve_hosts] = mode || 'always'
72
77
  end
73
78
 
74
79
  opts.on '--root-keys',
@@ -145,9 +150,11 @@ module Beaker
145
150
  opts.on '--fail-mode [MODE]',
146
151
  'How should the harness react to errors/failures',
147
152
  'Possible values:',
148
- 'fast (skip all subsequent tests, cleanup, exit)',
149
- 'stop (skip all subsequent tests, do no cleanup, exit immediately)' do |mode|
150
- @cmd_options[:fail_mode] = mode
153
+ 'fast (skip all subsequent tests)',
154
+ 'slow (attempt to continue run post test failure)',
155
+ 'stop (DEPRECATED, please use fast)',
156
+ '(default: slow)' do |mode|
157
+ @cmd_options[:fail_mode] = mode =~ /stop/ ? 'fast' : mode
151
158
  end
152
159
 
153
160
  opts.on '--[no-]ntp',
@@ -25,6 +25,7 @@ module Beaker
25
25
  end
26
26
 
27
27
  # Make sure the roles array is present for all hosts
28
+ host_options['HOSTS'] ||= {}
28
29
  host_options['HOSTS'].each_key do |host|
29
30
  host_options['HOSTS'][host]['roles'] ||= []
30
31
  end
@@ -239,8 +239,13 @@ module Beaker
239
239
  end
240
240
 
241
241
  #check for valid fail mode
242
- if not ["fast", "stop", nil].include?(@options[:fail_mode])
243
- parser_error "--fail-mode must be one of fast, stop"
242
+ if @options[:fail_mode] !~ /stop|fast|slow/
243
+ parser_error "--fail-mode must be one of fast or slow, not '#{@options[:fail_mode]}'"
244
+ end
245
+
246
+ #check for valid preserve_hosts option
247
+ if @options[:preserve_hosts] !~ /always|onfail|never/
248
+ parser_error "--preserve_hosts must be one of always, onfail or never, not '#{@options[:preserve_hosts]}'"
244
249
  end
245
250
 
246
251
  #check for config files necessary for different hypervisors
@@ -273,8 +278,8 @@ module Beaker
273
278
  parser_error "Only agent nodes may have the role 'frictionless', fix #{@options[:hosts_file]}"
274
279
  end
275
280
  end
276
- if master > 1 or master < 1
277
- parser_error "One and only one host/node may have the role 'master', fix #{@options[:hosts_file]}"
281
+ if master > 1
282
+ parser_error "Only one host/node may have the role 'master', fix #{@options[:hosts_file]}"
278
283
  end
279
284
 
280
285
  #check that solaris/windows/el-4 boxes are only agents
@@ -34,14 +34,14 @@ module Beaker
34
34
  :options_file => nil,
35
35
  :type => 'pe',
36
36
  :provision => true,
37
- :preserve_hosts => false,
37
+ :preserve_hosts => 'never',
38
38
  :root_keys => false,
39
39
  :quiet => false,
40
40
  :xml => false,
41
41
  :color => true,
42
42
  :dry_run => false,
43
43
  :timeout => 300,
44
- :fail_mode => nil,
44
+ :fail_mode => 'slow',
45
45
  :timesync => false,
46
46
  :repo_proxy => false,
47
47
  :add_el_extras => false,
@@ -57,10 +57,10 @@ module Beaker
57
57
  @logger.debug msg
58
58
  when :fail
59
59
  @logger.error msg
60
- break if fail_mode #all failure modes cause us to kick out early on failure
60
+ break if fail_mode !~ /slow/ #all failure modes except slow cause us to kick out early on failure
61
61
  when :error
62
62
  @logger.warn msg
63
- break if fail_mode #all failure modes cause use to kick out early on error
63
+ break if fail_mode !~ /slow/ #all failure modes except slow cause us to kick out early on failure
64
64
  end
65
65
  end
66
66
 
@@ -1,5 +1,5 @@
1
1
  module Beaker
2
2
  module Version
3
- STRING = '1.4.1'
3
+ STRING = '1.5.0'
4
4
  end
5
5
  end
@@ -0,0 +1,156 @@
1
+ require 'spec_helper'
2
+
3
+ module Beaker
4
+ describe CLI, :use_fakefs => true do
5
+ let(:cli) { Beaker::CLI.new }
6
+
7
+ context 'execute!' do
8
+ before :each do
9
+ stub_const("Beaker::Logger", double().as_null_object )
10
+ File.open("sample.cfg", "w+") do |file|
11
+ file.write("HOSTS:\n")
12
+ file.write(" myhost:\n")
13
+ file.write(" roles:\n")
14
+ file.write(" - master\n")
15
+ file.write(" platform: ubuntu-x-x\n")
16
+ file.write("CONFIG:\n")
17
+ end
18
+ cli.stub(:setup).and_return(true)
19
+ cli.stub(:validate).and_return(true)
20
+ cli.stub(:provision).and_return(true)
21
+ end
22
+
23
+ describe "test fail mode" do
24
+ it 'continues testing after failed test if using slow fail_mode' do
25
+ cli.stub(:run_suite).with(:pre_suite, :fast).and_return(true)
26
+ cli.stub(:run_suite).with(:tests).and_throw("bad test")
27
+ cli.stub(:run_suite).with(:post_suite).and_return(true)
28
+ options = cli.instance_variable_get(:@options)
29
+ options[:fail_mode] = 'slow'
30
+ cli.instance_variable_set(:@options, options)
31
+
32
+ cli.should_receive(:run_suite).exactly( 3 ).times
33
+ expect{ cli.execute! }.to raise_error
34
+
35
+ end
36
+
37
+ it 'stops testing after failed test if using fast fail_mode' do
38
+ cli.stub(:run_suite).with(:pre_suite, :fast).and_return(true)
39
+ cli.stub(:run_suite).with(:tests).and_throw("bad test")
40
+ cli.stub(:run_suite).with(:post_suite).and_return(true)
41
+ options = cli.instance_variable_get(:@options)
42
+ options[:fail_mode] = 'fast'
43
+ cli.instance_variable_set(:@options, options)
44
+
45
+ cli.should_receive(:run_suite).twice
46
+ expect{ cli.execute! }.to raise_error
47
+
48
+ end
49
+ end
50
+
51
+ describe "SUT preserve mode" do
52
+ it 'cleans up SUTs post testing if tests fail and preserve_hosts = never' do
53
+ cli.stub(:run_suite).with(:pre_suite, :fast).and_return(true)
54
+ cli.stub(:run_suite).with(:tests).and_throw("bad test")
55
+ cli.stub(:run_suite).with(:post_suite).and_return(true)
56
+ options = cli.instance_variable_get(:@options)
57
+ options[:fail_mode] = 'fast'
58
+ options[:preserve_hosts] = 'never'
59
+ cli.instance_variable_set(:@options, options)
60
+
61
+ netmanager = double(:netmanager)
62
+ cli.instance_variable_set(:@network_manager, netmanager)
63
+ netmanager.should_receive(:cleanup).once
64
+
65
+ expect{ cli.execute! }.to raise_error
66
+
67
+ end
68
+
69
+ it 'cleans up SUTs post testing if no tests fail and preserve_hosts = never' do
70
+ cli.stub(:run_suite).with(:pre_suite, :fast).and_return(true)
71
+ cli.stub(:run_suite).with(:tests).and_return(true)
72
+ cli.stub(:run_suite).with(:post_suite).and_return(true)
73
+ options = cli.instance_variable_get(:@options)
74
+ options[:fail_mode] = 'fast'
75
+ options[:preserve_hosts] = 'never'
76
+ cli.instance_variable_set(:@options, options)
77
+
78
+ netmanager = double(:netmanager)
79
+ cli.instance_variable_set(:@network_manager, netmanager)
80
+ netmanager.should_receive(:cleanup).once
81
+
82
+ expect{ cli.execute! }.to_not raise_error
83
+
84
+ end
85
+
86
+
87
+ it 'preserves SUTs post testing if no tests fail and preserve_hosts = always' do
88
+ cli.stub(:run_suite).with(:pre_suite, :fast).and_return(true)
89
+ cli.stub(:run_suite).with(:tests).and_return(true)
90
+ cli.stub(:run_suite).with(:post_suite).and_return(true)
91
+ options = cli.instance_variable_get(:@options)
92
+ options[:fail_mode] = 'fast'
93
+ options[:preserve_hosts] = 'always'
94
+ cli.instance_variable_set(:@options, options)
95
+
96
+ netmanager = double(:netmanager)
97
+ cli.instance_variable_set(:@network_manager, netmanager)
98
+ netmanager.should_receive(:cleanup).never
99
+
100
+ expect{ cli.execute! }.to_not raise_error
101
+
102
+ end
103
+
104
+ it 'preserves SUTs post testing if no tests fail and preserve_hosts = always' do
105
+ cli.stub(:run_suite).with(:pre_suite, :fast).and_return(true)
106
+ cli.stub(:run_suite).with(:tests).and_throw("bad test")
107
+ cli.stub(:run_suite).with(:post_suite).and_return(true)
108
+ options = cli.instance_variable_get(:@options)
109
+ options[:fail_mode] = 'fast'
110
+ options[:preserve_hosts] = 'always'
111
+ cli.instance_variable_set(:@options, options)
112
+
113
+ netmanager = double(:netmanager)
114
+ cli.instance_variable_set(:@network_manager, netmanager)
115
+ netmanager.should_receive(:cleanup).never
116
+
117
+ expect{ cli.execute! }.to raise_error
118
+ end
119
+
120
+ it 'cleans up SUTs post testing if no tests fail and preserve_hosts = onfail' do
121
+ cli.stub(:run_suite).with(:pre_suite, :fast).and_return(true)
122
+ cli.stub(:run_suite).with(:tests).and_return(true)
123
+ cli.stub(:run_suite).with(:post_suite).and_return(true)
124
+ options = cli.instance_variable_get(:@options)
125
+ options[:fail_mode] = 'fast'
126
+ options[:preserve_hosts] = 'onfail'
127
+ cli.instance_variable_set(:@options, options)
128
+
129
+ netmanager = double(:netmanager)
130
+ cli.instance_variable_set(:@network_manager, netmanager)
131
+ netmanager.should_receive(:cleanup).once
132
+
133
+ expect{ cli.execute! }.to_not raise_error
134
+
135
+ end
136
+
137
+ it 'preserves SUTs post testing if tests fail and preserve_hosts = onfail' do
138
+ cli.stub(:run_suite).with(:pre_suite, :fast).and_return(true)
139
+ cli.stub(:run_suite).with(:tests).and_throw("bad test")
140
+ cli.stub(:run_suite).with(:post_suite).and_return(true)
141
+ options = cli.instance_variable_get(:@options)
142
+ options[:fail_mode] = 'fast'
143
+ options[:preserve_hosts] = 'onfail'
144
+ cli.instance_variable_set(:@options, options)
145
+
146
+ netmanager = double(:netmanager)
147
+ cli.instance_variable_set(:@network_manager, netmanager)
148
+ netmanager.should_receive(:cleanup).never
149
+
150
+ expect{ cli.execute! }.to raise_error
151
+
152
+ end
153
+ end
154
+ end
155
+ end
156
+ end
@@ -39,14 +39,19 @@ describe ClassMixedWithDSLRoles do
39
39
  end
40
40
  it 'raises an error if there is more than one master' do
41
41
  @hosts = [ master, monolith ]
42
- subject.should_receive( :hosts ).and_return( hosts )
42
+ subject.should_receive( :hosts ).exactly( 5 ).times.and_return( hosts )
43
43
  expect { subject.master }.to raise_error Beaker::DSL::FailTest
44
44
  end
45
- it 'and raises an error if there is no master' do
45
+ it 'and raises an error if there is no master and no default' do
46
46
  @hosts = [ agent1, agent2, custom ]
47
- subject.should_receive( :hosts ).and_return( hosts )
47
+ subject.should_receive( :hosts ).exactly( 4 ).times.and_return( hosts )
48
48
  expect { subject.master }.to raise_error Beaker::DSL::FailTest
49
49
  end
50
+ it 'returns the default when there is no master' do
51
+ @hosts = [ agent1 ]
52
+ subject.should_receive( :hosts ).exactly( 3 ).times.and_return( hosts )
53
+ expect( subject.master ).to be == agent1
54
+ end
50
55
  end
51
56
  describe '#dashboard' do
52
57
  it 'returns the dashboard if there is one' do
@@ -6,14 +6,14 @@ 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) {["--hosts", "host.cfg", "--options", "opts_file", "--type", "pe", "--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", "--root-keys", "--keyfile", "../.ssh/id_rsa", "--install", "gitrepopath", "-m", "module", "-q", "--no-xml", "--dry-run", "--no-ntp", "--repo-proxy", "--add-el-extras", "--config", "anotherfile.cfg", "--fail-mode", "fast", "--no-color", "--version", "--log-level", "info"]}
9
+ let(:full_opts) {["--hosts", "host.cfg", "--options", "opts_file", "--type", "pe", "--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", "--no-xml", "--dry-run", "--no-ntp", "--repo-proxy", "--add-el-extras", "--config", "anotherfile.cfg", "--fail-mode", "fast", "--no-color", "--version", "--log-level", "info"]}
10
10
 
11
11
  it "can correctly read command line input" do
12
12
  expect(parser.parse!(test_opts)).to be === {:hosts_file=>"vcloud.cfg", :log_level=>"debug", :tests=>"test.rb", :help=>true}
13
13
  end
14
14
 
15
15
  it "supports all our command line options" do
16
- expect(parser.parse!(full_opts)).to be === {:hosts_file=>"anotherfile.cfg", :options_file=>"opts_file", :type=>"pe", :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=>true, :root_keys=>true, :keyfile=>"../.ssh/id_rsa", :install=>"gitrepopath", :modules=>"module", :quiet=>true, :xml=>false, :dry_run=>true, :timesync=>false, :repo_proxy=>true, :add_el_extras=>true, :fail_mode=>"fast", :color=>false, :version=>true, :log_level=>"info"}
16
+ expect(parser.parse!(full_opts)).to be === {:hosts_file=>"anotherfile.cfg", :options_file=>"opts_file", :type=>"pe", :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, :xml=>false, :dry_run=>true, :timesync=>false, :repo_proxy=>true, :add_el_extras=>true, :fail_mode=>"fast", :color=>false, :version=>true, :log_level=>"info"}
17
17
  end
18
18
 
19
19
  it "can produce a usage description" do
@@ -154,12 +154,12 @@ module Beaker
154
154
  it "can correctly combine arguments from different sources" do
155
155
  FakeFS.deactivate!
156
156
  args = ["-h", hosts_path, "--log-level", "debug", "--type", "git", "--install", "PUPPET/1.0,HIERA/hello"]
157
- expect(parser.parse_args(args)).to be === {:log_level=>"debug", :hosts_file=>hosts_path, :options_file=>nil, :type=>"git", :provision=>true, :preserve_hosts=>false, :root_keys=>false, :quiet=>false, :xml=>false, :color=>true, :dry_run=>false, :timeout=>300, :fail_mode=>nil, :timesync=>false, :repo_proxy=>false, :add_el_extras=>false, :consoleport=>443, :pe_dir=>"/opt/enterprise/dists", :pe_version_file=>"LATEST", :pe_version_file_win=>"LATEST-win", :dot_fog=>"#{home}/.fog", :help=>false, :ec2_yaml=>"config/image_templates/ec2.yaml", :ssh=>{:config=>false, :paranoid=>false, :timeout=>300, :auth_methods=>["publickey"], :port=>22, :forward_agent=>true, :keys=>["#{home}/.ssh/id_rsa"], :user_known_hosts_file=>"#{home}/.ssh/known_hosts"}, :install=>["git://github.com/puppetlabs/puppet.git#1.0", "git://github.com/puppetlabs/hiera.git#hello"], :HOSTS=>{:"pe-ubuntu-lucid"=>{:roles=>["agent", "dashboard", "database", "master"], :vmname=>"pe-ubuntu-lucid", :platform=>"ubuntu-10.04-i386", :snapshot=>"clean-w-keys", :hypervisor=>"fusion"}, :"pe-centos6"=>{:roles=>["agent"], :vmname=>"pe-centos6", :platform=>"el-6-i386", :hypervisor=>"fusion", :snapshot=>"clean-w-keys"}}, :nfs_server=>"none", :helper=>[], :load_path=>[], :tests=>[], :pre_suite=>[], :post_suite=>[], :modules=>[]}
157
+ expect(parser.parse_args(args)).to be === {:log_level=>"debug", :hosts_file=>hosts_path, :options_file=>nil, :type=>"git", :provision=>true, :preserve_hosts=>'never', :root_keys=>false, :quiet=>false, :xml=>false, :color=>true, :dry_run=>false, :timeout=>300, :fail_mode=>'slow', :timesync=>false, :repo_proxy=>false, :add_el_extras=>false, :consoleport=>443, :pe_dir=>"/opt/enterprise/dists", :pe_version_file=>"LATEST", :pe_version_file_win=>"LATEST-win", :dot_fog=>"#{home}/.fog", :help=>false, :ec2_yaml=>"config/image_templates/ec2.yaml", :ssh=>{:config=>false, :paranoid=>false, :timeout=>300, :auth_methods=>["publickey"], :port=>22, :forward_agent=>true, :keys=>["#{home}/.ssh/id_rsa"], :user_known_hosts_file=>"#{home}/.ssh/known_hosts"}, :install=>["git://github.com/puppetlabs/puppet.git#1.0", "git://github.com/puppetlabs/hiera.git#hello"], :HOSTS=>{:"pe-ubuntu-lucid"=>{:roles=>["agent", "dashboard", "database", "master"], :vmname=>"pe-ubuntu-lucid", :platform=>"ubuntu-10.04-i386", :snapshot=>"clean-w-keys", :hypervisor=>"fusion"}, :"pe-centos6"=>{:roles=>["agent"], :vmname=>"pe-centos6", :platform=>"el-6-i386", :hypervisor=>"fusion", :snapshot=>"clean-w-keys"}}, :nfs_server=>"none", :helper=>[], :load_path=>[], :tests=>[], :pre_suite=>[], :post_suite=>[], :modules=>[]}
158
158
  end
159
159
 
160
- it "ensures that file-mode is one of fast/stop" do
160
+ it "ensures that fail-mode is one of fast/slow" do
161
161
  FakeFS.deactivate!
162
- args = ["-h", hosts_path, "--log-level", "debug", "--fail-mode", "slow"]
162
+ args = ["-h", hosts_path, "--log-level", "debug", "--fail-mode", "nope"]
163
163
  expect{parser.parse_args(args)}.to raise_error(ArgumentError)
164
164
  end
165
165
 
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: 1.4.1
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-27 00:00:00.000000000 Z
11
+ date: 2014-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -337,6 +337,7 @@ files:
337
337
  - lib/beaker/utils/validator.rb
338
338
  - lib/beaker/version.rb
339
339
  - spec/beaker/answers_spec.rb
340
+ - spec/beaker/cli_spec.rb
340
341
  - spec/beaker/command_spec.rb
341
342
  - spec/beaker/dsl/assertions_spec.rb
342
343
  - spec/beaker/dsl/helpers_spec.rb
@@ -414,6 +415,7 @@ specification_version: 4
414
415
  summary: Let's test Puppet!
415
416
  test_files:
416
417
  - spec/beaker/answers_spec.rb
418
+ - spec/beaker/cli_spec.rb
417
419
  - spec/beaker/command_spec.rb
418
420
  - spec/beaker/dsl/assertions_spec.rb
419
421
  - spec/beaker/dsl/helpers_spec.rb