beaker 2.10.0 → 2.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/HISTORY.md +292 -4
- data/acceptance/tests/base/host.rb +1 -0
- data/lib/beaker/answers/version30.rb +10 -10
- data/lib/beaker/cli.rb +10 -8
- data/lib/beaker/command.rb +1 -1
- data/lib/beaker/dsl/helpers/facter_helpers.rb +10 -1
- data/lib/beaker/dsl/helpers/hiera_helpers.rb +0 -11
- data/lib/beaker/dsl/helpers/host_helpers.rb +12 -3
- data/lib/beaker/dsl/helpers/puppet_helpers.rb +11 -3
- data/lib/beaker/dsl/helpers/tk_helpers.rb +0 -12
- data/lib/beaker/dsl/helpers/web_helpers.rb +0 -12
- data/lib/beaker/dsl/install_utils/module_utils.rb +9 -6
- data/lib/beaker/dsl/install_utils/pe_utils.rb +60 -8
- data/lib/beaker/dsl/install_utils/puppet_utils.rb +15 -2
- data/lib/beaker/host.rb +11 -145
- data/lib/beaker/host/mac.rb +3 -7
- data/lib/beaker/host/mac/pkg.rb +43 -0
- data/lib/beaker/host/pswindows.rb +1 -1
- data/lib/beaker/host/pswindows/exec.rb +83 -2
- data/lib/beaker/host/pswindows/pkg.rb +9 -6
- data/lib/beaker/host/unix/exec.rb +105 -0
- data/lib/beaker/host/unix/pkg.rb +22 -9
- data/lib/beaker/host/windows.rb +2 -1
- data/lib/beaker/host/windows/exec.rb +1 -1
- data/lib/beaker/host/windows/pkg.rb +4 -7
- data/lib/beaker/host_prebuilt_steps.rb +14 -14
- data/lib/beaker/hypervisor/aws_sdk.rb +198 -114
- data/lib/beaker/hypervisor/openstack.rb +48 -25
- data/lib/beaker/shared/host_manager.rb +11 -2
- data/lib/beaker/ssh_connection.rb +26 -0
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/answers_spec.rb +56 -0
- data/spec/beaker/cli_spec.rb +16 -12
- data/spec/beaker/command_spec.rb +3 -0
- data/spec/beaker/dsl/install_utils/module_utils_spec.rb +2 -2
- data/spec/beaker/dsl/install_utils/pe_utils_spec.rb +71 -3
- data/spec/beaker/dsl/install_utils/puppet_utils_spec.rb +4 -1
- data/spec/beaker/host/unix/pkg_spec.rb +10 -10
- data/spec/beaker/host_prebuilt_steps_spec.rb +3 -1
- data/spec/beaker/host_spec.rb +8 -2
- data/spec/beaker/hypervisor/vagrant_spec.rb +1 -0
- metadata +3 -2
@@ -88,8 +88,17 @@ module Beaker
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
if block_hosts.is_a? Array
|
91
|
-
|
92
|
-
|
91
|
+
if block_hosts.length > 0
|
92
|
+
result = block_hosts.map do |h|
|
93
|
+
run_block_on h, nil, &block
|
94
|
+
end
|
95
|
+
else
|
96
|
+
# there are no matching hosts to execute against
|
97
|
+
# should warn here
|
98
|
+
# check if logger is defined in this context
|
99
|
+
if ( cur_logger = (logger || @logger ) )
|
100
|
+
cur_logger.warn "Attempting to execute against an empty array of hosts (#{hosts}, filtered to #{block_hosts}), no execution will occur"
|
101
|
+
end
|
93
102
|
end
|
94
103
|
else
|
95
104
|
result = yield block_hosts
|
@@ -78,6 +78,32 @@ module Beaker
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
+
#We expect the connection to close so wait for that to happen
|
82
|
+
def wait_for_connection_failure
|
83
|
+
try = 1
|
84
|
+
last_wait = 0
|
85
|
+
wait = 1
|
86
|
+
while try < 11
|
87
|
+
begin
|
88
|
+
@logger.debug "Waiting for connection failure on #{@hostname} (attempt #{try}, try again in #{wait} second(s))"
|
89
|
+
@ssh.open_channel do |channel|
|
90
|
+
channel.exec('') #Just send something down the pipe
|
91
|
+
end
|
92
|
+
loop_tries = 0
|
93
|
+
#loop is actually loop_forver, so let it try 3 times and then quit instead of endless blocking
|
94
|
+
@ssh.loop { loop_tries += 1 ; loop_tries < 4 }
|
95
|
+
rescue *RETRYABLE_EXCEPTIONS => e
|
96
|
+
@logger.debug "Connection on #{@hostname} failed as expected (#{e.class.name} - #{e.message})"
|
97
|
+
close #this connection is bad, shut it down
|
98
|
+
return true
|
99
|
+
end
|
100
|
+
sleep wait
|
101
|
+
(last_wait, wait) = wait, last_wait + wait
|
102
|
+
try += 1
|
103
|
+
end
|
104
|
+
false
|
105
|
+
end
|
106
|
+
|
81
107
|
def try_to_execute command, options = {}, stdout_callback = nil,
|
82
108
|
stderr_callback = stdout_callback
|
83
109
|
|
data/lib/beaker/version.rb
CHANGED
data/spec/beaker/answers_spec.rb
CHANGED
@@ -446,4 +446,60 @@ module Beaker
|
|
446
446
|
end
|
447
447
|
end
|
448
448
|
end
|
449
|
+
|
450
|
+
describe 'Customization' do
|
451
|
+
let( :basic_hosts ) { make_hosts( { 'pe_ver' => @ver } ) }
|
452
|
+
let( :options ) { Beaker::Options::Presets.new.presets }
|
453
|
+
let( :hosts ) { basic_hosts[0]['roles'] = ['master', 'database', 'dashboard']
|
454
|
+
basic_hosts[1]['platform'] = 'windows'
|
455
|
+
basic_hosts }
|
456
|
+
let( :answers ) { Beaker::Answers.create(@ver, hosts, options) }
|
457
|
+
|
458
|
+
def test_answer_customization(answer_key, value_to_set)
|
459
|
+
@ver = '3.0'
|
460
|
+
options[:answers][answer_key] = value_to_set
|
461
|
+
host_answers = answers.answers['vm1']
|
462
|
+
expect( host_answers[answer_key] ).to be === value_to_set
|
463
|
+
end
|
464
|
+
|
465
|
+
it 'sets :q_puppetdb_hostname' do
|
466
|
+
test_answer_customization(:q_puppetdb_hostname, 'q_puppetdb_hostname_custom01')
|
467
|
+
end
|
468
|
+
|
469
|
+
it 'sets :q_puppetdb_database_user' do
|
470
|
+
test_answer_customization(:q_puppetdb_database_user, 'q_puppetdb_database_user_custom02')
|
471
|
+
end
|
472
|
+
|
473
|
+
it 'sets :q_puppetdb_database_password' do
|
474
|
+
test_answer_customization(:q_puppetdb_database_password, 'q_puppetdb_database_password_custom03')
|
475
|
+
end
|
476
|
+
|
477
|
+
it 'sets :q_puppet_enterpriseconsole_auth_database_password' do
|
478
|
+
answer = 'q_puppet_enterpriseconsole_auth_database_password_custom04'
|
479
|
+
test_answer_customization(:q_puppet_enterpriseconsole_auth_database_password, answer)
|
480
|
+
end
|
481
|
+
|
482
|
+
it 'sets :q_puppet_enterpriseconsole_database_user' do
|
483
|
+
answer = 'q_puppet_enterpriseconsole_database_user_custom05'
|
484
|
+
test_answer_customization(:q_puppet_enterpriseconsole_database_user, answer)
|
485
|
+
end
|
486
|
+
|
487
|
+
it 'sets :q_puppet_enterpriseconsole_database_password' do
|
488
|
+
answer = 'q_puppet_enterpriseconsole_database_password_custom06'
|
489
|
+
test_answer_customization(:q_puppet_enterpriseconsole_database_password, answer)
|
490
|
+
end
|
491
|
+
|
492
|
+
it 'sets :q_database_host' do
|
493
|
+
test_answer_customization(:q_database_host, 'q_database_host_custom07')
|
494
|
+
end
|
495
|
+
|
496
|
+
it 'sets :q_database_install' do
|
497
|
+
test_answer_customization(:q_database_install, 'q_database_install_custom08')
|
498
|
+
end
|
499
|
+
|
500
|
+
it 'sets :q_pe_database' do
|
501
|
+
test_answer_customization(:q_pe_database, 'q_pe_database_custom08')
|
502
|
+
end
|
503
|
+
|
504
|
+
end
|
449
505
|
end
|
data/spec/beaker/cli_spec.rb
CHANGED
@@ -235,7 +235,7 @@ module Beaker
|
|
235
235
|
|
236
236
|
cli.execute!
|
237
237
|
|
238
|
-
copied_hosts_file = File.join(File.absolute_path(dir),
|
238
|
+
copied_hosts_file = File.join(File.absolute_path(dir), 'hosts_preserved.yml')
|
239
239
|
expect( File.exists?(copied_hosts_file) ).to be_truthy
|
240
240
|
end
|
241
241
|
end
|
@@ -247,11 +247,24 @@ module Beaker
|
|
247
247
|
|
248
248
|
cli.execute!
|
249
249
|
|
250
|
-
copied_hosts_file = File.join(File.absolute_path(dir),
|
250
|
+
copied_hosts_file = File.join(File.absolute_path(dir), 'hosts_preserved.yml')
|
251
251
|
expect{ YAML.load_file(copied_hosts_file) }.to_not raise_error
|
252
252
|
end
|
253
253
|
end
|
254
254
|
|
255
|
+
it 'sets :provision to false in the copied hosts file' do
|
256
|
+
options = cli.instance_variable_get(:@options)
|
257
|
+
Dir.mktmpdir do |dir|
|
258
|
+
options[:log_dated_dir] = File.absolute_path(dir)
|
259
|
+
|
260
|
+
cli.execute!
|
261
|
+
|
262
|
+
copied_hosts_file = File.join(File.absolute_path(dir), 'hosts_preserved.yml')
|
263
|
+
yaml_content = YAML.load_file(copied_hosts_file)
|
264
|
+
expect( yaml_content['CONFIG']['provision'] ).to be_falsy
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
255
268
|
it 'sets the @options :hosts_preserved_yaml_file to the copied file' do
|
256
269
|
options = cli.instance_variable_get(:@options)
|
257
270
|
Dir.mktmpdir do |dir|
|
@@ -261,7 +274,7 @@ module Beaker
|
|
261
274
|
cli.execute!
|
262
275
|
expect( options.has_key?(:hosts_preserved_yaml_file) ).to be_truthy
|
263
276
|
|
264
|
-
copied_hosts_file = File.join(File.absolute_path(dir),
|
277
|
+
copied_hosts_file = File.join(File.absolute_path(dir), 'hosts_preserved.yml')
|
265
278
|
expect( options[:hosts_preserved_yaml_file] ).to be === copied_hosts_file
|
266
279
|
end
|
267
280
|
end
|
@@ -381,15 +394,6 @@ module Beaker
|
|
381
394
|
answer = cli.build_hosts_preserved_reproducing_command(command_to_sub, 'can/talk/to/bears.yml')
|
382
395
|
expect( answer.start_with?(command_correct) ).to be_truthy
|
383
396
|
end
|
384
|
-
|
385
|
-
it 'adds a --no-provision flag to the end of the command' do
|
386
|
-
new_hosts_file = 'john/deer/was/here.txt'
|
387
|
-
command_to_sub = 'p --log-level debug johnnypantaloons7 --jankies --flag-business'
|
388
|
-
command_correct = command_to_sub + ' --no-provision'
|
389
|
-
|
390
|
-
answer = cli.build_hosts_preserved_reproducing_command(command_to_sub, new_hosts_file)
|
391
|
-
expect( answer ).to be === command_correct
|
392
|
-
end
|
393
397
|
end
|
394
398
|
end
|
395
399
|
end
|
data/spec/beaker/command_spec.rb
CHANGED
@@ -45,15 +45,18 @@ module Beaker
|
|
45
45
|
let(:host) { {'pathseparator' => ':'} }
|
46
46
|
|
47
47
|
it 'returns a blank string if theres no env' do
|
48
|
+
expect( host ).to receive( :is_powershell? ).never
|
48
49
|
expect( subject.environment_string_for(host, {}) ).to be == ''
|
49
50
|
end
|
50
51
|
|
51
52
|
it 'takes an env hash with var_name/value pairs' do
|
53
|
+
expect( host ).to receive( :is_powershell? ).and_return(false)
|
52
54
|
expect( subject.environment_string_for(host, {:HOME => '/'}) ).
|
53
55
|
to be == "env HOME=\"/\""
|
54
56
|
end
|
55
57
|
|
56
58
|
it 'takes an env hash with var_name/value[Array] pairs' do
|
59
|
+
expect( host ).to receive( :is_powershell? ).and_return(false)
|
57
60
|
expect( subject.environment_string_for(host, {:LD_PATH => ['/', '/tmp']}) ).
|
58
61
|
to be == "env LD_PATH=\"/:/tmp\""
|
59
62
|
end
|
@@ -118,7 +118,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
118
118
|
it{
|
119
119
|
host = double("host")
|
120
120
|
allow( host ).to receive(:[]).with('distmoduledir').and_return('/etc/puppetlabs/puppet/modules')
|
121
|
-
allow( host ).to receive(:
|
121
|
+
allow( host ).to receive(:is_powershell?).and_return(false)
|
122
122
|
result = double
|
123
123
|
stdout = target.split('/')[0..-2].join('/') + "\n"
|
124
124
|
allow( result ).to receive(:stdout).and_return( stdout )
|
@@ -179,7 +179,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
179
179
|
host = double("host")
|
180
180
|
allow( host ).to receive(:[]).with('platform').and_return('windows')
|
181
181
|
allow( host ).to receive(:[]).with('distmoduledir').and_return('C:\\ProgramData\\PuppetLabs\\puppet\\etc\\modules')
|
182
|
-
allow( host ).to receive(:
|
182
|
+
allow( host ).to receive(:is_powershell?).and_return(true)
|
183
183
|
|
184
184
|
result = double
|
185
185
|
allow( result ).to receive(:stdout).and_return( 'C:\\ProgramData\\PuppetLabs\\puppet\\etc\\modules' )
|
@@ -64,6 +64,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
64
64
|
it 'generates a windows PE install command for a windows host' do
|
65
65
|
winhost['dist'] = 'puppet-enterprise-3.0'
|
66
66
|
allow( subject ).to receive( :hosts ).and_return( [ hosts[1], hosts[0], hosts[2], winhost ] )
|
67
|
+
allow( winhost ).to receive( :is_cygwin?).and_return(true)
|
67
68
|
expect( subject.installer_cmd( winhost, {} ) ).to be === "cd /tmp && cmd /C 'start /w msiexec.exe /qn /L*V tmp.log /i puppet-enterprise-3.0.msi PUPPET_MASTER_SERVER=vm1 PUPPET_AGENT_CERTNAME=winhost'"
|
68
69
|
end
|
69
70
|
|
@@ -167,6 +168,25 @@ describe ClassMixedWithDSLInstallUtils do
|
|
167
168
|
subject.fetch_pe( [unixhost], {} )
|
168
169
|
end
|
169
170
|
|
171
|
+
it 'can download a PE .tar from a URL to #fetch_and_push_pe' do
|
172
|
+
allow( File ).to receive( :directory? ).and_return( false ) #is not local
|
173
|
+
allow( subject ).to receive( :link_exists? ) do |arg|
|
174
|
+
if arg =~ /.tar.gz/ #there is no .tar.gz link, only a .tar
|
175
|
+
false
|
176
|
+
else
|
177
|
+
true
|
178
|
+
end
|
179
|
+
end
|
180
|
+
allow( subject ).to receive( :on ).and_return( true )
|
181
|
+
|
182
|
+
path = unixhost['pe_dir']
|
183
|
+
filename = "#{ unixhost['dist'] }"
|
184
|
+
extension = '.tar'
|
185
|
+
expect( subject ).to receive( :fetch_and_push_pe ).with( unixhost, anything, filename, extension ).once
|
186
|
+
expect( subject ).to receive( :on ).with( unixhost, "cd #{ unixhost['working_dir'] }; cat #{ filename }#{ extension } | tar -xvf -" ).once
|
187
|
+
subject.fetch_pe( [unixhost], {:fetch_local_then_push_to_host => true} )
|
188
|
+
end
|
189
|
+
|
170
190
|
it 'can download a PE .tar.gz from a URL to a host and unpack it' do
|
171
191
|
allow( File ).to receive( :directory? ).and_return( false ) #is not local
|
172
192
|
allow( subject ).to receive( :link_exists? ).and_return( true ) #is a tar.gz
|
@@ -179,6 +199,19 @@ describe ClassMixedWithDSLInstallUtils do
|
|
179
199
|
subject.fetch_pe( [unixhost], {} )
|
180
200
|
end
|
181
201
|
|
202
|
+
it 'can download a PE .tar.gz from a URL to #fetch_and_push_pe' do
|
203
|
+
allow( File ).to receive( :directory? ).and_return( false ) #is not local
|
204
|
+
allow( subject ).to receive( :link_exists? ).and_return( true ) #is a tar.gz
|
205
|
+
allow( subject ).to receive( :on ).and_return( true )
|
206
|
+
|
207
|
+
path = unixhost['pe_dir']
|
208
|
+
filename = "#{ unixhost['dist'] }"
|
209
|
+
extension = '.tar.gz'
|
210
|
+
expect( subject ).to receive( :fetch_and_push_pe ).with( unixhost, anything, filename, extension ).once
|
211
|
+
expect( subject ).to receive( :on ).with( unixhost, "cd #{ unixhost['working_dir'] }; cat #{ filename }#{ extension } | gunzip | tar -xvf -" ).once
|
212
|
+
subject.fetch_pe( [unixhost], {:fetch_local_then_push_to_host => true} )
|
213
|
+
end
|
214
|
+
|
182
215
|
it 'can download a PE .swix from a URL to an EOS host and unpack it' do
|
183
216
|
allow( File ).to receive( :directory? ).and_return( false ) #is not local
|
184
217
|
allow( subject ).to receive( :link_exists? ).and_return( true ) #is a tar.gz
|
@@ -253,7 +286,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
253
286
|
allow( subject ).to receive( :version_is_less ).with('3.0', '4.0').and_return( true )
|
254
287
|
allow( subject ).to receive( :version_is_less ).with('3.0', '3.4').and_return( true )
|
255
288
|
allow( subject ).to receive( :version_is_less ).with('3.0', '3.0').and_return( false )
|
256
|
-
allow( subject ).to receive( :version_is_less ).with('3.0', '3.
|
289
|
+
allow( subject ).to receive( :version_is_less ).with('3.0', '3.99').and_return( true )
|
257
290
|
allow( subject ).to receive( :wait_for_host_in_dashboard ).and_return( true )
|
258
291
|
allow( subject ).to receive( :puppet_agent ) do |arg|
|
259
292
|
"puppet agent #{arg}"
|
@@ -356,7 +389,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
356
389
|
"cd /tmp/2014-07-01_15.27.53/puppet-enterprise-3.0-linux ; nohup ./pe-installer <<<Y > higgs_2014-07-01_15.27.53.log 2>&1 &",
|
357
390
|
opts ).once
|
358
391
|
#check to see if the higgs installation has proceeded correctly, works on second check
|
359
|
-
expect( subject ).to receive( :on ).with( hosts[0], /cat #{hosts[0]['higgs_file']}/, { :
|
392
|
+
expect( subject ).to receive( :on ).with( hosts[0], /cat #{hosts[0]['higgs_file']}/, { :accept_all_exit_codes => true }).and_return( @fail_result, @success_result )
|
360
393
|
subject.do_higgs_install( hosts[0], opts )
|
361
394
|
end
|
362
395
|
|
@@ -371,7 +404,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
371
404
|
"cd /tmp/2014-07-01_15.27.53/puppet-enterprise-3.0-linux ; nohup ./pe-installer <<<Y > higgs_2014-07-01_15.27.53.log 2>&1 &",
|
372
405
|
opts ).once
|
373
406
|
#check to see if the higgs installation has proceeded correctly, works on second check
|
374
|
-
expect( subject ).to receive( :on ).with( hosts[0], /cat #{hosts[0]['higgs_file']}/, { :
|
407
|
+
expect( subject ).to receive( :on ).with( hosts[0], /cat #{hosts[0]['higgs_file']}/, { :accept_all_exit_codes => true }).exactly(10).times.and_return( @fail_result )
|
375
408
|
expect{ subject.do_higgs_install( hosts[0], opts ) }.to raise_error
|
376
409
|
end
|
377
410
|
|
@@ -472,4 +505,39 @@ describe ClassMixedWithDSLInstallUtils do
|
|
472
505
|
|
473
506
|
end
|
474
507
|
|
508
|
+
describe 'fetch_and_push_pe' do
|
509
|
+
|
510
|
+
it 'fetches the file' do
|
511
|
+
allow( subject ).to receive( :scp_to )
|
512
|
+
|
513
|
+
path = 'abcde/fg/hij'
|
514
|
+
filename = 'pants'
|
515
|
+
extension = '.txt'
|
516
|
+
expect( subject ).to receive( :fetch_http_file ).with( path, "#{filename}#{extension}", 'tmp/pe' )
|
517
|
+
subject.fetch_and_push_pe(unixhost, path, filename, extension)
|
518
|
+
end
|
519
|
+
|
520
|
+
it 'allows you to set the local copy dir' do
|
521
|
+
allow( subject ).to receive( :scp_to )
|
522
|
+
|
523
|
+
path = 'defg/hi/j'
|
524
|
+
filename = 'pants'
|
525
|
+
extension = '.txt'
|
526
|
+
local_dir = '/root/domes'
|
527
|
+
expect( subject ).to receive( :fetch_http_file ).with( path, "#{filename}#{extension}", local_dir )
|
528
|
+
subject.fetch_and_push_pe(unixhost, path, filename, extension, local_dir)
|
529
|
+
end
|
530
|
+
|
531
|
+
it 'scp\'s to the host' do
|
532
|
+
allow( subject ).to receive( :fetch_http_file )
|
533
|
+
|
534
|
+
path = 'abcde/fg/hij'
|
535
|
+
filename = 'pants'
|
536
|
+
extension = '.txt'
|
537
|
+
expect( subject ).to receive( :scp_to ).with( unixhost, "tmp/pe/#{filename}#{extension}", unixhost['working_dir'] )
|
538
|
+
subject.fetch_and_push_pe(unixhost, path, filename, extension)
|
539
|
+
end
|
540
|
+
|
541
|
+
end
|
542
|
+
|
475
543
|
end
|
@@ -27,7 +27,8 @@ describe ClassMixedWithDSLInstallUtils do
|
|
27
27
|
let(:hosts_sorted) { [ hosts[1], hosts[0], hosts[2], hosts[3] ] }
|
28
28
|
let(:winhost) { make_host( 'winhost', { :platform => 'windows',
|
29
29
|
:pe_ver => '3.0',
|
30
|
-
:working_dir => '/tmp'
|
30
|
+
:working_dir => '/tmp',
|
31
|
+
:is_cygwin => true} ) }
|
31
32
|
let(:winhost_non_cygwin) { make_host( 'winhost_non_cygwin', { :platform => 'windows',
|
32
33
|
:pe_ver => '3.0',
|
33
34
|
:working_dir => '/tmp',
|
@@ -242,6 +243,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
242
243
|
context 'on windows' do
|
243
244
|
let(:platform) { "windows-2008r2-i386" }
|
244
245
|
it 'installs specific version of puppet when passed :version' do
|
246
|
+
allow(hosts[0]).to receive(:is_cygwin?).and_return(true)
|
245
247
|
allow(subject).to receive(:link_exists?).and_return( true )
|
246
248
|
expect(subject).to receive(:on).with(hosts[0], 'curl -O http://downloads.puppetlabs.com/windows/puppet-3000.msi')
|
247
249
|
expect(subject).to receive(:on).with(hosts[0], " echo 'export PATH=$PATH:\"/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/bin\":\"/cygdrive/c/Program Files/Puppet Labs/Puppet/bin\"' > /etc/bash.bashrc ")
|
@@ -249,6 +251,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
249
251
|
subject.install_puppet(:version => '3000')
|
250
252
|
end
|
251
253
|
it 'installs from custom url when passed :win_download_url' do
|
254
|
+
allow(hosts[0]).to receive(:is_cygwin?).and_return(true)
|
252
255
|
allow(subject).to receive(:link_exists?).and_return( true )
|
253
256
|
expect(subject).to receive(:on).with(hosts[0], 'curl -O http://nightlies.puppetlabs.com/puppet-latest/repos/windows/puppet-3000.msi')
|
254
257
|
expect(subject).to receive(:on).with(hosts[0], 'cmd /C \'start /w msiexec.exe /qn /i puppet-3000.msi\'')
|
@@ -29,7 +29,7 @@ module Beaker
|
|
29
29
|
@opts = {'platform' => 'sles-is-me'}
|
30
30
|
pkg = 'sles_package'
|
31
31
|
expect( Beaker::Command ).to receive(:new).with("zypper se -i --match-exact #{pkg}").and_return('')
|
32
|
-
expect( instance ).to receive(:exec).with('', :
|
32
|
+
expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
|
33
33
|
expect( instance.check_for_package(pkg) ).to be === true
|
34
34
|
end
|
35
35
|
|
@@ -37,7 +37,7 @@ module Beaker
|
|
37
37
|
@opts = {'platform' => 'fedora-is-me'}
|
38
38
|
pkg = 'fedora_package'
|
39
39
|
expect( Beaker::Command ).to receive(:new).with("rpm -q #{pkg}").and_return('')
|
40
|
-
expect( instance ).to receive(:exec).with('', :
|
40
|
+
expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
|
41
41
|
expect( instance.check_for_package(pkg) ).to be === true
|
42
42
|
end
|
43
43
|
|
@@ -45,7 +45,7 @@ module Beaker
|
|
45
45
|
@opts = {'platform' => 'centos-is-me'}
|
46
46
|
pkg = 'centos_package'
|
47
47
|
expect( Beaker::Command ).to receive(:new).with("rpm -q #{pkg}").and_return('')
|
48
|
-
expect( instance ).to receive(:exec).with('', :
|
48
|
+
expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
|
49
49
|
expect( instance.check_for_package(pkg) ).to be === true
|
50
50
|
end
|
51
51
|
|
@@ -53,7 +53,7 @@ module Beaker
|
|
53
53
|
@opts = {'platform' => 'eos-is-me'}
|
54
54
|
pkg = 'eos-package'
|
55
55
|
expect( Beaker::Command ).to receive(:new).with("rpm -q #{pkg}").and_return('')
|
56
|
-
expect( instance ).to receive(:exec).with('', :
|
56
|
+
expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
|
57
57
|
expect( instance.check_for_package(pkg) ).to be === true
|
58
58
|
end
|
59
59
|
|
@@ -61,7 +61,7 @@ module Beaker
|
|
61
61
|
@opts = {'platform' => 'el-is-me'}
|
62
62
|
pkg = 'el_package'
|
63
63
|
expect( Beaker::Command ).to receive(:new).with("rpm -q #{pkg}").and_return('')
|
64
|
-
expect( instance ).to receive(:exec).with('', :
|
64
|
+
expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
|
65
65
|
expect( instance.check_for_package(pkg) ).to be === true
|
66
66
|
end
|
67
67
|
|
@@ -69,7 +69,7 @@ module Beaker
|
|
69
69
|
@opts = {'platform' => 'debian-is-me'}
|
70
70
|
pkg = 'debian_package'
|
71
71
|
expect( Beaker::Command ).to receive(:new).with("dpkg -s #{pkg}").and_return('')
|
72
|
-
expect( instance ).to receive(:exec).with('', :
|
72
|
+
expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
|
73
73
|
expect( instance.check_for_package(pkg) ).to be === true
|
74
74
|
end
|
75
75
|
|
@@ -77,7 +77,7 @@ module Beaker
|
|
77
77
|
@opts = {'platform' => 'ubuntu-is-me'}
|
78
78
|
pkg = 'ubuntu_package'
|
79
79
|
expect( Beaker::Command ).to receive(:new).with("dpkg -s #{pkg}").and_return('')
|
80
|
-
expect( instance ).to receive(:exec).with('', :
|
80
|
+
expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
|
81
81
|
expect( instance.check_for_package(pkg) ).to be === true
|
82
82
|
end
|
83
83
|
|
@@ -85,7 +85,7 @@ module Beaker
|
|
85
85
|
@opts = {'platform' => 'cumulus-is-me'}
|
86
86
|
pkg = 'cumulus_package'
|
87
87
|
expect( Beaker::Command ).to receive(:new).with("dpkg -s #{pkg}").and_return('')
|
88
|
-
expect( instance ).to receive(:exec).with('', :
|
88
|
+
expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
|
89
89
|
expect( instance.check_for_package(pkg) ).to be === true
|
90
90
|
end
|
91
91
|
|
@@ -93,7 +93,7 @@ module Beaker
|
|
93
93
|
@opts = {'platform' => 'solaris-11-is-me'}
|
94
94
|
pkg = 'solaris-11_package'
|
95
95
|
expect( Beaker::Command ).to receive(:new).with("pkg info #{pkg}").and_return('')
|
96
|
-
expect( instance ).to receive(:exec).with('', :
|
96
|
+
expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
|
97
97
|
expect( instance.check_for_package(pkg) ).to be === true
|
98
98
|
end
|
99
99
|
|
@@ -101,7 +101,7 @@ module Beaker
|
|
101
101
|
@opts = {'platform' => 'solaris-10-is-me'}
|
102
102
|
pkg = 'solaris-10_package'
|
103
103
|
expect( Beaker::Command ).to receive(:new).with("pkginfo #{pkg}").and_return('')
|
104
|
-
expect( instance ).to receive(:exec).with('', :
|
104
|
+
expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
|
105
105
|
expect( instance.check_for_package(pkg) ).to be === true
|
106
106
|
end
|
107
107
|
|