beaker-vagrant 0.6.7 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,99 +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
- let(:vagrantfile_path) do
7
- path = vagrant.instance_variable_get( :@vagrant_path )
8
- File.expand_path( File.join( path, 'Vagrantfile' ))
9
- end
10
-
11
- before :each do
12
- @hosts = make_hosts()
13
- end
5
+ let( :vagrant ) { described_class.new( hosts, options ) }
6
+ let(:vagrantfile_path) { vagrant.instance_variable_get( :@vagrant_file ) }
7
+ let(:hosts) { make_hosts() }
14
8
 
15
9
  it "uses the virtualbox provider for provisioning" do
16
- @hosts.each do |host|
10
+ hosts.each do |host|
17
11
  host_prev_name = host['user']
18
12
  expect( vagrant ).to receive( :set_ssh_config ).with( host, 'vagrant' ).once
19
13
  expect( vagrant ).to receive( :copy_ssh_to_root ).with( host, options ).once
20
14
  expect( vagrant ).to receive( :set_ssh_config ).with( host, host_prev_name ).once
21
15
  end
22
- expect( vagrant ).to receive( :hack_etc_hosts ).with( @hosts, options ).once
16
+ expect( vagrant ).to receive( :hack_etc_hosts ).with( hosts, options ).once
23
17
  expect( vagrant ).to receive( :vagrant_cmd ).with( "up --provider virtualbox" ).once
24
18
  vagrant.provision
25
19
  end
26
20
 
27
- it "can make a Vagranfile for a set of hosts" do
28
- path = vagrant.instance_variable_get( :@vagrant_path )
29
- allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
30
-
31
- vagrant.make_vfile( @hosts )
32
-
33
- vagrantfile = File.read( File.expand_path( File.join( path, 'Vagrantfile' )))
34
- expect( vagrantfile ).to include( %Q{ v.vm.provider :virtualbox do |vb|\n vb.customize ['modifyvm', :id, '--memory', '1024', '--cpus', '1', '--audio', 'none']\n end})
35
- end
36
-
37
- it "can disable the vb guest plugin" do
38
- options.merge!({ :vbguest_plugin => 'disable' })
39
-
40
- vfile_section = vagrant.class.provider_vfile_section( @hosts.first, options )
41
-
42
- match = vfile_section.match(/vb.vbguest.auto_update = false/)
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
43
28
 
44
- expect( match ).to_not be nil
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
45
32
 
46
- end
33
+ context 'with ioapic(multiple cores)' do
34
+ let(:hosts) { make_hosts({:ioapic => 'true'}, 1) }
47
35
 
48
- it "can enable ioapic(multiple cores) on hosts" do
49
- path = vagrant.instance_variable_get( :@vagrant_path )
50
- hosts = make_hosts({:ioapic => 'true'},1)
36
+ it { is_expected.to include( " vb.customize ['modifyvm', :id, '--ioapic', 'on']") }
37
+ end
51
38
 
52
- vagrant.make_vfile( hosts )
39
+ context 'with NAT DNS' do
40
+ let(:hosts) { make_hosts({:natdns => 'on'}, 1) }
53
41
 
54
- vagrantfile = File.read( File.expand_path( File.join( path, 'Vagrantfile' )))
55
- expect( vagrantfile ).to include( " vb.customize ['modifyvm', :id, '--ioapic', 'on']")
56
- end
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
57
45
 
58
- it "can enable NAT DNS on hosts" do
59
- hosts = make_hosts({:natdns => 'on'},1)
60
- vagrant.make_vfile( hosts )
61
- vagrantfile = File.read( vagrantfile_path )
46
+ context 'storage with the USB controller' do
47
+ let(:hosts) { make_hosts({:volumes => { 'test_disk' => { size: '5120' }}, :volume_storage_controller => 'USB' }) }
62
48
 
63
- expect( vagrantfile ).to include( " vb.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']")
64
- expect( vagrantfile ).to include( " vb.customize ['modifyvm', :id, '--natdnsproxy1', 'on']")
65
- 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
66
54
 
67
- it "correctly provisions storage with the USB controller" do
68
- path = vagrant.instance_variable_get( :@vagrant_path )
69
- 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' }) }
70
57
 
71
- vagrant.make_vfile( hosts )
72
- vagrantfile = File.read( File.expand_path( File.join( path, 'Vagrantfile' )))
73
- expect( vagrantfile ).to include(" vb.customize ['modifyvm', :id, '--usb', 'on']")
74
- expect( vagrantfile ).to include(" vb.customize ['storagectl', :id, '--name', 'Beaker USB Controller', '--add', 'usb', '--portcount', '8', '--controller', 'USB', '--bootable', 'off']")
75
- expect( vagrantfile ).to include(" vb.customize ['createhd', '--filename', 'vm1-test_disk.vdi', '--size', '5120']")
76
- expect( vagrantfile ).to include(" vb.customize ['storageattach', :id, '--storagectl', 'Beaker USB Controller', '--port', '0', '--device', '0', '--type', 'hdd', '--medium', 'vm1-test_disk.vdi']")
77
- 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
78
62
 
79
- it "correctly provisions storage with the LSILogic controller" do
80
- path = vagrant.instance_variable_get( :@vagrant_path )
81
- 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' }}}) }
82
65
 
83
- vagrant.make_vfile( hosts )
84
- vagrantfile = File.read( File.expand_path( File.join( path, 'Vagrantfile' )))
85
- expect( vagrantfile ).to include(" vb.customize ['storagectl', :id, '--name', 'Beaker LSILogic Controller', '--add', 'scsi', '--portcount', '16', '--controller', 'LSILogic', '--bootable', 'off']")
86
- expect( vagrantfile ).to include(" vb.customize ['createhd', '--filename', 'vm1-test_disk.vdi', '--size', '5120']")
87
- expect( vagrantfile ).to include(" 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
88
70
  end
89
71
 
90
- it "correctly provisions storage with the default controller" do
91
- path = vagrant.instance_variable_get( :@vagrant_path )
92
- 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 ) }
93
75
 
94
- vagrant.make_vfile( hosts )
95
- vagrantfile = File.read( File.expand_path( File.join( path, 'Vagrantfile' )))
96
- expect( vagrantfile ).to include(" vb.customize ['storagectl', :id, '--name', 'Beaker IntelAHCI Controller', '--add', 'sata', '--portcount', '2', '--controller', 'IntelAHCI', '--bootable', 'off']")
97
- expect( vagrantfile ).to include(" vb.customize ['createhd', '--filename', 'vm1-test_disk.vdi', '--size', '5120']")
98
- expect( vagrantfile ).to include(" 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/) }
99
77
  end
100
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.7
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: 2021-02-26 00:00:00.000000000 Z
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: '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
@@ -145,6 +137,7 @@ extensions: []
145
137
  extra_rdoc_files: []
146
138
  files:
147
139
  - ".github/dependabot.yml"
140
+ - ".github/workflows/release.yml"
148
141
  - ".github/workflows/test.yml"
149
142
  - ".gitignore"
150
143
  - ".rspec"
@@ -197,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
190
  - !ruby/object:Gem::Version
198
191
  version: '0'
199
192
  requirements: []
200
- rubygems_version: 3.0.8
193
+ rubygems_version: 3.1.6
201
194
  signing_key:
202
195
  specification_version: 4
203
196
  summary: Beaker DSL Extension Helpers!