beaker 2.9.0 → 2.10.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.
@@ -28,6 +28,10 @@ describe ClassMixedWithDSLInstallUtils do
28
28
  let(:winhost) { make_host( 'winhost', { :platform => 'windows',
29
29
  :pe_ver => '3.0',
30
30
  :working_dir => '/tmp' } ) }
31
+ let(:winhost_non_cygwin) { make_host( 'winhost_non_cygwin', { :platform => 'windows',
32
+ :pe_ver => '3.0',
33
+ :working_dir => '/tmp',
34
+ :is_cygwin => 'false' } ) }
31
35
  let(:machost) { make_host( 'machost', { :platform => 'osx-10.9-x86_64',
32
36
  :pe_ver => '3.0',
33
37
  :working_dir => '/tmp' } ) }
@@ -87,6 +91,34 @@ describe ClassMixedWithDSLInstallUtils do
87
91
  end
88
92
  end
89
93
 
94
+ context 'install_puppet_from_msi' do
95
+
96
+ it 'installs puppet on cygwin windows' do
97
+ allow(subject).to receive(:link_exists?).and_return( true )
98
+
99
+ expect(subject).to receive(:on).with(winhost, 'curl -O http://downloads.puppetlabs.com/windows/puppet-3.7.1.msi')
100
+ expect(subject).to receive(:on).with(winhost, " echo 'export PATH=$PATH:\"/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/bin\":\"/cygdrive/c/Program Files/Puppet Labs/Puppet/bin\"' > /etc/bash.bashrc ")
101
+ expect(subject).to receive(:on).with(winhost, 'cmd /C \'start /w msiexec.exe /qn /i puppet-3.7.1.msi\'')
102
+
103
+ subject.install_puppet_from_msi( winhost, {:version => '3.7.1', :win_download_url => 'http://downloads.puppetlabs.com/windows'} )
104
+ end
105
+
106
+ it 'installs puppet on non-cygwin windows' do
107
+ allow(subject).to receive(:link_exists?).and_return( true )
108
+
109
+ expect(winhost_non_cygwin).to receive(:mkdir_p).with('C:\\ProgramData\\PuppetLabs\\puppet\\etc\\modules')
110
+
111
+ expect(subject).to receive(:on) do |winhost_non_cygwin, beaker_command|
112
+ expect(beaker_command.command).to eq('powershell.exe')
113
+ expect(beaker_command.args).to eq(["-ExecutionPolicy Bypass", "-InputFormat None", "-NoLogo", "-NoProfile", "-NonInteractive", "-Command $webclient = New-Object System.Net.WebClient; $webclient.DownloadFile('http://downloads.puppetlabs.com/windows/puppet-3.7.1.msi','C:\\Windows\\Temp\\puppet-3.7.1.msi')"])
114
+ end
115
+
116
+ expect(subject).to receive(:on).with(winhost_non_cygwin, "start /w msiexec.exe /qn /i C:\\Windows\\Temp\\puppet-3.7.1.msi")
117
+
118
+ subject.install_puppet_from_msi( winhost_non_cygwin, {:version => '3.7.1', :win_download_url => 'http://downloads.puppetlabs.com/windows'} )
119
+ end
120
+ end
121
+
90
122
  context 'install_from_git' do
91
123
  it 'does a ton of stuff it probably shouldnt' do
