beaker-vagrant 0.6.4 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,86 +2,77 @@ require 'spec_helper'
2
2
 
3
3
  describe Beaker::VagrantVirtualbox do
4
4
  let( :options ) { make_opts.merge({ :hosts_file => 'sample.cfg', 'logger' => double().as_null_object }) }
5
- let( :vagrant ) { Beaker::VagrantVirtualbox.new( @hosts, options ) }
6
-
7
- before :each do
8
- @hosts = make_hosts()
9
- end
5
+ let( :vagrant ) { described_class.new( hosts, options ) }
6
+ let(:vagrantfile_path) { vagrant.instance_variable_get( :@vagrant_file ) }
7
+ let(:hosts) { make_hosts() }
10
8
 
11
9
  it "uses the virtualbox provider for provisioning" do
12
- @hosts.each do |host|
10
+ hosts.each do |host|
13
11
  host_prev_name = host['user']
14
12
  expect( vagrant ).to receive( :set_ssh_config ).with( host, 'vagrant' ).once
15
13
  expect( vagrant ).to receive( :copy_ssh_to_root ).with( host, options ).once
16
14
  expect( vagrant ).to receive( :set_ssh_config ).with( host, host_prev_name ).once
17
15
  end
18
- expect( vagrant ).to receive( :hack_etc_hosts ).with( @hosts, options ).once
16
+ expect( vagrant ).to receive( :hack_etc_hosts ).with( hosts, options ).once
19
17
  expect( vagrant ).to receive( :vagrant_cmd ).with( "up --provider virtualbox" ).once
20
18
  vagrant.provision
21
19
  end
22
20
 
23
- it "can make a Vagranfile for a set of hosts" do
24
- path = vagrant.instance_variable_get( :@vagrant_path )
25
- allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
26
-
27
- vagrant.make_vfile( @hosts )
28
-
29
- vagrantfile = File.read( File.expand_path( File.join( path, 'Vagrantfile' )))
30
- expect( vagrantfile ).to include( %Q{ v.vm.provider :virtualbox do |vb|\n vb.customize ['modifyvm', :id, '--memory', '1024', '--cpus', '1', '--audio', 'none']\n end})
31
- end
32
-
33
- it "can disable the vb guest plugin" do
34
- options.merge!({ :vbguest_plugin => 'disable' })
21
+ context 'can make a Vagrantfile' do
22
+ subject do
23
+ FakeFS do
24
+ vagrant.make_vfile(hosts)
25
+ File.read(vagrant.instance_variable_get(:@vagrant_file))
26
+ end
27
+ end
35
28
 
36
- vfile_section = vagrant.class.provider_vfile_section( @hosts.first, options )
29
+ it "can make a Vagrantfile for a set of hosts" do
30
+ is_expected.to include( %Q{ v.vm.provider :virtualbox do |vb|\n vb.customize ['modifyvm', :id, '--memory', '1024', '--cpus', '1', '--audio', 'none']\n end})
31
+ end
37
32
 
38
- match = vfile_section.match(/vb.vbguest.auto_update = false/)
33
+ context 'with ioapic(multiple cores)' do
34
+ let(:hosts) { make_hosts({:ioapic => 'true'}, 1) }
39
35
 
40
- expect( match ).to_not be nil
36
+ it { is_expected.to include( " vb.customize ['modifyvm', :id, '--ioapic', 'on']") }
37
+ end
41
38
 
42
- end
39
+ context 'with NAT DNS' do
40
+ let(:hosts) { make_hosts({:natdns => 'on'}, 1) }
43
41
 
44
- it "can enable ioapic(multiple cores) on hosts" do
45
- path = vagrant.instance_variable_get( :@vagrant_path )
46
- hosts = make_hosts({:ioapic => 'true'},1)
42
+ it { is_expected.to include( " vb.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']") }
43
+ it { is_expected.to include( " vb.customize ['modifyvm', :id, '--natdnsproxy1', 'on']") }
44
+ end
47
45
 
48
- vagrant.make_vfile( hosts )
46
+ context 'storage with the USB controller' do
47
+ let(:hosts) { make_hosts({:volumes => { 'test_disk' => { size: '5120' }}, :volume_storage_controller => 'USB' }) }
49
48
 
