vagrant-parallels 1.6.2 → 1.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -0
  3. data/LICENSE.txt +1 -1
  4. data/lib/vagrant-parallels/action.rb +7 -0
  5. data/lib/vagrant-parallels/action/box_unregister.rb +3 -0
  6. data/lib/vagrant-parallels/action/check_shared_interface.rb +29 -0
  7. data/lib/vagrant-parallels/action/clear_forwarded_ports.rb +3 -2
  8. data/lib/vagrant-parallels/action/export.rb +69 -6
  9. data/lib/vagrant-parallels/action/forward_ports.rb +1 -1
  10. data/lib/vagrant-parallels/action/network.rb +8 -10
  11. data/lib/vagrant-parallels/action/sane_defaults.rb +2 -1
  12. data/lib/vagrant-parallels/cap.rb +0 -1
  13. data/lib/vagrant-parallels/config.rb +18 -8
  14. data/lib/vagrant-parallels/driver/base.rb +68 -24
  15. data/lib/vagrant-parallels/driver/meta.rb +3 -1
  16. data/lib/vagrant-parallels/driver/pd_10.rb +36 -39
  17. data/lib/vagrant-parallels/driver/pd_11.rb +4 -0
  18. data/lib/vagrant-parallels/driver/pd_8.rb +31 -27
  19. data/lib/vagrant-parallels/errors.rb +10 -2
  20. data/lib/vagrant-parallels/version.rb +1 -1
  21. data/locales/en.yml +25 -9
  22. metadata +4 -29
  23. data/.gitignore +0 -34
  24. data/.travis.yml +0 -10
  25. data/CONTRIBUTING.md +0 -80
  26. data/Gemfile +0 -14
  27. data/Rakefile +0 -21
  28. data/debug.log +0 -1237
  29. data/tasks/acceptance.rake +0 -28
  30. data/tasks/bundler.rake +0 -3
  31. data/tasks/test.rake +0 -8
  32. data/test/acceptance/base.rb +0 -2
  33. data/test/acceptance/provider/linked_clone_spec.rb +0 -30
  34. data/test/acceptance/provider/snapshot_spec.rb +0 -63
  35. data/test/acceptance/shared/context_parallels.rb +0 -2
  36. data/test/acceptance/skeletons/linked_clone/Vagrantfile +0 -7
  37. data/test/unit/base.rb +0 -24
  38. data/test/unit/cap_test.rb +0 -96
  39. data/test/unit/config_test.rb +0 -91
  40. data/test/unit/driver/pd_10_test.rb +0 -31
  41. data/test/unit/driver/pd_8_test.rb +0 -10
  42. data/test/unit/driver/pd_9_test.rb +0 -29
  43. data/test/unit/support/shared/parallels_context.rb +0 -230
  44. data/test/unit/support/shared/pd_driver_examples.rb +0 -339
  45. data/test/unit/synced_folder_test.rb +0 -49
  46. data/vagrant-parallels.gemspec +0 -59
  47. data/vagrant-spec.config.example.rb +0 -10
