beaker 2.5.0 → 2.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/HISTORY.md +258 -2
- data/beaker.gemspec +2 -1
- data/lib/beaker/answers/version20.rb +0 -1
- data/lib/beaker/answers/version28.rb +0 -1
- data/lib/beaker/answers/version34.rb +1 -1
- data/lib/beaker/command.rb +1 -1
- data/lib/beaker/dsl/helpers.rb +48 -20
- data/lib/beaker/dsl/install_utils.rb +110 -8
- data/lib/beaker/dsl/wrappers.rb +10 -2
- data/lib/beaker/host.rb +133 -18
- data/lib/beaker/host/pswindows.rb +23 -49
- data/lib/beaker/host/pswindows/file.rb +11 -2
- data/lib/beaker/host/pswindows/pkg.rb +12 -6
- data/lib/beaker/host/unix.rb +18 -14
- data/lib/beaker/host/windows.rb +18 -1
- data/lib/beaker/host/windows/file.rb +5 -0
- data/lib/beaker/host_prebuilt_steps.rb +41 -19
- data/lib/beaker/hypervisor.rb +3 -1
- data/lib/beaker/hypervisor/docker.rb +12 -4
- data/lib/beaker/hypervisor/openstack.rb +28 -5
- data/lib/beaker/options/presets.rb +1 -0
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/dsl/helpers_spec.rb +69 -22
- data/spec/beaker/dsl/install_utils_spec.rb +82 -4
- data/spec/beaker/dsl/wrappers_spec.rb +2 -2
- data/spec/beaker/host_spec.rb +30 -2
- metadata +18 -4
@@ -579,6 +579,63 @@ describe ClassMixedWithDSLInstallUtils do
|
|
579
579
|
end
|
580
580
|
end
|
581
581
|
|
582
|
+
describe 'configure_puppet_on' do
|
583
|
+
before do
|
584
|
+
allow(subject).to receive(:on).and_return(Beaker::Result.new({},''))
|
585
|
+
end
|
586
|
+
context 'on debian' do
|
587
|
+
let(:platform) { 'debian-7-amd64' }
|
588
|
+
let(:host) { make_host('testbox.test.local', :platform => 'debian-7-amd64') }
|
589
|
+
it 'it sets the puppet.conf file to the provided config' do
|
590
|
+
config = { 'main' => {'server' => 'testbox.test.local'} }
|
591
|
+
expect(subject).to receive(:on).with(host, "echo \"[main]\nserver=testbox.test.local\n\n\" > /etc/puppet/puppet.conf")
|
592
|
+
subject.configure_puppet_on(host, config)
|
593
|
+
end
|
594
|
+
end
|
595
|
+
context 'on windows' do
|
596
|
+
let(:platform) { 'windows-2008R2-amd64' }
|
597
|
+
let(:host) { make_host('testbox.test.local', :platform => 'windows-2008R2-amd64') }
|
598
|
+
it 'it sets the puppet.conf file to the provided config' do
|
599
|
+
config = { 'main' => {'server' => 'testbox.test.local'} }
|
600
|
+
expect(subject).to receive(:on) do |host, command|
|
601
|
+
expect(command.command).to eq('powershell.exe')
|
602
|
+
expect(command.args).to eq(["-ExecutionPolicy Bypass", "-InputFormat None", "-NoLogo", "-NoProfile", "-NonInteractive", "-Command $text = \\\"[main]`nserver=testbox.test.local`n`n\\\"; Set-Content -path '`cygpath -smF 35`/PuppetLabs/puppet/etc\\puppet.conf' -value $text"])
|
603
|
+
end
|
604
|
+
subject.configure_puppet_on(host, config)
|
605
|
+
end
|
606
|
+
end
|
607
|
+
end
|
608
|
+
|
609
|
+
describe 'configure_puppet' do
|
610
|
+
let(:hosts) do
|
611
|
+
make_hosts({:platform => platform })
|
612
|
+
end
|
613
|
+
|
614
|
+
before do
|
615
|
+
allow( subject ).to receive(:hosts).and_return(hosts)
|
616
|
+
allow( subject ).to receive(:on).and_return(Beaker::Result.new({},''))
|
617
|
+
end
|
618
|
+
context 'on debian' do
|
619
|
+
let(:platform) { 'debian-7-amd64' }
|
620
|
+
it 'it sets the puppet.conf file to the provided config' do
|
621
|
+
config = { 'main' => {'server' => 'testbox.test.local'} }
|
622
|
+
expect(subject).to receive(:on).with(hosts[0], "echo \"[main]\nserver=testbox.test.local\n\n\" > /etc/puppet/puppet.conf")
|
623
|
+
subject.configure_puppet(config)
|
624
|
+
end
|
625
|
+
end
|
626
|
+
context 'on windows' do
|
627
|
+
let(:platform) { 'windows-2008R2-amd64' }
|
628
|
+
it 'it sets the puppet.conf file to the provided config' do
|
629
|
+
config = { 'main' => {'server' => 'testbox.test.local'} }
|
630
|
+
expect(subject).to receive(:on) do |host, command|
|
631
|
+
expect(command.command).to eq('powershell.exe')
|
632
|
+
expect(command.args).to eq(["-ExecutionPolicy Bypass", "-InputFormat None", "-NoLogo", "-NoProfile", "-NonInteractive", "-Command $text = \\\"[main]`nserver=testbox.test.local`n`n\\\"; Set-Content -path '`cygpath -smF 35`/PuppetLabs/puppet/etc\\puppet.conf' -value $text"])
|
633
|
+
end
|
634
|
+
subject.configure_puppet(config)
|
635
|
+
end
|
636
|
+
end
|
637
|
+
end
|
638
|
+
|
582
639
|
describe '#add_system32_hosts_entry' do
|
583
640
|
before do
|
584
641
|
allow( subject ).to receive(:on).and_return(Beaker::Result.new({},''))
|
@@ -601,7 +658,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
601
658
|
entry = { 'ip' => '23.251.154.122', 'name' => 'forge.puppetlabs.com' }
|
602
659
|
expect(subject).to receive(:on) do |host, command|
|
603
660
|
expect(command.command).to eq('powershell.exe')
|
604
|
-
expect(command.args).to eq("
|
661
|
+
expect(command.args).to eq(["-ExecutionPolicy Bypass", "-InputFormat None", "-NoLogo", "-NoProfile", "-NonInteractive", "-Command $text = \\\"23.251.154.122`t`tforge.puppetlabs.com\\\"; Add-Content -path 'C:\\Windows\\System32\\Drivers\\etc\\hosts' -value $text"])
|
605
662
|
end
|
606
663
|
|
607
664
|
|
@@ -658,10 +715,11 @@ describe ClassMixedWithDSLInstallUtils do
|
|
658
715
|
the_hosts = [ hosts[0].dup, hosts[1].dup, hosts[2].dup ]
|
659
716
|
allow( subject ).to receive( :hosts ).and_return( the_hosts )
|
660
717
|
allow( subject ).to receive( :options ).and_return( {} )
|
718
|
+
allow( subject ).to receive( :version_is_less ).with('3.0', '3.4.0').and_return( true )
|
661
719
|
allow( subject ).to receive( :version_is_less ).with('2.8', '3.0').and_return( true )
|
662
720
|
version = version_win = '2.8'
|
663
721
|
path = "/path/to/upgradepkg"
|
664
|
-
expect( subject ).to receive( :do_install ).with( the_hosts, {
|
722
|
+
expect( subject ).to receive( :do_install ).with( the_hosts, {:type=>:upgrade, :set_console_password=>true} )
|
665
723
|
subject.upgrade_pe( path )
|
666
724
|
the_hosts.each do |h|
|
667
725
|
expect( h['pe_installer'] ).to be === 'puppet-enterprise-upgrader'
|
@@ -674,10 +732,11 @@ describe ClassMixedWithDSLInstallUtils do
|
|
674
732
|
the_hosts = [ hosts[0].dup, hosts[1].dup, hosts[2].dup ]
|
675
733
|
allow( subject ).to receive( :hosts ).and_return( the_hosts )
|
676
734
|
allow( subject ).to receive( :options ).and_return( {} )
|
735
|
+
allow( subject ).to receive( :version_is_less ).with('3.0', '3.4.0').and_return( true )
|
677
736
|
allow( subject ).to receive( :version_is_less ).with('3.1', '3.0').and_return( false )
|
678
737
|
version = version_win = '3.1'
|
679
738
|
path = "/path/to/upgradepkg"
|
680
|
-
expect( subject ).to receive( :do_install ).with( the_hosts, {
|
739
|
+
expect( subject ).to receive( :do_install ).with( the_hosts, {:type=>:upgrade, :set_console_password=>true} )
|
681
740
|
subject.upgrade_pe( path )
|
682
741
|
the_hosts.each do |h|
|
683
742
|
expect( h['pe_installer'] ).to be nil
|
@@ -690,10 +749,11 @@ describe ClassMixedWithDSLInstallUtils do
|
|
690
749
|
the_hosts = [ hosts[0].dup, hosts[1].dup, hosts[2].dup ]
|
691
750
|
allow( subject ).to receive( :hosts ).and_return( the_hosts )
|
692
751
|
allow( subject ).to receive( :options ).and_return( {} )
|
752
|
+
allow( subject ).to receive( :version_is_less ).with('3.0', '3.4.0').and_return( true )
|
693
753
|
allow( subject ).to receive( :version_is_less ).with('2.8', '3.0').and_return( true )
|
694
754
|
version = version_win = '2.8'
|
695
755
|
path = "/path/to/upgradepkg"
|
696
|
-
expect( subject ).to receive( :do_install ).with( the_hosts, {
|
756
|
+
expect( subject ).to receive( :do_install ).with( the_hosts, {:type=>:upgrade, :set_console_password=>true} )
|
697
757
|
subject.upgrade_pe( path )
|
698
758
|
the_hosts.each do |h|
|
699
759
|
expect( h['pe_ver'] ).to be === '2.8'
|
@@ -917,6 +977,24 @@ describe ClassMixedWithDSLInstallUtils do
|
|
917
977
|
subject.install_puppetagent_dev_repo( host, opts )
|
918
978
|
end
|
919
979
|
|
980
|
+
it 'runs the correct install for windows platforms' do
|
981
|
+
platform = Object.new()
|
982
|
+
allow(platform).to receive(:to_array) { ['windows', '5', 'x64']}
|
983
|
+
host = basic_hosts.first
|
984
|
+
host['platform'] = platform
|
985
|
+
opts = { :version => '0.1.0' }
|
986
|
+
allow( subject ).to receive( :options ).and_return( {} )
|
987
|
+
mock_echo = Object.new()
|
988
|
+
allow( mock_echo ).to receive( :raw_output ).and_return( " " )
|
989
|
+
|
990
|
+
expect(subject).to receive(:fetch_http_file).once.with(/\/windows$/, 'puppet-agent-x64.msi', /\/windows$/)
|
991
|
+
expect(subject).to receive(:scp_to).once.with(host, /\/puppet-agent-x64.msi$/, /cygpath/)
|
992
|
+
expect(subject).to receive(:on).ordered.with(host, /echo/).and_return(mock_echo)
|
993
|
+
expect(subject).to receive(:on).ordered.with(host, anything)
|
994
|
+
|
995
|
+
subject.install_puppetagent_dev_repo( host, opts )
|
996
|
+
end
|
997
|
+
|
920
998
|
it 'allows you to override the local copy directory' do
|
921
999
|
platform = Object.new()
|
922
1000
|
allow(platform).to receive(:to_array) { ['debian', '5', 'x4']}
|
@@ -62,14 +62,14 @@ describe ClassMixedWithDSLWrappers do
|
|
62
62
|
it 'should pass "powershell.exe <args> -Command <command>" to Command' do
|
63
63
|
command = subject.powershell("Set-Content -path 'fu.txt' -value 'fu'")
|
64
64
|
expect(command.command ).to be === 'powershell.exe'
|
65
|
-
expect( command.args).to be ===
|
65
|
+
expect( command.args).to be === ["-ExecutionPolicy Bypass", "-InputFormat None", "-NoLogo", "-NoProfile", "-NonInteractive", "-Command Set-Content -path 'fu.txt' -value 'fu'"]
|
66
66
|
expect( command.options ).to be === {}
|
67
67
|
end
|
68
68
|
|
69
69
|
it 'should merge the arguments provided with the defaults' do
|
70
70
|
command = subject.powershell("Set-Content -path 'fu.txt' -value 'fu'", {'ExecutionPolicy' => 'Unrestricted'})
|
71
71
|
expect( command.command).to be === 'powershell.exe'
|
72
|
-
expect( command.args ).to be ===
|
72
|
+
expect( command.args ).to be === ["-ExecutionPolicy Unrestricted", "-InputFormat None", "-NoLogo", "-NoProfile", "-NonInteractive", "-Command Set-Content -path 'fu.txt' -value 'fu'"]
|
73
73
|
expect( command.options ).to be === {}
|
74
74
|
end
|
75
75
|
end
|
data/spec/beaker/host_spec.rb
CHANGED
@@ -220,8 +220,8 @@ module Beaker
|
|
220
220
|
|
221
221
|
describe "#delete_env_var" do
|
222
222
|
it "deletes env var" do
|
223
|
-
expect( Beaker::SedCommand ).to receive(:new).with('unix', '/
|
224
|
-
expect( Beaker::SedCommand ).to receive(:new).with('unix', 's/
|
223
|
+
expect( Beaker::SedCommand ).to receive(:new).with('unix', '/KEY=\\/my\\/first\\/value$/d', '~/.ssh/environment')
|
224
|
+
expect( Beaker::SedCommand ).to receive(:new).with('unix', 's/KEY=\\(.*[:;]*\\)\\/my\\/first\\/value[:;]*/KEY=\\1/', '~/.ssh/environment')
|
225
225
|
host.delete_env_var('key', '/my/first/value')
|
226
226
|
end
|
227
227
|
|
@@ -553,6 +553,34 @@ module Beaker
|
|
553
553
|
end
|
554
554
|
end
|
555
555
|
|
556
|
+
context 'do_rsync_to' do
|
557
|
+
it 'do_rsync_to logs info and call Rsync class' do
|
558
|
+
create_files(['source'])
|
559
|
+
logger = host[:logger]
|
560
|
+
@options = { :logger => logger }
|
561
|
+
args = [ 'source', 'target', {:ignore => ['.bundle']} ]
|
562
|
+
|
563
|
+
key = host['ssh']['keys']
|
564
|
+
if key.is_a? Array
|
565
|
+
key = key.first
|
566
|
+
end
|
567
|
+
|
568
|
+
rsync_args = [ 'source', 'target', ['-az', "-e \"ssh -i #{key} -p 22 -o 'StrictHostKeyChecking no'\"", "--exclude '.bundle'"] ]
|
569
|
+
|
570
|
+
expect( host ).to receive(:to_s).and_return('host.example.org')
|
571
|
+
|
572
|
+
expect( Rsync ).to receive(:run).with( *rsync_args ).and_return(Beaker::Result.new(host, 'output!'))
|
573
|
+
|
574
|
+
host.do_rsync_to *args
|
575
|
+
|
576
|
+
expect(Rsync.host).to eq('root@host.example.org')
|
577
|
+
end
|
578
|
+
|
579
|
+
it 'throws an IOError when the file given doesn\'t exist' do
|
580
|
+
expect { host.do_rsync_to "/does/not/exist", "does/not/exist/over/there", {} }.to raise_error(IOError)
|
581
|
+
end
|
582
|
+
end
|
583
|
+
|
556
584
|
it 'interpolates to its "name"' do
|
557
585
|
expect( "#{host}" ).to be === 'name'
|
558
586
|
end
|
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.5.
|
4
|
+
version: 2.5.1
|
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-03-04 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: '2.0'
|
237
|
+
- !ruby/object:Gem::Dependency
|
238
|
+
name: rsync
|
239
|
+
requirement: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - ~>
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: 1.0.9
|
244
|
+
type: :runtime
|
245
|
+
prerelease: false
|
246
|
+
version_requirements: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - ~>
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: 1.0.9
|
237
251
|
- !ruby/object:Gem::Dependency
|
238
252
|
name: rbvmomi
|
239
253
|
requirement: !ruby/object:Gem::Requirement
|
@@ -268,14 +282,14 @@ dependencies:
|
|
268
282
|
requirements:
|
269
283
|
- - ~>
|
270
284
|
- !ruby/object:Gem::Version
|
271
|
-
version: '0.
|
285
|
+
version: '0.8'
|
272
286
|
type: :runtime
|
273
287
|
prerelease: false
|
274
288
|
version_requirements: !ruby/object:Gem::Requirement
|
275
289
|
requirements:
|
276
290
|
- - ~>
|
277
291
|
- !ruby/object:Gem::Version
|
278
|
-
version: '0.
|
292
|
+
version: '0.8'
|
279
293
|
- !ruby/object:Gem::Dependency
|
280
294
|
name: aws-sdk
|
281
295
|
requirement: !ruby/object:Gem::Requirement
|