beaker-vagrant 0.6.7 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +24 -0
- data/beaker-vagrant.gemspec +2 -6
- data/lib/beaker-vagrant/version.rb +1 -1
- data/lib/beaker/hypervisor/vagrant.rb +33 -66
- data/lib/beaker/hypervisor/vagrant_custom.rb +1 -0
- data/lib/beaker/hypervisor/vagrant_libvirt.rb +16 -26
- data/spec/beaker/hypervisor/vagrant_custom_spec.rb +3 -2
- data/spec/beaker/hypervisor/vagrant_desktop_spec.rb +33 -47
- data/spec/beaker/hypervisor/vagrant_fusion_spec.rb +14 -14
- data/spec/beaker/hypervisor/vagrant_libvirt_spec.rb +23 -26
- data/spec/beaker/hypervisor/vagrant_parallels_spec.rb +20 -23
- data/spec/beaker/hypervisor/vagrant_spec.rb +41 -118
- data/spec/beaker/hypervisor/vagrant_virtualbox_spec.rb +47 -69
- data/spec/beaker/hypervisor/vagrant_workstation_spec.rb +33 -47
- metadata +14 -21
@@ -6,56 +6,53 @@ describe Beaker::VagrantLibvirt do
|
|
6
6
|
'libvirt' => { 'uri' => 'qemu+ssh://root@host/system'},
|
7
7
|
'vagrant_cpus' => 2,
|
8
8
|
}) }
|
9
|
-
let( :vagrant ) {
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
let( :vagrant ) { described_class.new( hosts, options ) }
|
10
|
+
let( :hosts ) do
|
11
|
+
make_hosts().each do |host|
|
12
|
+
host.delete('ip')
|
13
|
+
end
|
13
14
|
end
|
14
15
|
|
15
16
|
it "uses the vagrant_libvirt provider for provisioning" do
|
16
|
-
|
17
|
+
hosts.each do |host|
|
17
18
|
host_prev_name = host['user']
|
18
19
|
expect( vagrant ).to receive( :set_ssh_config ).with( host, 'vagrant' ).once
|
19
20
|
expect( vagrant ).to receive( :copy_ssh_to_root ).with( host, options ).once
|
20
21
|
expect( vagrant ).to receive( :set_ssh_config ).with( host, host_prev_name ).once
|
21
22
|
end
|
22
|
-
expect( vagrant ).to receive( :hack_etc_hosts ).with(
|
23
|
-
FakeFS.activate!
|
23
|
+
expect( vagrant ).to receive( :hack_etc_hosts ).with( hosts, options ).once
|
24
24
|
expect( vagrant ).to receive( :vagrant_cmd ).with( "up --provider libvirt" ).once
|
25
|
-
|
25
|
+
FakeFS do
|
26
|
+
vagrant.provision
|
27
|
+
end
|
26
28
|
end
|
27
29
|
|
28
30
|
context 'Correct vagrant configuration' do
|
29
|
-
|
30
|
-
FakeFS
|
31
|
-
|
31
|
+
subject do
|
32
|
+
FakeFS do
|
33
|
+
vagrant.make_vfile( hosts, options )
|
34
|
+
File.read(vagrant.instance_variable_get(:@vagrant_file))
|
35
|
+
end
|
36
|
+
end
|
32
37
|
|
33
|
-
|
34
|
-
|
38
|
+
it 'has a provider section' do
|
39
|
+
is_expected.to include( %Q{ v.vm.provider :libvirt do |node|})
|
35
40
|
end
|
36
41
|
|
37
|
-
it "
|
38
|
-
|
42
|
+
it "has no private network" do
|
43
|
+
is_expected.not_to include('v.vm.network :private_network')
|
39
44
|
end
|
40
45
|
|
41
46
|
it "can specify the memory as an integer" do
|
42
|
-
|
43
|
-
.to include('node.memory = 1024')
|
47
|
+
is_expected.to include('node.memory = 1024')
|
44
48
|
end
|
45
49
|
|
46
50
|
it "can specify the number of cpus" do
|
47
|
-
|
48
|
-
.to include("node.cpus = 2")
|
51
|
+
is_expected.to include("node.cpus = 2")
|
49
52
|
end
|
50
53
|
|
51
54
|
it "can specify any libvirt option" do
|
52
|
-
|
53
|
-
.to include("node.uri = 'qemu+ssh://root@host/system'")
|
54
|
-
end
|
55
|
-
|
56
|
-
it "has a mac address in the proper format" do
|
57
|
-
expect( @vagrantfile.split("\n").map(&:strip) )
|
58
|
-
.to include(/:mac => "08:00:27:\h{2}:\h{2}:\h{2}"/)
|
55
|
+
is_expected.to include("node.uri = 'qemu+ssh://root@host/system'")
|
59
56
|
end
|
60
57
|
end
|
61
58
|
end
|
@@ -2,43 +2,40 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Beaker::VagrantParallels do
|
4
4
|
let( :options ) { make_opts.merge({ :hosts_file => 'sample.cfg', 'logger' => double().as_null_object }) }
|
5
|
-
let( :vagrant ) { Beaker::VagrantParallels.new(
|
6
|
-
|
7
|
-
before :each do
|
8
|
-
@hosts = make_hosts()
|
9
|
-
end
|
5
|
+
let( :vagrant ) { Beaker::VagrantParallels.new( hosts, options ) }
|
6
|
+
let( :hosts ) { make_hosts }
|
10
7
|
|
11
8
|
it "uses the parallels provider for provisioning" do
|
12
|
-
|
9
|
+
hosts.each do |host|
|
13
10
|
host_prev_name = host['user']
|
14
11
|
expect( vagrant ).to receive( :set_ssh_config ).with( host, 'vagrant' ).once
|
15
12
|
expect( vagrant ).to receive( :copy_ssh_to_root ).with( host, options ).once
|
16
13
|
expect( vagrant ).to receive( :set_ssh_config ).with( host, host_prev_name ).once
|
17
14
|
end
|
18
|
-
expect( vagrant ).to receive( :hack_etc_hosts ).with(
|
15
|
+
expect( vagrant ).to receive( :hack_etc_hosts ).with( hosts, options ).once
|
19
16
|
expect( vagrant ).to receive( :vagrant_cmd ).with( "up --provider parallels" ).once
|
20
17
|
vagrant.provision
|
21
18
|
end
|
22
19
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
20
|
+
context 'Correct vagrant configuration' do
|
21
|
+
subject do
|
22
|
+
FakeFS do
|
23
|
+
vagrant.make_vfile( hosts, options )
|
24
|
+
File.read(vagrant.instance_variable_get(:@vagrant_file))
|
25
|
+
end
|
26
|
+
end
|
28
27
|
|
29
|
-
|
30
|
-
|
28
|
+
it "can make a Vagrantfile for a set of hosts" do
|
29
|
+
is_expected.to include( %Q{ v.vm.provider :parallels do |prl|\n prl.optimize_power_consumption = false\n prl.memory = '1024'\n end})
|
30
|
+
end
|
31
31
|
end
|
32
32
|
|
33
|
-
|
34
|
-
options.merge
|
35
|
-
|
36
|
-
vfile_section = vagrant.class.provider_vfile_section( @hosts.first, options )
|
37
|
-
|
38
|
-
match = vfile_section.match(/prl.update_guest_tools = false/)
|
39
|
-
|
40
|
-
expect( match ).to_not be nil
|
33
|
+
context 'disabled guest tools' do
|
34
|
+
let(:options) { super().merge({ :prl_update_guest_tools => 'disable' }) }
|
35
|
+
subject { vagrant.class.provider_vfile_section( hosts.first, options ) }
|
41
36
|
|
37
|
+
it "can disable the auto-update functionality of the Parallels Guest Tools" do
|
38
|
+
is_expected.to match(/prl.update_guest_tools = false/)
|
39
|
+
end
|
42
40
|
end
|
43
|
-
|
44
41
|
end
|
@@ -30,7 +30,6 @@ module Beaker
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it "stores the vagrant file in $WORKINGDIR/.vagrant/beaker_vagrant_files/beaker_sample.cfg" do
|
33
|
-
allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
|
34
33
|
path = vagrant.instance_variable_get( :@vagrant_path )
|
35
34
|
|
36
35
|
expect( path ).to be === File.join(Dir.pwd, '.vagrant', 'beaker_vagrant_files', 'beaker_sample.cfg')
|
@@ -39,7 +38,6 @@ module Beaker
|
|
39
38
|
|
40
39
|
it "can make a Vagrantfile for a set of hosts" do
|
41
40
|
path = vagrant.instance_variable_get( :@vagrant_path )
|
42
|
-
allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
|
43
41
|
|
44
42
|
vagrant.make_vfile( @hosts )
|
45
43
|
|
@@ -53,7 +51,7 @@ Vagrant.configure("2") do |c|
|
|
53
51
|
v.vm.box = 'vm2vm1_of_my_box'
|
54
52
|
v.vm.box_url = 'http://address.for.my.box.vm1'
|
55
53
|
v.vm.box_check_update = 'true'
|
56
|
-
v.vm.network :private_network, ip: "ip.address.for.vm1", :netmask => "255.255.0.0"
|
54
|
+
v.vm.network :private_network, ip: "ip.address.for.vm1", :netmask => "255.255.0.0"
|
57
55
|
v.vm.synced_folder './', '/temp', create: true
|
58
56
|
v.vm.synced_folder '../', '/tmp', create: true
|
59
57
|
v.vm.network :forwarded_port, guest: 80, host: 10080
|
@@ -68,7 +66,7 @@ Vagrant.configure("2") do |c|
|
|
68
66
|
v.vm.box = 'vm2vm2_of_my_box'
|
69
67
|
v.vm.box_url = 'http://address.for.my.box.vm2'
|
70
68
|
v.vm.box_check_update = 'true'
|
71
|
-
v.vm.network :private_network, ip: "ip.address.for.vm2", :netmask => "255.255.0.0"
|
69
|
+
v.vm.network :private_network, ip: "ip.address.for.vm2", :netmask => "255.255.0.0"
|
72
70
|
v.vm.synced_folder './', '/temp', create: true
|
73
71
|
v.vm.synced_folder '../', '/tmp', create: true
|
74
72
|
v.vm.network :forwarded_port, guest: 80, host: 10080
|
@@ -83,7 +81,7 @@ Vagrant.configure("2") do |c|
|
|
83
81
|
v.vm.box = 'vm2vm3_of_my_box'
|
84
82
|
v.vm.box_url = 'http://address.for.my.box.vm3'
|
85
83
|
v.vm.box_check_update = 'true'
|
86
|
-
v.vm.network :private_network, ip: "ip.address.for.vm3", :netmask => "255.255.0.0"
|
84
|
+
v.vm.network :private_network, ip: "ip.address.for.vm3", :netmask => "255.255.0.0"
|
87
85
|
v.vm.synced_folder './', '/temp', create: true
|
88
86
|
v.vm.synced_folder '../', '/tmp', create: true
|
89
87
|
v.vm.network :forwarded_port, guest: 80, host: 10080
|
@@ -99,7 +97,6 @@ EOF
|
|
99
97
|
|
100
98
|
it "can make a Vagrantfile with ssh agent forwarding enabled" do
|
101
99
|
path = vagrant.instance_variable_get( :@vagrant_path )
|
102
|
-
allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
|
103
100
|
|
104
101
|
hosts = make_hosts({},1)
|
105
102
|
vagrant.make_vfile( hosts, options )
|
@@ -110,7 +107,6 @@ EOF
|
|
110
107
|
|
111
108
|
it "can replace underscores in host.name with hypens" do
|
112
109
|
path = vagrant.instance_variable_get( :@vagrant_path )
|
113
|
-
allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
|
114
110
|
|
115
111
|
host = make_host( 'name-with_underscore', {} )
|
116
112
|
vagrant.make_vfile( [host,], options )
|
@@ -122,7 +118,6 @@ EOF
|
|
122
118
|
|
123
119
|
it "can make a Vagrantfile with synced_folder disabled" do
|
124
120
|
path = vagrant.instance_variable_get( :@vagrant_path )
|
125
|
-
allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
|
126
121
|
|
127
122
|
hosts = make_hosts({:synced_folder => 'disabled'},1)
|
128
123
|
vagrant.make_vfile( hosts, options )
|
@@ -131,16 +126,6 @@ EOF
|
|
131
126
|
expect( vagrantfile ).to match(/v.vm.synced_folder .* disabled: true/)
|
132
127
|
end
|
133
128
|
|
134
|
-
it "can make a Vagrantfile with network mac autogenerated" do
|
135
|
-
path = vagrant.instance_variable_get( :@vagrant_path )
|
136
|
-
|
137
|
-
hosts = make_hosts({},1)
|
138
|
-
vagrant.make_vfile( hosts, options )
|
139
|
-
|
140
|
-
vagrantfile = File.read( File.expand_path( File.join( path, "Vagrantfile")))
|
141
|
-
expect( vagrantfile ).to match(/v.vm.network :private_network, ip: "ip.address.for.vm1", :netmask => "255.255.0.0", :mac => ".+/)
|
142
|
-
end
|
143
|
-
|
144
129
|
it "can make a Vagrantfile with network mac specified" do
|
145
130
|
path = vagrant.instance_variable_get( :@vagrant_path )
|
146
131
|
|
@@ -151,16 +136,6 @@ EOF
|
|
151
136
|
expect( vagrantfile ).to match(/v.vm.network :private_network, ip: "ip.address.for.vm1", :netmask => "255.255.0.0", :mac => "b6:33:ae:19:48:f9/)
|
152
137
|
end
|
153
138
|
|
154
|
-
it "can make a Vagrantfile with network mac disabled" do
|
155
|
-
path = vagrant.instance_variable_get( :@vagrant_path )
|
156
|
-
|
157
|
-
hosts = make_hosts({:network_mac => 'false'},1)
|
158
|
-
vagrant.make_vfile( hosts, options )
|
159
|
-
|
160
|
-
vagrantfile = File.read( File.expand_path( File.join( path, "Vagrantfile")))
|
161
|
-
expect( vagrantfile ).to match(/v.vm.network :private_network, ip: "ip.address.for.vm1", :netmask => "255.255.0.0"/)
|
162
|
-
end
|
163
|
-
|
164
139
|
it "can make a Vagrantfile with improper keys for synced folders" do
|
165
140
|
path = vagrant.instance_variable_get( :@vagrant_path )
|
166
141
|
|
@@ -182,7 +157,6 @@ EOF
|
|
182
157
|
|
183
158
|
it "can make a Vagrantfile with optional shell provisioner" do
|
184
159
|
path = vagrant.instance_variable_get( :@vagrant_path )
|
185
|
-
allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
|
186
160
|
|
187
161
|
shell_path = '/path/to/shell/script'
|
188
162
|
hosts = make_hosts({
|
@@ -198,7 +172,6 @@ EOF
|
|
198
172
|
|
199
173
|
it "can make a Vagrantfile with optional shell provisioner with args" do
|
200
174
|
path = vagrant.instance_variable_get( :@vagrant_path )
|
201
|
-
allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
|
202
175
|
|
203
176
|
shell_path = '/path/to/shell/script.sh'
|
204
177
|
shell_args = 'arg1 arg2'
|
@@ -216,7 +189,6 @@ EOF
|
|
216
189
|
|
217
190
|
it "raises an error if path is not set on shell_provisioner" do
|
218
191
|
path = vagrant.instance_variable_get( :@vagrant_path )
|
219
|
-
allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
|
220
192
|
|
221
193
|
hosts = make_hosts({:shell_provisioner => {}}, 1)
|
222
194
|
expect{ vagrant.make_vfile( hosts, options ) }.to raise_error RuntimeError, /No path defined for shell_provisioner or path empty/
|
@@ -224,7 +196,6 @@ EOF
|
|
224
196
|
|
225
197
|
it "raises an error if path is EMPTY on shell_provisioner" do
|
226
198
|
path = vagrant.instance_variable_get( :@vagrant_path )
|
227
|
-
allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
|
228
199
|
|
229
200
|
empty_shell_path = ''
|
230
201
|
hosts = make_hosts({
|
@@ -238,7 +209,6 @@ EOF
|
|
238
209
|
context "when generating a windows config" do
|
239
210
|
before do
|
240
211
|
path = vagrant.instance_variable_get( :@vagrant_path )
|
241
|
-
allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
|
242
212
|
@hosts[0][:platform] = 'windows'
|
243
213
|
|
244
214
|
vagrant.make_vfile( @hosts )
|
@@ -270,7 +240,6 @@ EOF
|
|
270
240
|
context 'when generating a freebsd config' do
|
271
241
|
before do
|
272
242
|
path = vagrant.instance_variable_get( :@vagrant_path )
|
273
|
-
allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
|
274
243
|
@hosts[0][:platform] = 'freebsd'
|
275
244
|
|
276
245
|
vagrant.make_vfile( @hosts )
|
@@ -285,15 +254,10 @@ EOF
|
|
285
254
|
it 'has the proper guest setting' do
|
286
255
|
expect( @generated_file ).to match /v.vm.guest = :freebsd\n/
|
287
256
|
end
|
288
|
-
|
289
|
-
it 'sets the vm.base_mac setting' do
|
290
|
-
expect( @generated_file ).to match /v.vm.base_mac = '0123456789'\n/
|
291
|
-
end
|
292
257
|
end
|
293
258
|
|
294
259
|
it "uses the memsize defined per vagrant host" do
|
295
260
|
path = vagrant.instance_variable_get( :@vagrant_path )
|
296
|
-
allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
|
297
261
|
|
298
262
|
vagrant.make_vfile( @hosts, {'vagrant_memsize' => 'hello!'} )
|
299
263
|
|
@@ -307,7 +271,6 @@ EOF
|
|
307
271
|
|
308
272
|
it "uses the cpus defined per vagrant host" do
|
309
273
|
path = vagrant.instance_variable_get( :@vagrant_path )
|
310
|
-
allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
|
311
274
|
|
312
275
|
vagrant.make_vfile( @hosts, {'vagrant_cpus' => 'goodbye!'} )
|
313
276
|
|
@@ -322,7 +285,6 @@ EOF
|
|
322
285
|
context "port forwarding rules" do
|
323
286
|
it "supports all Vagrant parameters" do
|
324
287
|
path = vagrant.instance_variable_get( :@vagrant_path )
|
325
|
-
allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
|
326
288
|
|
327
289
|
hosts = make_hosts(
|
328
290
|
{
|
@@ -344,7 +306,6 @@ EOF
|
|
344
306
|
|
345
307
|
it "supports supports from_ip" do
|
346
308
|
path = vagrant.instance_variable_get( :@vagrant_path )
|
347
|
-
allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
|
348
309
|
|
349
310
|
hosts = make_hosts(
|
350
311
|
{
|
@@ -364,7 +325,6 @@ EOF
|
|
364
325
|
|
365
326
|
it "supports all to_ip" do
|
366
327
|
path = vagrant.instance_variable_get( :@vagrant_path )
|
367
|
-
allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
|
368
328
|
|
369
329
|
hosts = make_hosts(
|
370
330
|
{
|
@@ -384,7 +344,6 @@ EOF
|
|
384
344
|
|
385
345
|
it "supports all protocol" do
|
386
346
|
path = vagrant.instance_variable_get( :@vagrant_path )
|
387
|
-
allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
|
388
347
|
|
389
348
|
hosts = make_hosts(
|
390
349
|
{
|
@@ -451,57 +410,57 @@ EOF
|
|
451
410
|
end
|
452
411
|
|
453
412
|
describe "set_ssh_config" do
|
454
|
-
let( :out )
|
413
|
+
let( :out ) do
|
414
|
+
<<-CONFIG
|
415
|
+
Host #{name}
|
416
|
+
HostName 127.0.0.1
|
417
|
+
User vagrant
|
418
|
+
Port 2222
|
419
|
+
UserKnownHostsFile /dev/null
|
420
|
+
StrictHostKeyChecking no
|
421
|
+
PasswordAuthentication no
|
422
|
+
IdentityFile /home/root/.vagrant.d/insecure_private_key
|
423
|
+
IdentitiesOnly yes
|
424
|
+
CONFIG
|
425
|
+
end
|
455
426
|
let( :host ) { @hosts[0] }
|
456
427
|
let( :name ) { host.name }
|
457
|
-
let( :
|
428
|
+
let( :override_options ) { {} }
|
458
429
|
|
459
430
|
before :each do
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
431
|
+
# FakeFS is just broken with Tempfile
|
432
|
+
FakeFS.deactivate!
|
433
|
+
Dir.mktmpdir do |dir|
|
434
|
+
vagrant.instance_variable_get(:@options).merge!(override_options)
|
435
|
+
vagrant.instance_variable_set(:@vagrant_path, dir)
|
436
|
+
state = double( 'state' )
|
437
|
+
allow( state ).to receive( :success? ).and_return( true )
|
438
|
+
allow( Open3 ).to receive( :capture3 ).with( {"RUBYLIB"=>"", "RUBYOPT"=>""}, 'vagrant', 'ssh-config', name ).and_return( [ out, "", state ])
|
467
439
|
|
468
|
-
|
469
|
-
|
440
|
+
vagrant.set_ssh_config( host, 'root' )
|
441
|
+
end
|
442
|
+
end
|
470
443
|
|
471
|
-
|
472
|
-
|
473
|
-
User vagrant
|
474
|
-
Port 2222
|
475
|
-
UserKnownHostsFile /dev/null
|
476
|
-
StrictHostKeyChecking no
|
477
|
-
PasswordAuthentication no
|
478
|
-
IdentityFile /home/root/.vagrant.d/insecure_private_key
|
479
|
-
IdentitiesOnly yes")
|
444
|
+
it 'sets the user to root' do
|
445
|
+
expect(host['user']).to be === 'root'
|
480
446
|
end
|
481
447
|
|
482
|
-
it
|
483
|
-
|
484
|
-
|
448
|
+
it 'sets the ssh user to root' do
|
449
|
+
expect(host['ssh']['user']).to be === 'root'
|
450
|
+
end
|
485
451
|
|
486
|
-
|
487
|
-
|
488
|
-
expect(
|
489
|
-
expect( host['user']).to be === 'root'
|
452
|
+
# This is because forward_ssh_agent is true by default
|
453
|
+
it 'sets IdentitiesOnly to no' do
|
454
|
+
expect(host['ssh'][:keys_only]).to be === false
|
490
455
|
end
|
491
456
|
|
492
457
|
context "when :forward_ssh_agent is false" do
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
options = vagrant.instance_variable_set( :@options, options )
|
497
|
-
|
498
|
-
expect( Tempfile ).to receive( :new ).with( "#{host.name}").and_return( file )
|
499
|
-
expect( file ).to receive( :write ).with("Host ip.address.for.#{name}\n HostName 127.0.0.1\n User root\n Port 2222\n UserKnownHostsFile /dev/null\n StrictHostKeyChecking no\n PasswordAuthentication no\n IdentityFile /home/root/.vagrant.d/insecure_private_key\n IdentitiesOnly yes")
|
458
|
+
let(:override_options) do
|
459
|
+
{forward_ssh_agent: false}
|
460
|
+
end
|
500
461
|
|
501
|
-
|
502
|
-
expect( host[:
|
503
|
-
expect( host['ssh'][:config]).to be === false
|
504
|
-
expect( host['user']).to be === 'root'
|
462
|
+
it "should keep IdentitiesOnly to yes" do
|
463
|
+
expect( host['ssh'][:keys_only]).to be === true
|
505
464
|
end
|
506
465
|
end
|
507
466
|
end
|
@@ -515,17 +474,6 @@ EOF
|
|
515
474
|
end
|
516
475
|
end
|
517
476
|
|
518
|
-
it 'calls #get_ip_from_vagrant_file' do
|
519
|
-
vagrant.make_vfile(@hosts)
|
520
|
-
|
521
|
-
@hosts.each do |host|
|
522
|
-
allow(vagrant).to receive(:set_ssh_config).with(host, anything)
|
523
|
-
expect(vagrant).to receive(:get_ip_from_vagrant_file).with(host.name)
|
524
|
-
end
|
525
|
-
|
526
|
-
vagrant.configure
|
527
|
-
end
|
528
|
-
|
529
477
|
it 'calls #set_all_ssh_config' do
|
530
478
|
vagrant.make_vfile(@hosts)
|
531
479
|
expect(vagrant).to receive(:set_all_ssh_config)
|
@@ -569,31 +517,6 @@ EOF
|
|
569
517
|
end
|
570
518
|
end
|
571
519
|
|
572
|
-
describe "get_ip_from_vagrant_file" do
|
573
|
-
before :each do
|
574
|
-
allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
|
575
|
-
vagrant.make_vfile( @hosts )
|
576
|
-
end
|
577
|
-
|
578
|
-
it "can find the correct ip for the provided hostname" do
|
579
|
-
@hosts.each do |host|
|
580
|
-
expect( vagrant.get_ip_from_vagrant_file(host.name) ).to be === host[:ip]
|
581
|
-
end
|
582
|
-
|
583
|
-
end
|
584
|
-
|
585
|
-
it "returns nil if it is unable to find an ip" do
|
586
|
-
expect( vagrant.get_ip_from_vagrant_file("unknown") ).to be_nil
|
587
|
-
end
|
588
|
-
|
589
|
-
it "raises an error if no Vagrantfile is present" do
|
590
|
-
File.delete( vagrant.instance_variable_get( :@vagrant_file ) )
|
591
|
-
@hosts.each do |host|
|
592
|
-
expect{ vagrant.get_ip_from_vagrant_file(host.name) }.to raise_error RuntimeError, /No vagrant file found/
|
593
|
-
end
|
594
|
-
end
|
595
|
-
end
|
596
|
-
|
597
520
|
describe "provisioning and cleanup" do
|
598
521
|
|
599
522
|
before :each do
|