beaker-vagrant 0.6.3 → 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/dependabot.yml +8 -0
- data/.github/workflows/release.yml +24 -0
- data/.github/workflows/test.yml +32 -0
- data/.rspec +1 -0
- data/Rakefile +2 -2
- data/beaker-vagrant.gemspec +2 -6
- data/docs/vagrant.md +39 -1
- data/lib/beaker-vagrant/version.rb +1 -1
- data/lib/beaker/hypervisor/vagrant.rb +46 -68
- data/lib/beaker/hypervisor/vagrant_custom.rb +1 -0
- data/lib/beaker/hypervisor/vagrant_libvirt.rb +18 -22
- data/lib/beaker/hypervisor/vagrant_virtualbox.rb +4 -4
- 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 +43 -118
- data/spec/beaker/hypervisor/vagrant_virtualbox_spec.rb +47 -56
- data/spec/beaker/hypervisor/vagrant_workstation_spec.rb +33 -47
- metadata +16 -21
@@ -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 ) {
|
6
|
-
|
7
|
-
|
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
|
-
|
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(
|
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
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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
|
-
|
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
|
-
|
33
|
+
context 'with ioapic(multiple cores)' do
|
34
|
+
let(:hosts) { make_hosts({:ioapic => 'true'}, 1) }
|
39
35
|
|
40
|
-
|
36
|
+
it { is_expected.to include( " vb.customize ['modifyvm', :id, '--ioapic', 'on']") }
|
37
|
+
end
|
41
38
|
|
42
|
-
|
39
|
+
context 'with NAT DNS' do
|
40
|
+
let(:hosts) { make_hosts({:natdns => 'on'}, 1) }
|
43
41
|
|
44
|
-
|
45
|
-
|
46
|
-
|
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
|
-
|
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
|
-
|
51
|
-
|
52
|
-
|
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
|
-
|
55
|
-
|
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
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
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
|
-
|
67
|
-
|
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
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
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
|
-
|
78
|
-
|
79
|
-
|
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
|
-
|
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 ) {
|
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
|
-
|
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 vmware_workstation" ).once
|
20
|
-
|
21
|
-
|
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
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
-
|
44
|
-
|
45
|
-
|
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
|
-
|
34
|
+
context 'with whitelist_verified' do
|
35
|
+
let(:hosts) { make_hosts({:whitelist_verified => true}, 1) }
|
48
36
|
|
49
|
-
|
50
|
-
|
51
|
-
end
|
37
|
+
it { is_expected.to include( %Q{ v.vmx['whitelist_verified'] = 'true'}) }
|
38
|
+
end
|
52
39
|
|
53
|
-
|
54
|
-
|
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
|
-
|
43
|
+
it { is_expected.to include( %Q{ v.vmx['functional_hgfs'] = 'true'}) }
|
44
|
+
end
|
58
45
|
|
59
|
-
|
60
|
-
|
61
|
-
end
|
46
|
+
context 'with unmount_default_hgfs' do
|
47
|
+
let(:hosts) { make_hosts({:unmount_default_hgfs => true}, 1) }
|
62
48
|
|
63
|
-
|
64
|
-
|
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
|
-
|
52
|
+
context "with gui" do
|
53
|
+
let(:hosts) { make_hosts({:gui => true},1) }
|
68
54
|
|
69
|
-
|
70
|
-
|
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.
|
4
|
+
version: 0.7.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:
|
11
|
+
date: 2021-05-18 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: '
|
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: '
|
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,6 +136,9 @@ 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"
|
@@ -195,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
190
|
- !ruby/object:Gem::Version
|
196
191
|
version: '0'
|
197
192
|
requirements: []
|
198
|
-
rubygems_version: 3.
|
193
|
+
rubygems_version: 3.1.6
|
199
194
|
signing_key:
|
200
195
|
specification_version: 4
|
201
196
|
summary: Beaker DSL Extension Helpers!
|