50
- vagrantfile = File.read( File.expand_path( File.join( path, 'Vagrantfile' )))
51
- expect( vagrantfile ).to include( %Q{ vb.customize ["modifyvm", :id, "--ioapic", "on"]})
52
- end
49
+ it { is_expected.to include(" vb.customize ['modifyvm', :id, '--usb', 'on']") }
50
+ it { is_expected.to include(" vb.customize ['storagectl', :id, '--name', 'Beaker USB Controller', '--add', 'usb', '--portcount', '8', '--controller', 'USB', '--bootable', 'off']") }
51
+ it { is_expected.to include(" vb.customize ['createhd', '--filename', 'vm1-test_disk.vdi', '--size', '5120']") }
52
+ it { is_expected.to include(" vb.customize ['storageattach', :id, '--storagectl', 'Beaker USB Controller', '--port', '0', '--device', '0', '--type', 'hdd', '--medium', 'vm1-test_disk.vdi']") }
53
+ end
53
54
 
54
- it "correctly provisions storage with the USB controller" do
55
- path = vagrant.instance_variable_get( :@vagrant_path )
56
- hosts = make_hosts({:volumes => { 'test_disk' => { size: '5120' }}, :volume_storage_controller => 'USB' })
55
+ context 'storage with the LSILogic controller' do
56
+ let(:hosts) { make_hosts({:volumes => { 'test_disk' => { size: '5120' }}, :volume_storage_controller => 'LSILogic' }) }
57
57
 
58
- vagrant.make_vfile( hosts )
59
- vagrantfile = File.read( File.expand_path( File.join( path, 'Vagrantfile' )))
60
- expect( vagrantfile ).to include(%Q{ vb.customize ['modifyvm', :id, '--usb', 'on']})
61
- expect( vagrantfile ).to include(%Q{ vb.customize ['storagectl', :id, '--name', 'Beaker USB Controller', '--add', 'usb', '--portcount', '8', '--controller', 'USB', '--bootable', 'off']})
62
- expect( vagrantfile ).to include(%Q{ vb.customize ['createhd', '--filename', 'vm1-test_disk.vdi', '--size', '5120']})
63
- expect( vagrantfile ).to include(%Q{ vb.customize ['storageattach', :id, '--storagectl', 'Beaker USB Controller', '--port', '0', '--device', '0', '--type', 'hdd', '--medium', 'vm1-test_disk.vdi']})
64
- end
58
+ it { is_expected.to include(" vb.customize ['storagectl', :id, '--name', 'Beaker LSILogic Controller', '--add', 'scsi', '--portcount', '16', '--controller', 'LSILogic', '--bootable', 'off']") }
59
+ it { is_expected.to include(" vb.customize ['createhd', '--filename', 'vm1-test_disk.vdi', '--size', '5120']") }
60
+ it { is_expected.to include(" vb.customize ['storageattach', :id, '--storagectl', 'Beaker LSILogic Controller', '--port', '0', '--device', '0', '--type', 'hdd', '--medium', 'vm1-test_disk.vdi']") }
61
+ end
65
62
 
66
- it "correctly provisions storage with the LSILogic controller" do
67
- path = vagrant.instance_variable_get( :@vagrant_path )
68
- hosts = make_hosts({:volumes => { 'test_disk' => { size: '5120' }}, :volume_storage_controller => 'LSILogic' })
63
+ context "storage with the default controller" do
64
+ let(:hosts) { make_hosts({:volumes => { 'test_disk' => { size: '5120' }}}) }
69
65
 
70
- vagrant.make_vfile( hosts )
71
- vagrantfile = File.read( File.expand_path( File.join( path, 'Vagrantfile' )))
72
- expect( vagrantfile ).to include(%Q{ vb.customize ['storagectl', :id, '--name', 'Beaker LSILogic Controller', '--add', 'scsi', '--portcount', '16', '--controller', 'LSILogic', '--bootable', 'off']})
73
- expect( vagrantfile ).to include(%Q{ vb.customize ['createhd', '--filename', 'vm1-test_disk.vdi', '--size', '5120']})
74
- expect( vagrantfile ).to include(%Q{ vb.customize ['storageattach', :id, '--storagectl', 'Beaker LSILogic Controller', '--port', '0', '--device', '0', '--type', 'hdd', '--medium', 'vm1-test_disk.vdi']})
66
+ it { is_expected.to include(" vb.customize ['storagectl', :id, '--name', 'Beaker IntelAHCI Controller', '--add', 'sata', '--portcount', '2', '--controller', 'IntelAHCI', '--bootable', 'off']") }
67
+ it { is_expected.to include(" vb.customize ['createhd', '--filename', 'vm1-test_disk.vdi', '--size', '5120']") }
68
+ it { is_expected.to include(" vb.customize ['storageattach', :id, '--storagectl', 'Beaker IntelAHCI Controller', '--port', '0', '--device', '0', '--type', 'hdd', '--medium', 'vm1-test_disk.vdi']") }
69
+ end
75
70
  end
