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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -0
- data/LICENSE.txt +1 -1
- data/lib/vagrant-parallels/action.rb +7 -0
- data/lib/vagrant-parallels/action/box_unregister.rb +3 -0
- data/lib/vagrant-parallels/action/check_shared_interface.rb +29 -0
- data/lib/vagrant-parallels/action/clear_forwarded_ports.rb +3 -2
- data/lib/vagrant-parallels/action/export.rb +69 -6
- data/lib/vagrant-parallels/action/forward_ports.rb +1 -1
- data/lib/vagrant-parallels/action/network.rb +8 -10
- data/lib/vagrant-parallels/action/sane_defaults.rb +2 -1
- data/lib/vagrant-parallels/cap.rb +0 -1
- data/lib/vagrant-parallels/config.rb +18 -8
- data/lib/vagrant-parallels/driver/base.rb +68 -24
- data/lib/vagrant-parallels/driver/meta.rb +3 -1
- data/lib/vagrant-parallels/driver/pd_10.rb +36 -39
- data/lib/vagrant-parallels/driver/pd_11.rb +4 -0
- data/lib/vagrant-parallels/driver/pd_8.rb +31 -27
- data/lib/vagrant-parallels/errors.rb +10 -2
- data/lib/vagrant-parallels/version.rb +1 -1
- data/locales/en.yml +25 -9
- metadata +4 -29
- data/.gitignore +0 -34
- data/.travis.yml +0 -10
- data/CONTRIBUTING.md +0 -80
- data/Gemfile +0 -14
- data/Rakefile +0 -21
- data/debug.log +0 -1237
- data/tasks/acceptance.rake +0 -28
- data/tasks/bundler.rake +0 -3
- data/tasks/test.rake +0 -8
- data/test/acceptance/base.rb +0 -2
- data/test/acceptance/provider/linked_clone_spec.rb +0 -30
- data/test/acceptance/provider/snapshot_spec.rb +0 -63
- data/test/acceptance/shared/context_parallels.rb +0 -2
- data/test/acceptance/skeletons/linked_clone/Vagrantfile +0 -7
- data/test/unit/base.rb +0 -24
- data/test/unit/cap_test.rb +0 -96
- data/test/unit/config_test.rb +0 -91
- data/test/unit/driver/pd_10_test.rb +0 -31
- data/test/unit/driver/pd_8_test.rb +0 -10
- data/test/unit/driver/pd_9_test.rb +0 -29
- data/test/unit/support/shared/parallels_context.rb +0 -230
- data/test/unit/support/shared/pd_driver_examples.rb +0 -339
- data/test/unit/synced_folder_test.rb +0 -49
- data/vagrant-parallels.gemspec +0 -59
- data/vagrant-spec.config.example.rb +0 -10
data/tasks/acceptance.rake
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
namespace :acceptance do
|
2
|
-
desc 'shows components that can be tested separately'
|
3
|
-
task :components do
|
4
|
-
exec('vagrant-spec components')
|
5
|
-
end
|
6
|
-
|
7
|
-
desc 'runs acceptance tests using vagrant-spec'
|
8
|
-
task :run do
|
9
|
-
components = %w(
|
10
|
-
basic
|
11
|
-
linked_clone
|
12
|
-
network/forwarded_port
|
13
|
-
network/private_network
|
14
|
-
snapshot
|
15
|
-
synced_folder
|
16
|
-
synced_folder/nfs
|
17
|
-
synced_folder/rsync
|
18
|
-
provisioner/shell
|
19
|
-
provisioner/chef-solo
|
20
|
-
package
|
21
|
-
).map{ |s| "provider/parallels/#{s}" }
|
22
|
-
|
23
|
-
command = "vagrant-spec test --components=#{components.join(' ')}"
|
24
|
-
puts command
|
25
|
-
puts
|
26
|
-
exec(command)
|
27
|
-
end
|
28
|
-
end
|
data/tasks/bundler.rake
DELETED
data/tasks/test.rake
DELETED
data/test/acceptance/base.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# This tests that VM is up as a linked clone
|
2
|
-
shared_examples 'provider/linked_clone' do |provider, options|
|
3
|
-
if !options[:box]
|
4
|
-
raise ArgumentError,
|
5
|
-
"box option must be specified for provider: #{provider}"
|
6
|
-
end
|
7
|
-
|
8
|
-
include_context 'acceptance'
|
9
|
-
|
10
|
-
before do
|
11
|
-
environment.skeleton('linked_clone')
|
12
|
-
assert_execute('vagrant', 'box', 'add', 'basic', options[:box])
|
13
|
-
end
|
14
|
-
|
15
|
-
after do
|
16
|
-
assert_execute('vagrant', 'destroy', '--force')
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'creates machine as linked clone' do
|
20
|
-
status('Test: machine is created as a linked clone')
|
21
|
-
result = execute('vagrant', 'up', "--provider=#{provider}")
|
22
|
-
expect(result).to exit_with(0)
|
23
|
-
expect(result.stdout).to match(/linked clone/)
|
24
|
-
|
25
|
-
status('Test: machine is available by ssh')
|
26
|
-
result = execute('vagrant', 'ssh', '-c', 'echo foo')
|
27
|
-
expect(result).to exit_with(0)
|
28
|
-
expect(result.stdout).to match(/foo\n$/)
|
29
|
-
end
|
30
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
shared_examples 'provider/snapshot' do |provider, options|
|
2
|
-
if !options[:box]
|
3
|
-
raise ArgumentError,
|
4
|
-
"box option must be specified for provider: #{provider}"
|
5
|
-
end
|
6
|
-
|
7
|
-
include_context 'acceptance'
|
8
|
-
|
9
|
-
before do
|
10
|
-
assert_execute('vagrant', 'box', 'add', 'box', options[:box])
|
11
|
-
assert_execute('vagrant', 'init', 'box')
|
12
|
-
assert_execute('vagrant', 'up', "--provider=#{provider}")
|
13
|
-
end
|
14
|
-
|
15
|
-
after do
|
16
|
-
assert_execute('vagrant', 'destroy', '--force')
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'can save, list and delete machine snapshots' do
|
20
|
-
status('Test: two snapshots could be created')
|
21
|
-
assert_execute('vagrant', 'snapshot', 'save', 'foo')
|
22
|
-
assert_execute('vagrant', 'snapshot', 'save', 'bar')
|
23
|
-
|
24
|
-
status('Test: snapshots show up in list')
|
25
|
-
result = execute('vagrant', 'snapshot', 'list')
|
26
|
-
expect(result).to exit_with(0)
|
27
|
-
expect(result.stdout).to match(/^foo$/)
|
28
|
-
expect(result.stdout).to match(/^bar$/)
|
29
|
-
|
30
|
-
status('Test: snapshots could be restored')
|
31
|
-
assert_execute('vagrant', 'snapshot', 'restore', 'foo')
|
32
|
-
assert_execute('vagrant', 'snapshot', 'restore', 'bar')
|
33
|
-
|
34
|
-
status('Test: snapshots could be deleted')
|
35
|
-
assert_execute('vagrant', 'snapshot', 'delete', 'foo')
|
36
|
-
assert_execute('vagrant', 'snapshot', 'delete', 'bar')
|
37
|
-
|
38
|
-
result = execute('vagrant', 'snapshot', 'list')
|
39
|
-
expect(result).to exit_with(0)
|
40
|
-
expect(result.stdout).not_to match(/^foo$/)
|
41
|
-
expect(result.stdout).not_to match(/^bar$/)
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'can push and pop snapshots' do
|
45
|
-
status('Test: snapshot push')
|
46
|
-
result = execute('vagrant', 'snapshot', 'push')
|
47
|
-
expect(result).to exit_with(0)
|
48
|
-
expect(result.stdout).to match(/push_/)
|
49
|
-
|
50
|
-
status('Test: pushed snapshot shows up in list')
|
51
|
-
result = execute('vagrant', 'snapshot', 'list')
|
52
|
-
expect(result).to exit_with(0)
|
53
|
-
expect(result.stdout).to match(/^push_/)
|
54
|
-
|
55
|
-
status('Test: snapshot pop')
|
56
|
-
assert_execute('vagrant', 'snapshot', 'pop')
|
57
|
-
|
58
|
-
status('Test: popped snapshot has been deleted')
|
59
|
-
result = execute('vagrant', 'snapshot', 'list')
|
60
|
-
expect(result).to exit_with(0)
|
61
|
-
expect(result.stdout).not_to match(/push_/)
|
62
|
-
end
|
63
|
-
end
|
data/test/unit/base.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rspec/autorun'
|
3
|
-
|
4
|
-
# Require Vagrant itself so we can reference the proper
|
5
|
-
# classes to test.
|
6
|
-
require 'vagrant'
|
7
|
-
require 'vagrant-parallels'
|
8
|
-
require 'vagrant-spec/unit'
|
9
|
-
|
10
|
-
# Add the test directory to the load path
|
11
|
-
$:.unshift File.expand_path('../../', __FILE__)
|
12
|
-
|
13
|
-
# Load in helpers
|
14
|
-
require 'unit/support/shared/parallels_context'
|
15
|
-
require 'unit/support/shared/pd_driver_examples'
|
16
|
-
|
17
|
-
# Do not buffer output
|
18
|
-
$stdout.sync = true
|
19
|
-
$stderr.sync = true
|
20
|
-
|
21
|
-
# Configure RSpec
|
22
|
-
RSpec.configure do |c|
|
23
|
-
c.expect_with :rspec, :stdlib
|
24
|
-
end
|
data/test/unit/cap_test.rb
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
require_relative 'base'
|
2
|
-
|
3
|
-
require 'vagrant-parallels/cap'
|
4
|
-
|
5
|
-
describe VagrantPlugins::Parallels::Cap do
|
6
|
-
include_context 'vagrant-unit'
|
7
|
-
|
8
|
-
let(:iso_env) do
|
9
|
-
# We have to create a Vagrantfile so there is a root path
|
10
|
-
env = isolated_environment
|
11
|
-
env.vagrantfile('')
|
12
|
-
env.create_vagrant_env
|
13
|
-
end
|
14
|
-
|
15
|
-
let(:machine) do
|
16
|
-
iso_env.machine(iso_env.machine_names[0], :dummy).tap do |m|
|
17
|
-
m.provider.stub(driver: driver)
|
18
|
-
m.stub(state: state)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
let(:driver) { double('driver') }
|
23
|
-
let(:state) { double('state', id: :running) }
|
24
|
-
|
25
|
-
describe '#forwarded_ports' do
|
26
|
-
it 'returns all the forwarded ports' do
|
27
|
-
allow(driver).to receive(:read_forwarded_ports).and_return([
|
28
|
-
{ hostport: 123, guestport: 456 },
|
29
|
-
{ hostport: 245, guestport: 245 }
|
30
|
-
])
|
31
|
-
|
32
|
-
expect(described_class.forwarded_ports(machine)).to eq({
|
33
|
-
123 => 456,
|
34
|
-
245 => 245,
|
35
|
-
})
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'returns nil when the machine is not running' do
|
39
|
-
allow(state).to receive(:id).and_return(:stopped)
|
40
|
-
expect(described_class.forwarded_ports(machine)).to be(nil)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe '#host_address' do
|
45
|
-
it "returns host's IP of Shared interface" do
|
46
|
-
allow(driver).to receive(:read_shared_interface).and_return(ip: '1.2.3.4')
|
47
|
-
expect(described_class.host_address(machine)).to eq('1.2.3.4')
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe '#nic_mac_addresses' do
|
52
|
-
it 'returns a hash with MAC addresses' do
|
53
|
-
allow(driver).to receive(:read_mac_addresses).and_return(
|
54
|
-
['001A2B3C4D5E', '005E4D3C2B1A'])
|
55
|
-
expect(described_class.nic_mac_addresses(machine)).to eq({
|
56
|
-
1 => '001A2B3C4D5E',
|
57
|
-
2 => '005E4D3C2B1A'
|
58
|
-
})
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'returns an empty hash when there are no NICs' do
|
62
|
-
allow(driver).to receive(:read_mac_addresses).and_return([])
|
63
|
-
expect(described_class.nic_mac_addresses(machine)).to eq({})
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
describe '#public_address' do
|
68
|
-
it "returns VM's IP" do
|
69
|
-
allow(machine).to receive(:ssh_info).and_return(host: '1.2.3.4')
|
70
|
-
expect(described_class.public_address(machine)).to eq('1.2.3.4')
|
71
|
-
end
|
72
|
-
|
73
|
-
it "returns nil when the machine is not running" do
|
74
|
-
allow(state).to receive(:id).and_return(:stopped)
|
75
|
-
expect(described_class.public_address(machine)).to be(nil)
|
76
|
-
end
|
77
|
-
|
78
|
-
it "returns nil when there is no ssh info" do
|
79
|
-
allow(machine).to receive(:ssh_info).and_return(nil)
|
80
|
-
expect(described_class.public_address(machine)).to be(nil)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
describe '#snapshot_list' do
|
85
|
-
it 'returns a list of snapshots' do
|
86
|
-
allow(machine).to receive(:id).and_return('foo')
|
87
|
-
allow(driver).to receive(:list_snapshots).with('foo').and_return({
|
88
|
-
'snap_name_1' => 'snap_uuid_1',
|
89
|
-
'snap_name_2' => 'snap_uuid_2'
|
90
|
-
})
|
91
|
-
|
92
|
-
expect(described_class.snapshot_list(machine)).to eq(
|
93
|
-
['snap_name_1', 'snap_name_2'])
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
data/test/unit/config_test.rb
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
require_relative 'base'
|
2
|
-
|
3
|
-
require VagrantPlugins::Parallels.source_root.join('lib/vagrant-parallels/config')
|
4
|
-
|
5
|
-
describe VagrantPlugins::Parallels::Config do
|
6
|
-
let(:machine) { double('machine') }
|
7
|
-
|
8
|
-
def assert_invalid
|
9
|
-
errors = subject.validate(machine)
|
10
|
-
if !errors.values.any? { |v| !v.empty? }
|
11
|
-
raise "No errors: #{errors.inspect}"
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def assert_valid
|
16
|
-
errors = subject.validate(machine)
|
17
|
-
if !errors.values.all? { |v| v.empty? }
|
18
|
-
raise "Errors: #{errors.inspect}"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def valid_defaults
|
23
|
-
subject.image = 'foo'
|
24
|
-
end
|
25
|
-
|
26
|
-
before do
|
27
|
-
vm_config = double('vm_config')
|
28
|
-
vm_config.stub(networks: [])
|
29
|
-
config = double('config')
|
30
|
-
config.stub(vm: vm_config)
|
31
|
-
machine.stub(config: config)
|
32
|
-
end
|
33
|
-
|
34
|
-
its 'valid by default' do
|
35
|
-
subject.finalize!
|
36
|
-
assert_valid
|
37
|
-
end
|
38
|
-
|
39
|
-
context 'defaults' do
|
40
|
-
before { subject.finalize! }
|
41
|
-
|
42
|
-
it { expect(subject.check_guest_additions).to be_true }
|
43
|
-
it { expect(subject.name).to be_nil }
|
44
|
-
it { expect(subject.functional_psf).to be_true }
|
45
|
-
it { expect(subject.optimize_power_consumption).to be_true }
|
46
|
-
|
47
|
-
it 'should have one Shared adapter' do
|
48
|
-
expect(subject.network_adapters).to eql({
|
49
|
-
0 => [:shared, {}],
|
50
|
-
})
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
describe '#merge' do
|
55
|
-
let(:one) { described_class.new }
|
56
|
-
let(:two) { described_class.new }
|
57
|
-
|
58
|
-
subject { one.merge(two) }
|
59
|
-
|
60
|
-
it 'merges the customizations' do
|
61
|
-
one.customize ['foo']
|
62
|
-
two.customize ['bar']
|
63
|
-
|
64
|
-
expect(subject.customizations).to eq([
|
65
|
-
['pre-boot', ['foo']],
|
66
|
-
['pre-boot', ['bar']]])
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe 'memory=' do
|
71
|
-
it 'configures memory size (in Mb)' do
|
72
|
-
subject.memory=(1024)
|
73
|
-
expect(subject.customizations).to include(['pre-boot', ['set', :id, '--memsize', '1024']])
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
describe 'cpus=' do
|
78
|
-
it 'configures count of cpus' do
|
79
|
-
subject.cpus=('4')
|
80
|
-
expect(subject.customizations).to include(['pre-boot', ['set', :id, '--cpus', 4]])
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
describe '#network_adapter' do
|
85
|
-
it 'configures additional adapters' do
|
86
|
-
subject.network_adapter(2, :bridged, auto_config: true)
|
87
|
-
expect(subject.network_adapters[2]).to eql(
|
88
|
-
[:bridged, auto_config: true])
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require_relative '../base'
|
2
|
-
|
3
|
-
describe VagrantPlugins::Parallels::Driver::PD_10 do
|
4
|
-
include_context 'parallels'
|
5
|
-
let(:parallels_version) { '10' }
|
6
|
-
|
7
|
-
subject { VagrantPlugins::Parallels::Driver::Meta.new(uuid) }
|
8
|
-
|
9
|
-
it_behaves_like 'parallels desktop driver'
|
10
|
-
|
11
|
-
describe 'set_power_consumption_mode' do
|
12
|
-
it "turns 'longer-battery-life' on" do
|
13
|
-
subprocess.should_receive(:execute).
|
14
|
-
with('prlctl', 'set', uuid, '--longer-battery-life', 'on',
|
15
|
-
an_instance_of(Hash)).
|
16
|
-
and_return(subprocess_result(exit_code: 0))
|
17
|
-
|
18
|
-
subject.set_power_consumption_mode(true)
|
19
|
-
end
|
20
|
-
|
21
|
-
it "turns 'longer-battery-life' off" do
|
22
|
-
subprocess.should_receive(:execute).
|
23
|
-
with('prlctl', 'set', uuid, '--longer-battery-life', 'off',
|
24
|
-
an_instance_of(Hash)).
|
25
|
-
and_return(subprocess_result(exit_code: 0))
|
26
|
-
|
27
|
-
subject.set_power_consumption_mode(false)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
require_relative '../base'
|
2
|
-
|
3
|
-
describe VagrantPlugins::Parallels::Driver::PD_8 do
|
4
|
-
include_context 'parallels'
|
5
|
-
let(:parallels_version) { '8' }
|
6
|
-
|
7
|
-
subject { VagrantPlugins::Parallels::Driver::Meta.new(uuid) }
|
8
|
-
|
9
|
-
it_behaves_like 'parallels desktop driver'
|
10
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require_relative '../base'
|
2
|
-
|
3
|
-
describe VagrantPlugins::Parallels::Driver::PD_9 do
|
4
|
-
include_context 'parallels'
|
5
|
-
|
6
|
-
subject { VagrantPlugins::Parallels::Driver::Meta.new(uuid) }
|
7
|
-
|
8
|
-
it_behaves_like 'parallels desktop driver'
|
9
|
-
|
10
|
-
describe 'set_power_consumption_mode' do
|
11
|
-
it "turns 'longer-battery-life' on" do
|
12
|
-
subprocess.should_receive(:execute).
|
13
|
-
with('prlctl', 'set', uuid, '--longer-battery-life', 'on',
|
14
|
-
an_instance_of(Hash)).
|
15
|
-
and_return(subprocess_result(exit_code: 0))
|
16
|
-
|
17
|
-
subject.set_power_consumption_mode(true)
|
18
|
-
end
|
19
|
-
|
20
|
-
it "turns 'longer-battery-life' off" do
|
21
|
-
subprocess.should_receive(:execute).
|
22
|
-
with('prlctl', 'set', uuid, '--longer-battery-life', 'off',
|
23
|
-
an_instance_of(Hash)).
|
24
|
-
and_return(subprocess_result(exit_code: 0))
|
25
|
-
|
26
|
-
subject.set_power_consumption_mode(false)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|