@@ -1,230 +0,0 @@
1
- shared_context 'parallels' do
2
- let(:parallels_context) { true }
3
- let(:uuid) { '1234-here-is-uuid-5678' }
4
- let(:parallels_version) { '9' }
5
- let(:subprocess) { double('Vagrant::Util::Subprocess') }
6
- let(:driver) { subject.instance_variable_get('@driver') }
7
-
8
- let(:vm_name) {'VM_Name'}
9
- let(:tpl_uuid) {'1234-some-template-uuid-5678'}
10
- let(:tpl_name) {'Some_Template_Name'}
11
- let(:tools_state) {'installed'}
12
- let(:tools_version) {'8.0.18615.123456'}
13
- let(:hostonly_iface) {'vnic10'}
14
-
15
- let(:vnic_options) do {
16
- name: 'vagrant_vnic6',
17
- adapter_ip: '11.11.11.11',
18
- netmask: '255.255.252.0',
19
- dhcp: {
20
- ip: '11.11.11.11',
21
- lower: '11.11.8.1',
22
- upper: '11.11.11.254'
23
- }
24
- } end
25
-
26
- # this is a helper that returns a duck type suitable from a system command
27
- # execution; allows setting exit_code, stdout, and stderr in stubs.
28
- def subprocess_result(options={})
29
- defaults = {exit_code: 0, stdout: '', stderr: ''}
30
- double('subprocess_result', defaults.merge(options))
31
- end
32
-
33
- before do
34
- # Consider that 'prlctl' and 'prlsrvctl' binaries are available
35
- allow(Vagrant::Util::Which).to receive(:which).with('prlctl').and_return('prlctl')
36
- allow(Vagrant::Util::Which).to receive(:which).with('prlsrvctl').and_return('prlsrvctl')
37
- allow(Vagrant::Util::Which).to receive(:which).with('prl_disk_tool').and_return('prl_disk_tool')
38
-
39
- # we don't want unit tests to ever run commands on the system; so we wire
40
- # in a double to ensure any unexpected messages raise exceptions
41
- stub_const('Vagrant::Util::Subprocess', subprocess)
42
-
43
- # drivers will blow up on instantiation if they cannot determine the
44
- # Parallels Desktop version, so wire this stub in automatically
45
- subprocess.stub(:execute).
46
- with('prlctl', '--version', an_instance_of(Hash)).
47
- and_return(subprocess_result(stdout: "prlctl version #{parallels_version}.0.98765"))
48
-
49
- # drivers also call vm_exists? during init;
50
- subprocess.stub(:execute).
51
- with('prlctl', 'list', uuid, kind_of(Hash)).
52
- and_return(subprocess_result(exit_code: 0))
53
-
54
- # Returns detailed info about specified VM or all registered VMs
55
- # `prlctl list <vm_uuid> --info --no-header --json`
56
- # `prlctl list --all --info --no-header --json`
57
- subprocess.stub(:execute).
58
- with('prlctl', 'list', kind_of(String), '--info', '--no-header', '--json',
59
- kind_of(Hash)) do
60
- out = <<-eos
61
- [
62
- {
63
- "ID": "#{uuid}",
64
- "Name": "#{vm_name}",
65
- "State": "stopped",
66
- "Home": "/path/to/#{vm_name}.pvm/",
67
- "GuestTools": {
68
- "state": "#{tools_state}",
69
- "version": "#{tools_version}"
70
- },
71
- "Hardware": {
72
- "cpu": {
73
- "cpus": 1
74
- },
75
- "memory": {
76
- "size": "512Mb"
77
- },
78
- "hdd0": {
79
- "enabled": true,
80
- "image": "/path/to/disk1.hdd"
81
- },
82
- "net0": {
83
- "enabled": true,
84
- "type": "shared",
85
- "mac": "001C42B4B074",
86
- "card": "e1000",
87
- "dhcp": "yes"
88
- },
89
- "net1": {
90
- "enabled": true,
91
- "type": "bridged",
92
- "iface": "vnic2",
93
- "mac": "001C42EC0068",
94
- "card": "e1000",
95
- "ips": "33.33.33.5/255.255.255.0 "
96
- }
97
- },
98
- "Host Shared Folders": {
99
- "enabled": true,
100
- "shared_folder_1": {
101
- "enabled": true,
102
- "path": "/path/to/shared/folder/1"
103
- },
104
- "shared_folder_2": {
105
- "enabled": true,
106
- "path": "/path/to/shared/folder/2"
107
- }
108
- }
109
- }
110
- ]
111
- eos
112
- subprocess_result(stdout: out)
113
- end
114
-
115
- # Returns detailed info about specified template or all registered templates
116
- # `prlctl list <tpl_uuid> --info --json --no-header --template`
117
- # `prlctl list --all --info --no-header --json --template`
118
- subprocess.stub(:execute).
119
- with('prlctl', 'list', kind_of(String), '--info', '--no-header', '--json',
120
- '--template', kind_of(Hash)) do
121
- out = <<-eos
122
- [
123
- {
124
- "ID": "#{tpl_uuid}",
125
- "Name": "#{tpl_name}",
126
- "State": "stopped",
127
- "Home": "/path/to/#{tpl_name}.pvm/",
128
- "GuestTools": {
129
- "state": "#{tools_state}",
130
- "version": "#{tools_version}"
131
- },
132
- "Hardware": {
133
- "cpu": {
134
- "cpus": 1
135
- },
136
- "memory": {
137
- "size": "512Mb"
138
- },
139
- "hdd0": {
140
- "enabled": true,
141
- "image": "/path/to/harddisk.hdd"
142
- },
143
- "net0": {
144
- "enabled": true,
145
- "type": "shared",
146
- "mac": "001C42F6E500",
147
- "card": "e1000",
148
- "dhcp": "yes"
149
- },
150
- "net1": {
151
- "enabled": true,
152
- "type": "bridged",
153
- "iface": "vnic4",
154
- "mac": "001C42AB0071",
155
- "card": "e1000",
156
- "ips": "33.33.33.10/255.255.255.0 "
157
- }
158
- }
159
- }
160
- ]
161
- eos
162
- subprocess_result(stdout: out)
163
- end
164
-
165
- # Returns detailed info about virtual network interface
166
- # `prlsrvctl net info <net_name>, '--json'`
167
- subprocess.stub(:execute).
168
- with('prlsrvctl', 'net', 'info', kind_of(String), '--json',
169
- kind_of(Hash)) do
170
- out = <<-eos
171
- {
172
- "Network ID": "#{vnic_options[:name]}",
173
- "Type": "host-only",
174
- "Bound To": "#{hostonly_iface}",
175
- "Parallels adapter": {
176
- "IP address": "#{vnic_options[:adapter_ip]}",
177
- "Subnet mask": "#{vnic_options[:netmask]}"
178
- },
179
- "DHCPv4 server": {
180
- "Server address": "#{vnic_options[:dhcp][:ip] || '10.37.132.1'}",
181
- "IP scope start address": "#{vnic_options[:dhcp][:lower] || '10.37.132.1'}",
182
- "IP scope end address": "#{vnic_options[:dhcp][:upper] || '10.37.132.254'}"
183
- }
184
- }
185
- eos
186
- subprocess_result(stdout: out)
187
- end
188
-
189
- # Returns values of 'name' and 'uuid' options for all registered VMs
190
- # `prlctl list --all --no-header --json -o name,uuid`
191
- subprocess.stub(:execute).
192
- with('prlctl', 'list', '--all', '--no-header', '--json', '-o', 'name,uuid',
193
- kind_of(Hash)) do
194
- out = <<-eos
195
- [
196
- {
197
- "name": "#{vm_name}",
198
- "uuid": "#{uuid}"
199
- }
200
- ]
201
- eos
202
- subprocess_result(stdout: out)
203
- end
204
-
205
- # Returns values of 'name' and 'uuid' options for all registered templates
206
- # `prlctl list --all --no-header --json -o name,uuid --template`
207
- subprocess.stub(:execute).
208
- with('prlctl', 'list', '--all', '--no-header', '--json', '-o', 'name,uuid',
209
- '--template', kind_of(Hash)) do
210
- out = <<-eos
211
- [
212
- {
213
- "name": "#{tpl_name}",
214
- "uuid": "#{tpl_uuid}"
215
- }
216
- ]
217
- eos
218
- subprocess_result(stdout: out)
219
- end
220
-
221
- # Returns value of 'mac' options for the specified VM
222
- # `prlctl list --all --no-header -o mac`
223
- subprocess.stub(:execute).
224
- with('prlctl', 'list', kind_of(String), '--no-header', '-o', 'mac',
225
- kind_of(Hash)) do
226
- subprocess_result(stdout: "00:1C:42:B4:B0:74 00:1C:42:B4:B0:90\n")
227
- end
228
-
229
- end
230
- end
@@ -1,339 +0,0 @@
1
- shared_examples 'parallels desktop driver' do |options|
2
- before do
3
- raise ArgumentError, 'Need parallels context to use these shared examples.' unless defined? parallels_context
4
- end
5
-
6
- describe 'compact' do
7
- settings = {'Hardware' => {'hdd0' => {'image' => '/path/to/disk0.hdd'},
8
- 'hdd1' => {'image' => '/path/to/disk1.hdd'}}}
9
- it 'compacts the VM disk drives' do
10
- driver.should_receive(:read_settings).and_return(settings)
11
-
12
- subprocess.should_receive(:execute).exactly(2).times.
13
- with('prl_disk_tool', 'compact', '--hdd', /^\/path\/to\/disk(0|1).hdd$/,
14
- an_instance_of(Hash)).
15
- and_return(subprocess_result(exit_code: 0))
16
- subject.compact(uuid)
17
- end
18
- end
19
-
20
- describe 'clear_shared_folders' do
21
- it 'deletes every shared folder assigned to the VM' do
22
- subprocess.should_receive(:execute).at_least(2).times.
23
- with('prlctl', 'set', uuid, '--shf-host-del', an_instance_of(String),
24
- an_instance_of(Hash)).
25
- and_return(subprocess_result(exit_code: 0))
26
- subject.clear_shared_folders
27
- end
28
- end
29
-
30
- describe 'create_host_only_network' do
31
- let(:hostonly_iface) {'vnic12'}
32
- it 'creates host-only NIC with dhcp server configured' do
33
- vnic_opts = {
34
- network_id: 'vagrant_vnic8',
35
- adapter_ip: '11.11.11.11',
36
- netmask: '255.255.252.0',
37
- dhcp: {
38
- ip: '11.11.11.11',
39
- lower: '11.11.8.1',
40
- upper: '11.11.11.254'
41
- }
42
- }
43
-
44
- subprocess.should_receive(:execute).
45
- with('prlsrvctl', 'net', 'add', vnic_opts[:network_id],
46
- '--type', 'host-only', an_instance_of(Hash)).
47
- and_return(subprocess_result(exit_code: 0))
48
-
49
- subprocess.should_receive(:execute).
50
- with('prlsrvctl', 'net', 'set', vnic_opts[:network_id],
51
- '--ip', "#{vnic_opts[:adapter_ip]}/#{vnic_opts[:netmask]}",
52
- '--dhcp-ip', vnic_opts[:dhcp][:ip],
53
- '--ip-scope-start', vnic_opts[:dhcp][:lower],
54
- '--ip-scope-end', vnic_opts[:dhcp][:upper], an_instance_of(Hash)).
55
- and_return(subprocess_result(exit_code: 0))
56
-
57
- interface = subject.create_host_only_network(vnic_opts)
58
-
59
- interface.should include(:ip => vnic_opts[:adapter_ip])
60
- interface.should include(:netmask => vnic_opts[:netmask])
61
- interface.should include(:dhcp => vnic_opts[:dhcp])
62
- # TODO: implement nicer tests for all supported PD versions
63
- # interface.should include(:name => hostonly_iface)
64
- # interface[:name].should =~ /^(vnic(\d+))$/
65
- end
66
-
67
- it 'creates host-only NIC without dhcp' do
68
- vnic_options = {
69
- network_id: 'vagrant_vnic3',
70
- adapter_ip: '22.22.22.22',
71
- netmask: '255.255.254.0',
72
- }
73
-
74
- subprocess.should_receive(:execute).
75
- with('prlsrvctl', 'net', 'add', vnic_options[:network_id],
76
- '--type', 'host-only', an_instance_of(Hash)).
77
- and_return(subprocess_result(exit_code: 0))
78
-
79
- subprocess.should_receive(:execute).
80
- with('prlsrvctl', 'net', 'set', vnic_options[:network_id],
81
- '--ip', "#{vnic_options[:adapter_ip]}/#{vnic_options[:netmask]}",
82
- an_instance_of(Hash)).
83
- and_return(subprocess_result(exit_code: 0))
84
-
85
- interface = subject.create_host_only_network(vnic_options)
86
-
87
- interface.should include(:ip => vnic_options[:adapter_ip])
88
- interface.should include(:netmask => vnic_options[:netmask])
89
- interface.should include(:dhcp => nil)
90
- # TODO: implement nicer tests for all supported PD versions
91
- # interface.should include(:name => hostonly_iface)
92
- # interface[:name].should =~ /^(vnic(\d+))$/
93
- end
94
- end
95
-
96
- describe 'delete' do
97
- it 'deletes the VM' do
98
- subprocess.should_receive(:execute).
99
- with('prlctl', 'delete', uuid, an_instance_of(Hash)).
100
- and_return(subprocess_result(exit_code: 0))
101
- subject.delete
102
- end
103
- end
104
-
105
- describe 'delete_disabled_adapters' do
106
- it 'deletes disabled networks adapters from VM config' do
107
- settings = {'Hardware' => {'net0' => {'enabled' => false},
108
- 'net1' => {'enabled' => false}}}
109
- driver.should_receive(:read_settings).and_return(settings)
110
- subprocess.should_receive(:execute).exactly(2).times.
111
- with('prlctl', 'set', uuid, '--device-del', /^net(0|1)$/,
112
- an_instance_of(Hash)).
113
- and_return(subprocess_result(exit_code: 0))
114
- subject.delete_disabled_adapters
115
- end
116
- end
117
-
118
- describe 'clone_vm' do
119
- it 'clones VM to the new one' do
120
- subprocess.should_receive(:execute).
121
- with('prlctl', 'clone', tpl_uuid, '--name', an_instance_of(String),
122
- an_instance_of(Hash)).
123
- and_return(subprocess_result(exit_code: 0))
124
- subject.clone_vm(tpl_uuid)
125
- end
126
-
127
- it 'clones VM to the exported VM' do
128
- subprocess.should_receive(:execute).
129
- with('prlctl', 'clone', uuid, '--name', an_instance_of(String),
130
- '--dst', an_instance_of(String), an_instance_of(Hash)).
131
- and_return(subprocess_result(exit_code: 0))
132
- subject.clone_vm(uuid, {dst: '/path/to/template'})
133
- end
134
- end
135
-
136
- describe 'halt' do
137
- it 'stops the VM' do
138
- subprocess.should_receive(:execute).
139
- with('prlctl', 'stop', uuid, an_instance_of(Hash)).
140
- and_return(subprocess_result(exit_code: 0))
141
- subject.halt
142
- end
143
-
144
- it 'stops the VM force' do
145
- subprocess.should_receive(:execute).
146
- with('prlctl', 'stop', uuid, '--kill', an_instance_of(Hash)).
147
- and_return(subprocess_result(exit_code: 0))
148
- subject.halt(force=true)
149
- end
150
- end
151
-
152
- describe 'read_guest_tools_state' do
153
- let(:tools_state) {'outdated'}
154
-
155
- it 'returns Guest Tools state as a symbol' do
156
- subject.read_guest_tools_state.should be(:outdated)
157
- end
158
-
159
- it "returns :not_installed if Guest Tools state can't be reached" do
160
- driver.should_receive(:read_settings).and_return(exit_code: 0)
161
- subject.read_guest_tools_state.should be(:not_installed)
162
- end
163
- end
164
-
165
- describe 'read_guest_tools_iso_path' do
166
- before do
167
- subprocess.stub(:execute).
168
- with('mdfind', /^kMDItemCFBundleIdentifier ==/, an_instance_of(Hash)).
169
- and_return(subprocess_result(stdout: '/Applications/Parallels Desktop.app'))
170
- end
171
-
172
- it 'returns a valid path to the ISO' do
173
- File.stub(:exist?).and_return(true)
174
- iso_path = subject.read_guest_tools_iso_path('linux')
175
- iso_path.should be_kind_of(String)
176
- iso_path.should match(/prl-tools-lin\.iso$/)
177
- end
178
-
179
- it 'raises an exception if ISO file does not exists' do
180
- File.stub(:exist?).and_return(false)
181
- expect { subject.read_guest_tools_iso_path('windows') }.
182
- to raise_error(VagrantPlugins::Parallels::Errors::ParallelsToolsIsoNotFound)
183
- end
184
-
185
- it 'returns nil if guest OS is unsupported or invalid' do
186
- subject.read_guest_tools_iso_path('').should be_nil
187
- subject.read_guest_tools_iso_path('bolgenos').should be_nil
188
- end
189
- end
190
-
191
- describe 'read_mac_addresses' do
192
- it 'returns MAC addresses of all network interface cards' do
193
- subject.read_mac_addresses.should be_kind_of(Array)
194
- subject.read_mac_addresses.should include('001C42B4B074')
195
- subject.read_mac_addresses.should include('001C42B4B090')
196
- end
197
- end
198
-
199
- describe 'read_settings' do
200
- it 'returns a hash with detailed info about the VM' do
201
- subject.read_settings.should be_kind_of(Hash)
202
- subject.read_settings.should include('ID' => uuid)
203
- subject.read_settings.should include('Hardware')
204
- subject.read_settings.should include('GuestTools')
205
- end
206
- end
207
-
208
- describe 'read_vm_option' do
209
- it 'returns stripped value' do
210
- subprocess.stub(:execute).
211
- with('prlctl', 'list', uuid, '--no-header', '-o', an_instance_of(String),
212
- an_instance_of(Hash)).
213
- and_return(subprocess_result(stdout: "opt_val \n"))
214
-
215
- subject.read_vm_option('supported_option').should == 'opt_val'
216
- end
217
-
218
- it 'raises an exception in option is not available' do
219
- subprocess.stub(:execute).
220
- with('prlctl', 'list', uuid, '--no-header', '-o', an_instance_of(String),
221
- an_instance_of(Hash)).
222
- and_return(subprocess_result(stdout: " \n"))
223
-
224
- expect { subject.read_vm_option('invalid_option') }.
225
- to raise_error(VagrantPlugins::Parallels::Errors::ParallelsVMOptionNotFound)
226
- end
227
- end
228
-
229
- describe 'read_vms' do
230
- it 'returns the list of all registered VMs and templates' do
231
- subject.read_vms.should be_kind_of(Hash)
232
- subject.read_vms.should have_at_least(2).items
233
- subject.read_vms.should include(vm_name => uuid)
234
- end
235
- end
236
-
237
- describe 'read_vms_info' do
238
- it 'returns detailed info about all registered VMs and templates' do
239
- subject.read_vms_info.should be_kind_of(Array)
240
- subject.read_vms_info.should have_at_least(2).items
241
-
242
- # It should include info about current VM
243
- vm_settings = driver.send(:read_settings)
244
- subject.read_vms_info.should include(vm_settings)
245
- end
246
- end
247
-
248
- describe 'register' do
249
- it 'registers specified virtual machine or template' do
250
- subprocess.should_receive(:execute).
251
- with('prlctl', 'register', an_instance_of(String), an_instance_of(Hash)).
252
- and_return(subprocess_result(exit_code: 0))
253
-
254
- subject.register('/path/to/vm_image.pvm')
255
- end
256
- end
257
-
258
- describe 'set_name' do
259
- it 'sets new name for the VM' do
260
- subprocess.should_receive(:execute).
261
- with('prlctl', 'set', uuid, '--name', an_instance_of(String),
262
- an_instance_of(Hash)).
263
- and_return(subprocess_result(exit_code: 0))
264
-
265
- subject.set_name(uuid, 'new_vm_name')
266
- end
267
- end
268
-
269
- describe 'ssh_ip' do
270
- let(:content) {'10.200.0.100="1394546410,1800,001c420000ff,01001c420000ff
271
- 10.200.0.99="1394547632,1800,001c420000ff,01001c420000ff"'}
272
-
273
- it 'returns an IP address assigned to the specified MAC' do
274
- driver.should_receive(:read_mac_address).and_return('001C420000FF')
275
- File.should_receive(:open).with(an_instance_of(String)).
276
- and_return(StringIO.new(content))
277
-
278
- subject.ssh_ip.should == '10.200.0.99'
279
- end
280
-
281
- it 'rises DhcpLeasesNotAccessible exception when file is not accessible' do
282
- File.stub(:open).and_call_original
283
- File.should_receive(:open).with(an_instance_of(String)).
284
- and_raise(Errno::EACCES)
285
- expect { subject.ssh_ip }.
286
- to raise_error(VagrantPlugins::Parallels::Errors::DhcpLeasesNotAccessible)
287
- end
288
- end
289
-
290
- describe 'start' do
291
- it 'starts the VM' do
292
- subprocess.should_receive(:execute).
293
- with('prlctl', 'start', uuid, an_instance_of(Hash)).
294
- and_return(subprocess_result(exit_code: 0))
295
- subject.start
296
- end
297
- end
298
-
299
- describe 'suspend' do
300
- it 'suspends the VM' do
301
- subprocess.should_receive(:execute).
302
- with('prlctl', 'suspend', uuid, an_instance_of(Hash)).
303
- and_return(subprocess_result(exit_code: 0))
304
- subject.suspend
305
- end
306
- end
307
-
308
- describe 'unregister' do
309
- it 'suspends the VM' do
310
- subprocess.should_receive(:execute).
311
- with('prlctl', 'unregister', an_instance_of(String),
312
- an_instance_of(Hash)).
313
- and_return(subprocess_result(exit_code: 0))
314
- subject.unregister('template_or_vm_uuid')
315
- end
316
- end
317
-
318
- describe 'version' do
319
- it 'parses the version from output' do
320
- subject.version.should match(/^#{parallels_version}.\d+\.\d+$/)
321
- end
322
-
323
- it 'raises an exception for unsupported version' do
324
- subprocess.should_receive(:execute).
325
- with('prlctl', '--version', an_instance_of(Hash)).
326
- and_return(subprocess_result(stdout: 'prlctl version 7.0.12345'))
327
- expect { subject.version }.
328
- to raise_error(VagrantPlugins::Parallels::Errors::ParallelsUnsupportedVersion)
329
- end
330
-
331
- it 'raises an exception for invalid version output' do
332
- subprocess.should_receive(:execute).
333
- with('prlctl', '--version', an_instance_of(Hash)).
334
- and_return(subprocess_result(stdout: 'prlctl version 1.2.foo.bar'))
335
- expect { subject.version }.
336
- to raise_error(VagrantPlugins::Parallels::Errors::ParallelsInvalidVersion)
337
- end
338
- end
339
- end