76
71
 
77
- it "correctly provisions storage with the default controller" do
78
- path = vagrant.instance_variable_get( :@vagrant_path )
79
- hosts = make_hosts({:volumes => { 'test_disk' => { size: '5120' }}})
72
+ context 'disabled vb guest plugin' do
73
+ let(:options) { super().merge({ :vbguest_plugin => 'disable' }) }
74
+ subject { vagrant.class.provider_vfile_section( hosts.first, options ) }
80
75
 
81
- vagrant.make_vfile( hosts )
82
- vagrantfile = File.read( File.expand_path( File.join( path, 'Vagrantfile' )))
83
- expect( vagrantfile ).to include(%Q{ vb.customize ['storagectl', :id, '--name', 'Beaker IntelAHCI Controller', '--add', 'sata', '--portcount', '2', '--controller', 'IntelAHCI', '--bootable', 'off']})
84
- expect( vagrantfile ).to include(%Q{ vb.customize ['createhd', '--filename', 'vm1-test_disk.vdi', '--size', '5120']})
85
- expect( vagrantfile ).to include(%Q{ vb.customize ['storageattach', :id, '--storagectl', 'Beaker IntelAHCI Controller', '--port', '0', '--device', '0', '--type', 'hdd', '--medium', 'vm1-test_disk.vdi']})
76
+ it { is_expected.to match(/vb\.vbguest\.auto_update = false/) }
86
77
  end
87
78
  end
@@ -2,71 +2,57 @@ require 'spec_helper'
2
2
 
3
3
  describe Beaker::VagrantWorkstation do
4
4
  let( :options ) { make_opts.merge({ :hosts_file => 'sample.cfg', 'logger' => double().as_null_object }) }
5
- let( :vagrant ) { Beaker::VagrantWorkstation.new( @hosts, options ) }
6
-
7
- before :each do
8
- @hosts = make_hosts()
9
- end
5
+ let( :vagrant ) { described_class.new( hosts, options ) }
6
+ let( :hosts ) { make_hosts() }
10
7
 
11
8
  it "uses the vmware_workstation provider for provisioning" do
12
- @hosts.each do |host|
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( @hosts, options ).once
15
+ expect( vagrant ).to receive( :hack_etc_hosts ).with( hosts, options ).once
19
16
  expect( vagrant ).to receive( :vagrant_cmd ).with( "up --provider vmware_workstation" ).once
20
- vagrant.provision
21
- end
22
-
23
- it "can make a Vagranfile for a set of hosts" do
24
- path = vagrant.instance_variable_get( :@vagrant_path )
25
- allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
26
-
27
- vagrant.make_vfile( @hosts )
28
-
29
- vagrantfile = File.read( File.expand_path( File.join( path, "Vagrantfile")))
30
- expect( vagrantfile ).to include( %Q{ v.vm.provider :vmware_workstation do |v|\n v.vmx['memsize'] = '1024'\n end})
17
+ FakeFS do
18
+ vagrant.provision
19
+ end
31
20
  end
32
21
 
33
- it "can enable whitelist_verified on hosts" do
34
- path = vagrant.instance_variable_get( :@vagrant_path )
35
- hosts = make_hosts({:whitelist_verified => true},1)
36
-
37
- vagrant.make_vfile( hosts )
38
-
39
- vagrantfile = File.read( File.expand_path( File.join( path, 'Vagrantfile' )))
40
- expect( vagrantfile ).to include( %Q{ v.vmx['whitelist_verified'] = 'true'})
41
- end
22
+ context 'can make a Vagrantfile' do
23
+ subject do
24
+ FakeFS do
25
+ vagrant.make_vfile(hosts)
26
+ File.read(vagrant.instance_variable_get(:@vagrant_file))
27
+ end
28
+ end
42
29
 
43
- it "can enable functional_hgfs on hosts" do
44
- path = vagrant.instance_variable_get( :@vagrant_path )
45
- hosts = make_hosts({:functional_hgfs => true},1)
30
+ it "for a set of hosts" do
31
+ is_expected.to include( %Q{ v.vm.provider :vmware_workstation do |v|\n v.vmx['memsize'] = '1024'\n end})
32
+ end
46
33
 