92
124
  repo = { :name => 'puppet',
@@ -343,26 +375,33 @@ describe ClassMixedWithDSLInstallUtils do
343
375
 
344
376
  end
345
377
 
346
- RSpec.shared_examples "install-dev-repo" do
347
-
348
- it "scp's files to SUT then modifies them with find-and-sed 2-hit combo" do
349
- allow(rez).to receive(:exit_code) { 0 }
350
- allow(subject).to receive(:link_exists?).and_return(true)
351
- expect(subject).to receive(:on).with( host, /^mkdir -p .*$/ ).ordered
352
- expect(subject).to receive(:scp_to).with( host, repo_config, /.*/ ).ordered
353
- expect(subject).to receive(:scp_to).with( host, repo_dir, /.*/ ).ordered
354
- expect(subject).to receive(:on).with( host, /^find .* sed .*/ ).ordered
355
- subject.install_puppetlabs_dev_repo host, package_name, package_version
356
- end
357
-
358
- end
359
-
360
378
  describe "#install_puppetlabs_dev_repo" do
361
379
  let( :package_name ) { "puppet" }
362
380
  let( :package_version ) { "7.5.6" }
363
381
  let( :host ) do
364
382
  FakeHost.create('fakvm', platform.to_s, opts)
365
383
  end
384
+ let( :logger_double ) do
385
+ logger_double = Object.new
386
+ allow(logger_double).to receive(:debug)
387
+ subject.instance_variable_set(:@logger, logger_double)
388
+ logger_double
389
+ end
390
+
391
+ RSpec.shared_examples "install-dev-repo" do
392
+
393
+ it "scp's files to SUT then modifies them with find-and-sed 2-hit combo" do
394
+ allow(rez).to receive(:exit_code) { 0 }
395
+ allow(logger_double).to receive(:debug)
396
+ allow(subject).to receive(:link_exists?).and_return(true)
397
+ expect(subject).to receive(:on).with( host, /^mkdir -p .*$/ ).ordered
398
+ expect(subject).to receive(:scp_to).with( host, repo_config, /.*/ ).ordered
399
+ expect(subject).to receive(:scp_to).with( host, repo_dir, /.*/ ).ordered
400
+ expect(subject).to receive(:on).with( host, /^find .* sed .*/ ).ordered
401
+ subject.install_puppetlabs_dev_repo host, package_name, package_version
402
+ end
403
+
404
+ end
366
405
 
367
406
  describe "When host is unsupported platform" do
368
407
  let( :platform ) { Beaker::Platform.new('solaris-7-i386') }
@@ -406,15 +445,18 @@ describe ClassMixedWithDSLInstallUtils do
406
445
 
407
446
  it 'sets up the PC1 repository if that was downloaded' do
408
447
  allow(rez).to receive(:exit_code) { 0 }
448
+ allow(logger_double).to receive(:debug)
409
449
 
410
450
  stub_uninteresting_portions_of_install_puppetlabs_dev_repo!
411
451
 
452
+ opts[:dev_builds_repos] = ['PC1']
412
453
  expect(subject).to receive(:on).with( host, /^find .* sed .*PC1.*/ )
413
454
  subject.install_puppetlabs_dev_repo host, package_name, package_version
414
455
  end
415
456
 
416
457
  it 'sets up the main repository if that was downloaded' do
417
- allow(rez).to receive(:exit_code) { 1 }
458
+ allow(rez).to receive(:exit_code) { 0 }
459
+ allow(logger_double).to receive(:debug)
418
460
 
419
461
  stub_uninteresting_portions_of_install_puppetlabs_dev_repo!
420
462
 
@@ -428,13 +470,29 @@ describe ClassMixedWithDSLInstallUtils do
428
470
  let( :platform ) { Beaker::Platform.new('el-7-i386') }
429
471
  include_examples "install-dev-repo"
430
472
 
431
- it 'downloads PC1, products, or devel repo -- in that order' do
473
+ it 'downloads products or devel repo -- in that order, by default' do
432
474
  allow(subject).to receive(:on).with( host, /^find .* sed .*/ )
433
475
  stub_uninteresting_portions_of_install_puppetlabs_dev_repo!
434
476
 
435
- expect(subject).to receive(:link_exists?).with(/.*PC1.*/).and_return( false )
477
+ expect(logger_double).to receive(:debug).exactly( 2 ).times
436
478
  expect(subject).to receive(:link_exists?).with(/.*products.*/).and_return( false )
437
- expect(subject).to receive(:link_exists?).with(/.*devel.*/).and_return( true )
479
+ expect(subject).to receive(:link_exists?).with(/.*devel.*/).twice.and_return( true )
480
+
481
+ subject.install_puppetlabs_dev_repo host, package_name, package_version
482
+ end
483
+
484
+ it 'allows ordered customization of repos based on the :dev_builds_repos option' do
485
+ opts[:dev_builds_repos] = ['PC17', 'yomama', 'McGuyver', 'McGruber', 'panama']
486
+ allow(subject).to receive(:on).with( host, /^find .* sed .*/ )
487
+ stub_uninteresting_portions_of_install_puppetlabs_dev_repo!
488
+
489
+ logger_call_num = opts[:dev_builds_repos].length + 2
490
+ expect(logger_double).to receive(:debug).exactly( logger_call_num ).times
491
+ opts[:dev_builds_repos].each do |repo|
492
+ expect(subject).to receive(:link_exists?).with(/.*repo.*/).ordered.and_return( false )
493
+ end
494
+ expect(subject).to receive(:link_exists?).with(/.*products.*/).ordered.and_return( false )
495
+ expect(subject).to receive(:link_exists?).with(/.*devel.*/).twice.ordered.and_return( true )
438
496
 
439
497
  subject.install_puppetlabs_dev_repo host, package_name, package_version
440
498
  end
@@ -567,7 +625,7 @@ describe ClassMixedWithDSLInstallUtils do
567
625
 
568
626
  describe '#install_cert_on_windows' do
569
627
  before do
570
- subject.stub(:on).and_return(Beaker::Result.new({},''))
628
+ allow(subject).to receive(:on).and_return(Beaker::Result.new({},''))
571
629
  end
572
630
 
573
631
  context 'on windows' do
@@ -598,7 +656,7 @@ describe ClassMixedWithDSLInstallUtils do
598
656
  5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw==
599
657
  -----END CERTIFICATE-----
600
658
  EOM
601
-
659
+
602
660
  expect(subject).to receive(:create_remote_file) do |host, file_path, file_content|
603
661
  expect(file_path).to eq("C:\\Windows\\Temp\\#{cert}.pem")
604
662
  end
@@ -34,7 +34,7 @@ module Beaker
34
34
  expect( pieces[1] ).to be === '[+]'
35
35
  expect( pieces[2] ).to be === hypervisor_value
36
36
  expect( pieces[3] ).to be === platform_value
37
- expect( pieces[4] ).to be === host.name
37
+ expect( pieces[4] ).to be === host.log_prefix
38
38
  end
39
39
 
40
40
  it 'follows the create parameter correctly' 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: 2.9.0
4
+ version: 2.10.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-04-09 00:00:00.000000000 Z
11
+ date: 2015-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -421,6 +421,7 @@ files:
421
421
  - lib/beaker/host/aix/group.rb
422
422
  - lib/beaker/host/aix/user.rb
423
423
  - lib/beaker/host/freebsd.rb
424
+ - lib/beaker/host/freebsd/exec.rb
424
425
  - lib/beaker/host/mac.rb
425
426
  - lib/beaker/host/mac/group.rb
426
427
  - lib/beaker/host/mac/user.rb