beaker-vagrant 0.7.0 → 1.0.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 +9 -0
- data/.github/workflows/release.yml +17 -9
- data/.github/workflows/test.yml +40 -11
- data/.rubocop.yml +4 -0
- data/.rubocop_todo.yml +383 -0
- data/CHANGELOG.md +202 -0
- data/Gemfile +3 -24
- data/README.md +26 -9
- data/Rakefile +34 -120
- data/beaker-vagrant.gemspec +24 -24
- data/bin/beaker-vagrant +1 -3
- data/lib/beaker/hypervisor/vagrant/mount_folder.rb +1 -1
- data/lib/beaker/hypervisor/vagrant.rb +72 -83
- data/lib/beaker/hypervisor/vagrant_custom.rb +1 -1
- data/lib/beaker/hypervisor/vagrant_desktop.rb +9 -5
- data/lib/beaker/hypervisor/vagrant_libvirt.rb +1 -7
- data/lib/beaker/hypervisor/vagrant_parallels.rb +2 -2
- data/lib/beaker/hypervisor/vagrant_virtualbox.rb +35 -32
- data/lib/beaker/hypervisor/vagrant_workstation.rb +9 -5
- data/lib/beaker-vagrant/version.rb +1 -1
- data/spec/beaker/hypervisor/vagrant_custom_spec.rb +14 -15
- data/spec/beaker/hypervisor/vagrant_desktop_spec.rb +20 -20
- data/spec/beaker/hypervisor/vagrant_fusion_spec.rb +11 -11
- data/spec/beaker/hypervisor/vagrant_libvirt_spec.rb +23 -22
- data/spec/beaker/hypervisor/vagrant_parallels_spec.rb +15 -15
- data/spec/beaker/hypervisor/vagrant_spec.rb +301 -309
- data/spec/beaker/hypervisor/vagrant_virtualbox_spec.rb +50 -29
- data/spec/beaker/hypervisor/vagrant_workstation_spec.rb +20 -20
- data/spec/spec_helper.rb +1 -2
- metadata +69 -36
@@ -1,19 +1,19 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Beaker::VagrantDesktop do
|
4
|
-
let(
|
5
|
-
let(
|
6
|
-
let(
|
4
|
+
let(:options) { make_opts.merge({ :hosts_file => 'sample.cfg', 'logger' => double.as_null_object }) }
|
5
|
+
let(:vagrant) { described_class.new(hosts, options) }
|
6
|
+
let(:hosts) { make_hosts }
|
7
7
|
|
8
|
-
it
|
8
|
+
it 'uses the vmware_desktop provider for provisioning' do
|
9
9
|
hosts.each do |host|
|
10
10
|
host_prev_name = host['user']
|
11
|
-
expect(
|
12
|
-
expect(
|
13
|
-
expect(
|
11
|
+
expect(vagrant).to receive(:set_ssh_config).with(host, 'vagrant').once
|
12
|
+
expect(vagrant).to receive(:copy_ssh_to_root).with(host, options).once
|
13
|
+
expect(vagrant).to receive(:set_ssh_config).with(host, host_prev_name).once
|
14
14
|
end
|
15
|
-
expect(
|
16
|
-
expect(
|
15
|
+
expect(vagrant).to receive(:hack_etc_hosts).with(hosts, options).once
|
16
|
+
expect(vagrant).to receive(:vagrant_cmd).with('up --provider vmware_desktop').once
|
17
17
|
FakeFS do
|
18
18
|
vagrant.provision
|
19
19
|
end
|
@@ -27,32 +27,32 @@ describe Beaker::VagrantDesktop do
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
it
|
31
|
-
is_expected.to include(
|
30
|
+
it 'for a set of hosts' do
|
31
|
+
is_expected.to include(%( v.vm.provider :vmware_desktop do |v|\n v.vmx['memsize'] = '1024'\n end))
|
32
32
|
end
|
33
33
|
|
34
34
|
context 'with whitelist_verified' do
|
35
|
-
let(:hosts) { make_hosts({:
|
35
|
+
let(:hosts) { make_hosts({ whitelist_verified: true }, 1) }
|
36
36
|
|
37
|
-
it { is_expected.to include(
|
37
|
+
it { is_expected.to include(%( v.vmx['whitelist_verified'] = 'true')) }
|
38
38
|
end
|
39
39
|
|
40
40
|
context 'with functional_hgfs' do
|
41
|
-
let(:hosts) { make_hosts({:
|
41
|
+
let(:hosts) { make_hosts({ functional_hgfs: true }, 1) }
|
42
42
|
|
43
|
-
it { is_expected.to include(
|
43
|
+
it { is_expected.to include(%( v.vmx['functional_hgfs'] = 'true')) }
|
44
44
|
end
|
45
45
|
|
46
46
|
context 'with unmount_default_hgfs' do
|
47
|
-
let(:hosts) { make_hosts({:
|
47
|
+
let(:hosts) { make_hosts({ unmount_default_hgfs: true }, 1) }
|
48
48
|
|
49
|
-
it { is_expected.to include(
|
49
|
+
it { is_expected.to include(%( v.vmx['unmount_default_hgfs'] = 'true')) }
|
50
50
|
end
|
51
51
|
|
52
|
-
context
|
53
|
-
let(:hosts) { make_hosts({:
|
52
|
+
context 'with gui' do
|
53
|
+
let(:hosts) { make_hosts({ gui: true }, 1) }
|
54
54
|
|
55
|
-
it { is_expected.to include(
|
55
|
+
it { is_expected.to include(%( v.vmx['gui'] = true)) }
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
@@ -1,32 +1,32 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Beaker::VagrantFusion do
|
4
|
-
let(
|
5
|
-
let(
|
6
|
-
let(
|
4
|
+
let(:options) { make_opts.merge({ :hosts_file => 'sample.cfg', 'logger' => double.as_null_object }) }
|
5
|
+
let(:vagrant) { described_class.new(hosts, options) }
|
6
|
+
let(:hosts) { make_hosts }
|
7
7
|
|
8
|
-
it
|
8
|
+
it 'uses the vmware_fusion provider for provisioning' do
|
9
9
|
hosts.each do |host|
|
10
10
|
host_prev_name = host['user']
|
11
|
-
expect(
|
12
|
-
expect(
|
13
|
-
expect(
|
11
|
+
expect(vagrant).to receive(:set_ssh_config).with(host, 'vagrant').once
|
12
|
+
expect(vagrant).to receive(:copy_ssh_to_root).with(host, options).once
|
13
|
+
expect(vagrant).to receive(:set_ssh_config).with(host, host_prev_name).once
|
14
14
|
end
|
15
|
-
expect(
|
16
|
-
expect(
|
15
|
+
expect(vagrant).to receive(:hack_etc_hosts).with(hosts, options).once
|
16
|
+
expect(vagrant).to receive(:vagrant_cmd).with('up --provider vmware_fusion').once
|
17
17
|
vagrant.provision
|
18
18
|
end
|
19
19
|
|
20
20
|
context 'Correct vagrant configuration' do
|
21
21
|
subject do
|
22
22
|
FakeFS do
|
23
|
-
vagrant.make_vfile(
|
23
|
+
vagrant.make_vfile(hosts, options)
|
24
24
|
File.read(vagrant.instance_variable_get(:@vagrant_file))
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'has a provider section' do
|
29
|
-
is_expected.to include(
|
29
|
+
is_expected.to include(%( v.vm.provider :vmware_fusion do |v|\n v.vmx['memsize'] = '1024'\n end))
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -1,27 +1,28 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Beaker::VagrantLibvirt do
|
4
|
-
let(
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
let(
|
11
|
-
|
4
|
+
let(:options) do
|
5
|
+
make_opts.merge({ :hosts_file => 'sample.cfg',
|
6
|
+
'logger' => double.as_null_object,
|
7
|
+
'libvirt' => { 'uri' => 'qemu+ssh://root@host/system' },
|
8
|
+
'vagrant_cpus' => 2, })
|
9
|
+
end
|
10
|
+
let(:vagrant) { described_class.new(hosts, options) }
|
11
|
+
let(:hosts) do
|
12
|
+
make_hosts.each do |host|
|
12
13
|
host.delete('ip')
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
16
|
-
it
|
17
|
+
it 'uses the vagrant_libvirt provider for provisioning' do
|
17
18
|
hosts.each do |host|
|
18
19
|
host_prev_name = host['user']
|
19
|
-
expect(
|
20
|
-
expect(
|
21
|
-
expect(
|
20
|
+
expect(vagrant).to receive(:set_ssh_config).with(host, 'vagrant').once
|
21
|
+
expect(vagrant).to receive(:copy_ssh_to_root).with(host, options).once
|
22
|
+
expect(vagrant).to receive(:set_ssh_config).with(host, host_prev_name).once
|
22
23
|
end
|
23
|
-
expect(
|
24
|
-
expect(
|
24
|
+
expect(vagrant).to receive(:hack_etc_hosts).with(hosts, options).once
|
25
|
+
expect(vagrant).to receive(:vagrant_cmd).with('up --provider libvirt').once
|
25
26
|
FakeFS do
|
26
27
|
vagrant.provision
|
27
28
|
end
|
@@ -30,28 +31,28 @@ describe Beaker::VagrantLibvirt do
|
|
30
31
|
context 'Correct vagrant configuration' do
|
31
32
|
subject do
|
32
33
|
FakeFS do
|
33
|
-
vagrant.make_vfile(
|
34
|
+
vagrant.make_vfile(hosts, options)
|
34
35
|
File.read(vagrant.instance_variable_get(:@vagrant_file))
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
38
39
|
it 'has a provider section' do
|
39
|
-
is_expected.to include(
|
40
|
+
is_expected.to include(%( v.vm.provider :libvirt do |node|))
|
40
41
|
end
|
41
42
|
|
42
|
-
it
|
43
|
-
is_expected.
|
43
|
+
it 'has no private network' do
|
44
|
+
is_expected.to include('v.vm.network :private_network')
|
44
45
|
end
|
45
46
|
|
46
|
-
it
|
47
|
+
it 'can specify the memory as an integer' do
|
47
48
|
is_expected.to include('node.memory = 1024')
|
48
49
|
end
|
49
50
|
|
50
|
-
it
|
51
|
-
is_expected.to include(
|
51
|
+
it 'can specify the number of cpus' do
|
52
|
+
is_expected.to include('node.cpus = 2')
|
52
53
|
end
|
53
54
|
|
54
|
-
it
|
55
|
+
it 'can specify any libvirt option' do
|
55
56
|
is_expected.to include("node.uri = 'qemu+ssh://root@host/system'")
|
56
57
|
end
|
57
58
|
end
|
@@ -1,40 +1,40 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Beaker::VagrantParallels do
|
4
|
-
let(
|
5
|
-
let(
|
6
|
-
let(
|
4
|
+
let(:options) { make_opts.merge({ :hosts_file => 'sample.cfg', 'logger' => double.as_null_object }) }
|
5
|
+
let(:vagrant) { Beaker::VagrantParallels.new(hosts, options) }
|
6
|
+
let(:hosts) { make_hosts }
|
7
7
|
|
8
|
-
it
|
8
|
+
it 'uses the parallels provider for provisioning' do
|
9
9
|
hosts.each do |host|
|
10
10
|
host_prev_name = host['user']
|
11
|
-
expect(
|
12
|
-
expect(
|
13
|
-
expect(
|
11
|
+
expect(vagrant).to receive(:set_ssh_config).with(host, 'vagrant').once
|
12
|
+
expect(vagrant).to receive(:copy_ssh_to_root).with(host, options).once
|
13
|
+
expect(vagrant).to receive(:set_ssh_config).with(host, host_prev_name).once
|
14
14
|
end
|
15
|
-
expect(
|
16
|
-
expect(
|
15
|
+
expect(vagrant).to receive(:hack_etc_hosts).with(hosts, options).once
|
16
|
+
expect(vagrant).to receive(:vagrant_cmd).with('up --provider parallels').once
|
17
17
|
vagrant.provision
|
18
18
|
end
|
19
19
|
|
20
20
|
context 'Correct vagrant configuration' do
|
21
21
|
subject do
|
22
22
|
FakeFS do
|
23
|
-
vagrant.make_vfile(
|
23
|
+
vagrant.make_vfile(hosts, options)
|
24
24
|
File.read(vagrant.instance_variable_get(:@vagrant_file))
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
it
|
29
|
-
is_expected.to include(
|
28
|
+
it 'can make a Vagrantfile for a set of hosts' do
|
29
|
+
is_expected.to include(%( v.vm.provider :parallels do |prl|\n prl.optimize_power_consumption = false\n prl.memory = '1024'\n end))
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
context 'disabled guest tools' do
|
34
|
-
let(:options) { super().merge({ :
|
35
|
-
subject { vagrant.class.provider_vfile_section(
|
34
|
+
let(:options) { super().merge({ prl_update_guest_tools: 'disable' }) }
|
35
|
+
subject { vagrant.class.provider_vfile_section(hosts.first, options) }
|
36
36
|
|
37
|
-
it
|
37
|
+
it 'can disable the auto-update functionality of the Parallels Guest Tools' do
|
38
38
|
is_expected.to match(/prl.update_guest_tools = false/)
|
39
39
|
end
|
40
40
|
end
|