47
- vagrant.make_vfile( hosts )
34
+ context 'with whitelist_verified' do
35
+ let(:hosts) { make_hosts({:whitelist_verified => true}, 1) }
48
36
 
49
- vagrantfile = File.read( File.expand_path( File.join( path, 'Vagrantfile' )))
50
- expect( vagrantfile ).to include( %Q{ v.vmx['functional_hgfs'] = 'true'})
51
- end
37
+ it { is_expected.to include( %Q{ v.vmx['whitelist_verified'] = 'true'}) }
38
+ end
52
39
 
53
- it "can enable unmount_default_hgfs on hosts" do
54
- path = vagrant.instance_variable_get( :@vagrant_path )
55
- hosts = make_hosts({:unmount_default_hgfs => true},1)
40
+ context 'with functional_hgfs' do
41
+ let(:hosts) { make_hosts({:functional_hgfs => true}, 1) }
56
42
 
57
- vagrant.make_vfile( hosts )
43
+ it { is_expected.to include( %Q{ v.vmx['functional_hgfs'] = 'true'}) }
44
+ end
58
45
 
59
- vagrantfile = File.read( File.expand_path( File.join( path, 'Vagrantfile' )))
60
- expect( vagrantfile ).to include( %Q{ v.vmx['unmount_default_hgfs'] = 'true'})
61
- end
46
+ context 'with unmount_default_hgfs' do
47
+ let(:hosts) { make_hosts({:unmount_default_hgfs => true}, 1) }
62
48
 
63
- it "can enable gui on hosts" do
64
- path = vagrant.instance_variable_get( :@vagrant_path )
65
- hosts = make_hosts({:gui => true},1)
49
+ it { is_expected.to include( %Q{ v.vmx['unmount_default_hgfs'] = 'true'}) }
50
+ end
66
51
 
67
- vagrant.make_vfile( hosts )
52
+ context "with gui" do
53
+ let(:hosts) { make_hosts({:gui => true},1) }
68
54
 
69
- vagrantfile = File.read( File.expand_path( File.join( path, 'Vagrantfile' )))
70
- expect( vagrantfile ).to include( %Q{ v.vmx['gui'] = true})
55
+ it { is_expected.to include( %Q{ v.vmx['gui'] = true}) }
56
+ end
71
57
  end
72
58
  end
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.6.4
4
+ version: 0.7.1
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: 2020-01-21 00:00:00.000000000 Z
11
+ date: 2021-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -42,30 +42,36 @@ dependencies:
42
42
  name: fakefs
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0.6'
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: '2.0'
48
51
  type: :development
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
52
- - - "~>"
55
+ - - ">="
53
56
  - !ruby/object:Gem::Version
54
57
  version: '0.6'
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: '2.0'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: rake
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
65
  - - "~>"
60
66
  - !ruby/object:Gem::Version
61
- version: '10.1'
67
+ version: '13.0'
62
68
  type: :development
63
69
  prerelease: false
64
70
  version_requirements: !ruby/object:Gem::Requirement
65
71
  requirements:
66
72
  - - "~>"
67
73
  - !ruby/object:Gem::Version
68
- version: '10.1'
74
+ version: '13.0'
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: simplecov
71
77
  requirement: !ruby/object:Gem::Requirement
@@ -122,20 +128,6 @@ dependencies:
122
128
  - - ">="
123
129
  - !ruby/object:Gem::Version
124
130
  version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: stringify-hash
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: 0.0.0
132
- type: :runtime
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: 0.0.0
139
131
  description: For use for the Beaker acceptance testing tool
140
132
  email:
141
133
  - rishi.javia@puppet.com, kevin.imber@puppet.com, tony.vu@puppet.com
@@ -144,9 +136,13 @@ executables:
144
136
  extensions: []
145
137
  extra_rdoc_files: []
146
138
  files:
139
+ - ".github/dependabot.yml"
140
+ - ".github/workflows/release.yml"
141
+ - ".github/workflows/test.yml"
147
142
  - ".gitignore"
148
143
  - ".rspec"
149
144
  - ".simplecov"
145
+ - CHANGELOG.md
150
146
  - Gemfile
151
147
  - LICENSE
152
148
  - README.md
@@ -195,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
195
191
  - !ruby/object:Gem::Version
196
192
  version: '0'
197
193
  requirements: []
198
- rubygems_version: 3.0.6
194
+ rubygems_version: 3.1.6
199
195
  signing_key:
200
196
  specification_version: 4
201
197
  summary: Beaker DSL Extension Helpers!