beaker-vagrant 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0507afd930ed4038b5828c44deaba498093bce5
4
- data.tar.gz: 2936af72e1c7ca90377b1179ec783fc2257ff697
3
+ metadata.gz: d84392a96de3ef88f5b20f1ecb2eb5ec74afdb55
4
+ data.tar.gz: 5b1b20587489bfd00f891071dbb21c8322baafe4
5
5
  SHA512:
6
- metadata.gz: 4b513ccb24fcdd1f0dd5fb13c4779629d0b913988398fbab3bf69bb48ec181678ff50c3d2ed3e26209588c42fd3454ec5204ba52a4534faf0c2b114c6e108928
7
- data.tar.gz: 423b6c4bff4c7561750f38017986a682327d37563bc99737a1351ee2363ac7d9918f14357cadf423c37add92bfef912508b96b8745c8f58c6366b020a8784b91
6
+ metadata.gz: c572ba506cdd9bbe3daffb77ac24c13a86b808bfb2c7c47e4dfcce244d80094ef13ecb7dc346f4cf22aa78f55ca7c35f36844cbd4f8bbf5d603dd4bdc2ebd756
7
+ data.tar.gz: d53012692dfbda60846694697c948a499d1685c47c5dd94ff7a85a0f69601758a2a998fa552c084e67e52417d35f630bead60e61904d035a16153e55c0d0eac7
data/README.md CHANGED
@@ -6,16 +6,22 @@ Beaker library to use vagrant hypervisor
6
6
 
7
7
  This is a gem that allows you to use hosts with [vagrant](docs/vagrant.md) hypervisor with [beaker](https://github.com/puppetlabs/beaker).
8
8
 
9
- ### Right Now? (beaker 3.x)
9
+ ## With Beaker 3.x
10
10
 
11
- This gem is already included as [beaker dependency](https://github.com/puppetlabs/beaker/blob/master/beaker.gemspec) for you, so you don't need to do anything special to use this gem's functionality with beaker.
11
+ This library is included as a dependency of Beaker 3.x versions, so there's nothing to do.
12
12
 
13
- ### In beaker's Next Major Version? (beaker 4.x)
13
+ ## With Beaker 4.x
14
14
 
15
- In beaker's next major version, the requirement for beaker-vagrant will be pulled
16
- from that repo. When that happens, then the usage pattern will change. In order
17
- to use this then, you'll need to include beaker-vagrant as a dependency right
18
- next to beaker itself.
15
+ As of Beaker 4.0, all hypervisor and DSL extension libraries have been removed and are no longer dependencies. In order to use a specific hypervisor or DSL extension library in your project, you will need to include them alongside Beaker in your Gemfile or project.gemspec. E.g.
16
+
17
+ ~~~ruby
18
+ # Gemfile
19
+ gem 'beaker', '~>4.0'
20
+ gem 'beaker-vagrant'
21
+ # project.gemspec
22
+ s.add_runtime_dependency 'beaker', '~>4.0'
23
+ s.add_runtime_dependency 'beaker-vagrant'
24
+ ~~~
19
25
 
20
26
  # Spec tests
21
27
 
@@ -7,18 +7,18 @@ HOSTS:
7
7
  - databse
8
8
  - classifier
9
9
  - default
10
- platform: el-7-x86_64
10
+ platform: el-7-x86_64
11
11
  template: redhat-7-x86_64
12
- box: puppetlabs/centos-7.0-64-nocm
13
- box_url: https://vagrantcloud.com/puppetlabs/boxes/centos-7.0-64-nocm
12
+ box: centos/7
13
+ box_url: https://app.vagrantup.com/centos/boxes/7
14
14
  hypervisor: vagrant
15
15
  redhat7-64-2:
16
16
  roles:
17
17
  - agent
18
18
  platform: el-7-x86_64
19
19
  template: redhat-7-x86_64
20
- box: puppetlabs/centos-7.0-64-nocm
21
- box_url: https://vagrantcloud.com/puppetlabs/boxes/centos-7.0-64-nocm
20
+ box: centos/7
21
+ box_url: https://app.vagrantup.com/centos/boxes/7
22
22
  hypervisor: vagrant
23
23
  CONFIG:
24
24
  nfs_server: none
@@ -20,7 +20,12 @@ Gem::Specification.new do |s|
20
20
  # Testing dependencies
21
21
  s.add_development_dependency 'rspec', '~> 3.0'
22
22
  s.add_development_dependency 'rspec-its'
23
- s.add_development_dependency 'fakefs', '~> 0.6'
23
+ # pin fakefs for Ruby < 2.3
24
+ if RUBY_VERSION < "2.3"
25
+ s.add_development_dependency 'fakefs', '~> 0.6', '< 0.14'
26
+ else
27
+ s.add_development_dependency 'fakefs', '~> 0.6'
28
+ end
24
29
  s.add_development_dependency 'rake', '~> 10.1'
25
30
  s.add_development_dependency 'simplecov'
26
31
  s.add_development_dependency 'pry', '~> 0.10'
@@ -1,21 +1,29 @@
1
1
  # Vagrant
2
2
 
3
- Vagrant's slogan is "development environments made easy". They provide an
3
+ Vagrant's slogan is "development environments made easy". Vagrant provides an
4
4
  abstraction on top of a VM or cloud provider that allows you to manage
5
- hosts and their provisioning. [Their Site](https://www.vagrantup.com/).
5
+ hosts and their provisioning. <https://www.vagrantup.com/>.
6
6
 
7
- # Getting Started
7
+ ## Getting Started
8
8
 
9
9
  ### Requirements
10
10
 
11
11
  A prerequisite for using the vagrant hypervisor with beaker is that the
12
- **Vagrant 1.7+** package needs to installed -
13
- see [downloads.vagrantup.com](http://downloads.vagrantup.com/) for downloads.
12
+ `Vagrant` package, minimum version 1.7, needs to installed. Version 2.1.2 (latest as of time of writing) has been tested. See [downloads.vagrantup.com](http://downloads.vagrantup.com/) for downloads or install with Homebrew:
14
13
 
15
- Currently, we provide a suite of pre-built, publicly available vagrant boxes for
16
- use in constructing tests: [Puppet Labs Vagrant Boxes](https://vagrantcloud.com/puppetlabs/).
17
- You can use these boxes easily by pulling one of our
18
- [Example Vagrant Hosts Files](vagrant_hosts_file_examples.md).
14
+ ~~~console
15
+ $ brew install cask vagrant
16
+ ~~~
17
+
18
+ You will also need a virtualization provider. Beaker-vagrant is most commonly used as an interface to VirtualBox, so you'll also need that:
19
+
20
+ ~~~console
21
+ $ brew install cask virtualbox
22
+ ~~~
23
+
24
+ Historically, we provided a suite of pre-built, publicly available Vagrant boxes for use in constructing tests: [Puppet Labs Vagrant Boxes](https://vagrantcloud.com/puppetlabs/). However, these boxes have not been updated recently and *will* have issues (ex: outdated cURL on CentOS). You can use these easily by pulling one of our [Example Vagrant Hosts Files](vagrant_hosts_file_examples.md), but this should be avoided if possible.
25
+
26
+ For acceptance testing of beaker-vagrant, we use [the official CentOS 7 box](https://app.vagrantup.com/centos/boxes/7).
19
27
 
20
28
  ### Setup a Vagrant Hosts File
21
29
 
@@ -180,6 +188,29 @@ When using the Vagrant Hypervisor, beaker can create attached volumes which appe
180
188
  size: 5120
181
189
  volume_storage_controller: USB
182
190
 
191
+ ### Adding vagrant shell provisioner
192
+
193
+ When using the Vagrant Hypervisor, beaker can create the Vagrantfile with a shell provisioner. This is done by using the `shell_provisioner` option in the nodeset file.
194
+
195
+ **Example hosts file**
196
+
197
+ HOSTS:
198
+ ubuntu-1404-x64-master:
199
+ roles:
200
+ - master
201
+ - agent
202
+ - dashboard
203
+ - database
204
+ platform: ubuntu-1404-x86_64
205
+ hypervisor: vagrant
206
+ box: puppetlabs/ubuntu-14.04-64-nocm
207
+ box_url: https://vagrantcloud.com/puppetlabs/boxes/ubuntu-14.04-64-nocm
208
+ ip: 192.168.20.20
209
+ shell_provisioner:
210
+ path: /home/user/scripts/bootstrap.sh
211
+
212
+ In the above, beaker will create a Vagrantfile which runs the above shell script on the Agent guest.
213
+
183
214
  # vagrant plugins #
184
215
 
185
216
  You can check more information for some suported vagrant plugins:
@@ -1,3 +1,3 @@
1
1
  module BeakerVagrant
2
- VERSION = '0.5.0'
2
+ VERSION = '0.6.0'
3
3
  end
@@ -35,6 +35,19 @@ module Beaker
35
35
  end
36
36
  end
37
37
 
38
+ def shell_provisioner_generator(provisioner_config)
39
+ unless provisioner_config['path'].nil? || provisioner_config['path'].empty?
40
+ unless provisioner_config['args'].nil?
41
+ shell_provisioner_string = " v.vm.provision 'shell', :path => '#{provisioner_config['path']}', :args => '#{provisioner_config['args']}' \n"
42
+ else
43
+ shell_provisioner_string = " v.vm.provision 'shell', :path => '#{provisioner_config['path']}'\n"
44
+ end
45
+ shell_provisioner_string
46
+ else
47
+ raise "No path defined for shell_provisioner or path empty"
48
+ end
49
+ end
50
+
38
51
  def make_vfile hosts, options = {}
39
52
  #HACK HACK HACK - add checks here to ensure that we have box + box_url
40
53
  #generate the VagrantFile
@@ -53,6 +66,7 @@ module Beaker
53
66
  v_file << " v.vm.box_download_insecure = '#{host['box_download_insecure']}'\n" unless host['box_download_insecure'].nil?
54
67
  v_file << " v.vm.box_check_update = '#{host['box_check_update'] ||= 'true'}'\n"
55
68
  v_file << " v.vm.synced_folder '.', '/vagrant', disabled: true\n" if host['synced_folder'] == 'disabled'
69
+ v_file << shell_provisioner_generator(host['shell_provisioner']) if host['shell_provisioner']
56
70
  v_file << private_network_generator(host)
57
71
 
58
72
  unless host['mount_folders'].nil?
@@ -131,6 +145,32 @@ module Beaker
131
145
  Beaker::VagrantVirtualbox.provider_vfile_section(host, options)
132
146
  end
133
147
 
148
+ def set_all_ssh_config
149
+ @logger.debug "configure vagrant boxes (set ssh-config, switch to root user, hack etc/hosts)"
150
+ @hosts.each do |host|
151
+ if host[:platform] =~ /windows/
152
+ @logger.debug "skip ssh hacks on windows box #{host[:name]}"
153
+ set_ssh_config host, host['user']
154
+ next
155
+ end
156
+
157
+ default_user = host['user']
158
+
159
+ set_ssh_config host, 'vagrant'
160
+
161
+ #copy vagrant's keys to roots home dir, to allow for login as root
162
+ copy_ssh_to_root host, @options
163
+ #ensure that root login is enabled for this host
164
+ enable_root_login host, @options
165
+ #shut down connection, will reconnect on next exec
166
+ host.close
167
+
168
+ set_ssh_config host, default_user
169
+ end
170
+
171
+ hack_etc_hosts @hosts, @options
172
+ end
173
+
134
174
  def set_ssh_config host, user
135
175
  f = Tempfile.new("#{host.name}")
136
176
  ssh_config = Dir.chdir(@vagrant_path) do
@@ -145,6 +185,11 @@ module Beaker
145
185
 
146
186
  #set the user
147
187
  ssh_config = ssh_config.gsub(/User vagrant/, "User #{user}")
188
+
189
+ if @options[:forward_ssh_agent] == true
190
+ ssh_config = ssh_config.gsub(/IdentitiesOnly yes/, "IdentitiesOnly no")
191
+ end
192
+
148
193
  f.write(ssh_config)
149
194
  f.rewind
150
195
  host['ssh'] = {:config => f.path()}
@@ -182,65 +227,46 @@ module Beaker
182
227
  @vagrant_env = { "RUBYLIB" => "" }
183
228
  end
184
229
 
185
- def provision(provider = nil)
186
- if !@options[:provision] and !File.file?(@vagrant_file)
187
- raise "Beaker is configured with provision = false but no vagrant file was found at #{@vagrant_file}. You need to enable provision"
188
- end
189
- if @options[:provision]
190
- #setting up new vagrant hosts
191
- #make sure that any old boxes are dead dead dead
192
- begin
193
- vagrant_cmd("destroy --force") if File.file?(@vagrant_file)
194
- rescue RuntimeError => e
195
- # LATER: use <<~MESSAGE once we're on Ruby 2.3
196
- @logger.debug(%Q{
197
- Beaker failed to destroy the existing VM's. If you think this is
198
- an error or you upgraded from an older version of beaker try
199
- verifying the VM exists and deleting the existing Vagrantfile if
200
- you believe it is safe to do so. WARNING: If a VM still exists
201
- please run 'vagrant destroy'.
202
-
203
- cd #{@vagrant_path}
204
- vagrant status
205
- vagrant destroy # only need to run this is a VM is not created
206
- rm #{@vagrant_file} # only do this if all VM's are actually destroyed
207
- }.each_line.map(&:strip).join("\n"))
208
- raise e
230
+ def configure(opts = {})
231
+ if !@options[:provision]
232
+ if !File.file?(@vagrant_file)
233
+ raise "Beaker is configured with provision = false but no vagrant file was found at #{@vagrant_file}. You need to enable provision"
209
234
  end
210
235
 
211
- make_vfile @hosts, @options
212
-
213
- vagrant_cmd("up#{" --provider #{provider}" if provider}")
214
- else #set host ip of already up boxes
215
236
  @hosts.each do |host|
216
237
  host[:ip] = get_ip_from_vagrant_file(host.name)
217
238
  end
218
- end
219
-
220
- @logger.debug "configure vagrant boxes (set ssh-config, switch to root user, hack etc/hosts)"
221
- @hosts.each do |host|
222
- if host[:platform] =~ /windows/
223
- @logger.debug "skip ssh hacks on windows box #{host[:name]}"
224
- set_ssh_config host, host['user']
225
- next
226
- end
227
239
 
228
- default_user = host['user']
229
-
230
- set_ssh_config host, 'vagrant'
231
-
232
- #copy vagrant's keys to roots home dir, to allow for login as root
233
- copy_ssh_to_root host, @options
234
- #ensure that root login is enabled for this host
235
- enable_root_login host, @options
236
- #shut down connection, will reconnect on next exec
237
- host.close
240
+ set_all_ssh_config
241
+ end
242
+ end
238
243
 
239
- set_ssh_config host, default_user
244
+ def provision(provider = nil)
245
+ #setting up new vagrant hosts
246
+ #make sure that any old boxes are dead dead dead
247
+ begin
248
+ vagrant_cmd("destroy --force") if File.file?(@vagrant_file)
249
+ rescue RuntimeError => e
250
+ # LATER: use <<~MESSAGE once we're on Ruby 2.3
251
+ @logger.debug(%Q{
252
+ Beaker failed to destroy the existing VM's. If you think this is
253
+ an error or you upgraded from an older version of beaker try
254
+ verifying the VM exists and deleting the existing Vagrantfile if
255
+ you believe it is safe to do so. WARNING: If a VM still exists
256
+ please run 'vagrant destroy'.
257
+ cd #{@vagrant_path}
258
+ vagrant status
259
+ vagrant destroy # only need to run this is a VM is not created
260
+ rm #{@vagrant_file} # only do this if all VM's are actually destroyed
261
+ }.each_line.map(&:strip).join("\n"))
262
+ raise e
240
263
  end
241
264
 
242
- hack_etc_hosts @hosts, @options
265
+ make_vfile @hosts, @options
266
+
267
+ vagrant_cmd("up#{" --provider #{provider}" if provider}")
243
268
 
269
+ set_all_ssh_config
244
270
  end
245
271
 
246
272
  def cleanup
@@ -178,6 +178,61 @@ EOF
178
178
  expect( vagrantfile ).to match(/v.vm.synced_folder '\/valid', '\/valid', create: true/)
179
179
  end
180
180
 
181
+ it "can make a Vagrantfile with optional shell provisioner" do
182
+ path = vagrant.instance_variable_get( :@vagrant_path )
183
+ allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
184
+
185
+ shell_path = '/path/to/shell/script'
186
+ hosts = make_hosts({
187
+ :shell_provisioner => {
188
+ :path => shell_path
189
+ }
190
+ }, 1)
191
+ vagrant.make_vfile( hosts, options )
192
+
193
+ vagrantfile = File.read( File.expand_path( File.join( path, "Vagrantfile")))
194
+ expect( vagrantfile ).to match(/v.vm.provision 'shell', :path => '#{shell_path}'/)
195
+ end
196
+
197
+ it "can make a Vagrantfile with optional shell provisioner with args" do
198
+ path = vagrant.instance_variable_get( :@vagrant_path )
199
+ allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
200
+
201
+ shell_path = '/path/to/shell/script.sh'
202
+ shell_args = 'arg1 arg2'
203
+ hosts = make_hosts({
204
+ :shell_provisioner => {
205
+ :path => shell_path,
206
+ :args => shell_args
207
+ }
208
+ }, 1)
209
+ vagrant.make_vfile( hosts, options )
210
+
211
+ vagrantfile = File.read( File.expand_path( File.join( path, "Vagrantfile")))
212
+ expect( vagrantfile ).to match(/v.vm.provision 'shell', :path => '#{shell_path}', :args => '#{shell_args}'/)
213
+ end
214
+
215
+ it "raises an error if path is not set on shell_provisioner" do
216
+ path = vagrant.instance_variable_get( :@vagrant_path )
217
+ allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
218
+
219
+ hosts = make_hosts({:shell_provisioner => {}}, 1)
220
+ expect{ vagrant.make_vfile( hosts, options ) }.to raise_error RuntimeError, /No path defined for shell_provisioner or path empty/
221
+ end
222
+
223
+ it "raises an error if path is EMPTY on shell_provisioner" do
224
+ path = vagrant.instance_variable_get( :@vagrant_path )
225
+ allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
226
+
227
+ empty_shell_path = ''
228
+ hosts = make_hosts({
229
+ :shell_provisioner => {
230
+ :path => empty_shell_path
231
+ }
232
+ }, 1)
233
+ expect{ vagrant.make_vfile( hosts, options ) }.to raise_error RuntimeError, /No path defined for shell_provisioner or path empty/
234
+ end
235
+
181
236
  context "when generating a windows config" do
182
237
  before do
183
238
  path = vagrant.instance_variable_get( :@vagrant_path )
@@ -389,39 +444,121 @@ EOF
389
444
  end
390
445
  end
391
446
 
392
- it "can generate a ssh-config file" do
393
- host = @hosts[0]
394
- name = host.name
395
- allow( Dir ).to receive( :chdir ).and_yield()
396
- out = double( 'stdout' )
397
- allow( out ).to receive( :read ).and_return("Host #{name}
398
- HostName 127.0.0.1
399
- User vagrant
400
- Port 2222
401
- UserKnownHostsFile /dev/null
402
- StrictHostKeyChecking no
403
- PasswordAuthentication no
404
- IdentityFile /home/root/.vagrant.d/insecure_private_key
405
- IdentitiesOnly yes")
406
-
407
- wait_thr = OpenStruct.new
408
- state = double( 'state' )
409
- allow( state ).to receive( :success? ).and_return( true )
410
- wait_thr.value = state
411
-
412
- allow( Open3 ).to receive( :popen3 ).with( {"RUBYLIB"=>""}, 'vagrant', 'ssh-config', name ).and_return( [ "", out, "", wait_thr ])
413
-
414
- file = double( 'file' )
415
- allow( file ).to receive( :path ).and_return( '/path/sshconfig' )
416
- allow( file ).to receive( :rewind ).and_return( true )
417
-
418
- expect( Tempfile ).to receive( :new ).with( "#{host.name}").and_return( file )
419
- 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")
420
-
421
- vagrant.set_ssh_config( host, 'root' )
422
- expect( host['ssh'] ).to be === { :config => file.path }
423
- expect( host['user']).to be === 'root'
447
+ describe "set_ssh_config" do
448
+ let( :out ) { double( 'stdout' ) }
449
+ let( :host ) { @hosts[0] }
450
+ let( :name ) { host.name }
451
+ let( :file ) { double( 'file' ) }
452
+
453
+ before :each do
454
+ allow( Dir ).to receive( :chdir ).and_yield()
455
+ wait_thr = OpenStruct.new
456
+ state = double( 'state' )
457
+ allow( state ).to receive( :success? ).and_return( true )
458
+ wait_thr.value = state
459
+
460
+ allow( Open3 ).to receive( :popen3 ).with( {"RUBYLIB"=>""}, 'vagrant', 'ssh-config', name ).and_return( [ "", out, "", wait_thr ])
461
+
462
+ allow( file ).to receive( :path ).and_return( '/path/sshconfig' )
463
+ allow( file ).to receive( :rewind ).and_return( true )
464
+
465
+ allow( out ).to receive( :read ).and_return("Host #{name}
466
+ HostName 127.0.0.1
467
+ User vagrant
468
+ Port 2222
469
+ UserKnownHostsFile /dev/null
470
+ StrictHostKeyChecking no
471
+ PasswordAuthentication no
472
+ IdentityFile /home/root/.vagrant.d/insecure_private_key
473
+ IdentitiesOnly yes")
474
+ end
475
+
476
+ it "can generate a ssh-config file" do
477
+ expect( Tempfile ).to receive( :new ).with( "#{host.name}").and_return( file )
478
+ 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 no")
479
+
480
+ vagrant.set_ssh_config( host, 'root' )
481
+ expect( host['ssh'] ).to be === { :config => file.path }
482
+ expect( host['user']).to be === 'root'
483
+ end
484
+
485
+ context "when :forward_ssh_agent is false" do
486
+ it "should not change IdentitiesOnly to no" do
487
+ options = vagrant.instance_variable_get( :@options )
488
+ options['forward_ssh_agent'] = false
489
+ options = vagrant.instance_variable_set( :@options, options )
490
+
491
+ expect( Tempfile ).to receive( :new ).with( "#{host.name}").and_return( file )
492
+ 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")
424
493
 
494
+ vagrant.set_ssh_config( host, 'root' )
495
+ expect( host['ssh'] ).to be === { :config => file.path }
496
+ expect( host['user']).to be === 'root'
497
+ end
498
+ end
499
+ end
500
+
501
+ context 'with options[:provision] = false' do
502
+ let(:options) { super().merge(provision: false) }
503
+
504
+ context 'when Vagrantfile does not exist' do
505
+ it 'raises an error' do
506
+ expect { vagrant.configure }.to raise_error RuntimeError, /no vagrant file was found/
507
+ end
508
+ end
509
+
510
+ it 'calls #get_ip_from_vagrant_file' do
511
+ vagrant.make_vfile(@hosts)
512
+
513
+ @hosts.each do |host|
514
+ allow(vagrant).to receive(:set_ssh_config).with(host, anything)
515
+ expect(vagrant).to receive(:get_ip_from_vagrant_file).with(host.name)
516
+ end
517
+
518
+ vagrant.configure
519
+ end
520
+
521
+ it 'calls #set_all_ssh_config' do
522
+ vagrant.make_vfile(@hosts)
523
+ expect(vagrant).to receive(:set_all_ssh_config)
524
+ vagrant.configure
525
+ end
526
+ end
527
+
528
+ describe '#set_all_ssh_config' do
529
+ before do
530
+ allow(vagrant).to receive(:set_ssh_config)
531
+ end
532
+
533
+ it 'calls #set_ssh_config' do
534
+ @hosts.each do |host|
535
+ expect(vagrant).to receive(:set_ssh_config).with(host, 'vagrant')
536
+ expect(vagrant).to receive(:set_ssh_config).with(host, host['user'])
537
+ end
538
+
539
+ vagrant.set_all_ssh_config
540
+ end
541
+
542
+ it 'calls #copy_ssh_to_root' do
543
+ @hosts.each do |host|
544
+ expect(vagrant).to receive(:copy_ssh_to_root).with(host, options)
545
+ end
546
+
547
+ vagrant.set_all_ssh_config
548
+ end
549
+
550
+ it 'calls #enable_root_login' do
551
+ @hosts.each do |host|
552
+ expect(vagrant).to receive(:enable_root_login).with(host, options)
553
+ end
554
+
555
+ vagrant.set_all_ssh_config
556
+ end
557
+
558
+ it 'calls #hack_etc_hosts' do
559
+ expect(vagrant).to receive(:hack_etc_hosts).with(@hosts, options)
560
+ vagrant.set_all_ssh_config
561
+ end
425
562
  end
426
563
 
427
564
  describe "get_ip_from_vagrant_file" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker-vagrant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rishi Javia, Kevin Imber, Tony Vu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-03 00:00:00.000000000 Z
11
+ date: 2018-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec