vagrant 0.7.0.beta → 0.7.0.beta2
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.
- data/.gitignore +2 -0
- data/CHANGELOG.md +26 -0
- data/Gemfile +0 -8
- data/config/default.rb +1 -2
- data/contrib/README.md +12 -0
- data/contrib/emacs/vagrant.el +8 -0
- data/contrib/vim/vagrantfile.vim +9 -0
- data/lib/vagrant.rb +14 -18
- data/lib/vagrant/action.rb +12 -0
- data/lib/vagrant/action/box.rb +11 -0
- data/lib/vagrant/action/box/download.rb +0 -1
- data/lib/vagrant/action/env.rb +7 -0
- data/lib/vagrant/action/general.rb +8 -0
- data/lib/vagrant/action/vm.rb +30 -0
- data/lib/vagrant/action/vm/boot.rb +3 -2
- data/lib/vagrant/action/vm/check_box.rb +1 -0
- data/lib/vagrant/action/vm/network.rb +1 -1
- data/lib/vagrant/action/vm/nfs.rb +3 -1
- data/lib/vagrant/action/vm/provision.rb +14 -25
- data/lib/vagrant/action/vm/share_folders.rb +11 -4
- data/lib/vagrant/command.rb +25 -0
- data/lib/vagrant/config.rb +78 -128
- data/lib/vagrant/config/base.rb +17 -3
- data/lib/vagrant/config/ssh.rb +1 -0
- data/lib/vagrant/config/top.rb +61 -0
- data/lib/vagrant/config/vagrant.rb +1 -6
- data/lib/vagrant/config/vm.rb +34 -20
- data/lib/vagrant/config/vm/provisioner.rb +56 -0
- data/lib/vagrant/config/vm/sub_vm.rb +17 -0
- data/lib/vagrant/downloaders.rb +7 -0
- data/lib/vagrant/downloaders/file.rb +1 -0
- data/lib/vagrant/downloaders/http.rb +9 -0
- data/lib/vagrant/environment.rb +25 -13
- data/lib/vagrant/errors.rb +0 -15
- data/lib/vagrant/hosts.rb +7 -0
- data/lib/vagrant/provisioners.rb +8 -0
- data/lib/vagrant/provisioners/base.rb +19 -1
- data/lib/vagrant/provisioners/chef.rb +31 -52
- data/lib/vagrant/provisioners/chef_server.rb +34 -10
- data/lib/vagrant/provisioners/chef_solo.rb +31 -9
- data/lib/vagrant/provisioners/puppet.rb +70 -60
- data/lib/vagrant/provisioners/puppet_server.rb +57 -0
- data/lib/vagrant/ssh.rb +3 -72
- data/lib/vagrant/ssh/session.rb +81 -0
- data/lib/vagrant/systems.rb +9 -0
- data/lib/vagrant/systems/base.rb +16 -1
- data/lib/vagrant/systems/debian.rb +26 -0
- data/lib/vagrant/systems/gentoo.rb +27 -0
- data/lib/vagrant/systems/linux.rb +14 -56
- data/lib/vagrant/systems/linux/config.rb +21 -0
- data/lib/vagrant/systems/linux/error.rb +9 -0
- data/lib/vagrant/systems/redhat.rb +31 -0
- data/lib/vagrant/test_helpers.rb +1 -1
- data/lib/vagrant/version.rb +1 -1
- data/lib/vagrant/vm.rb +25 -5
- data/templates/chef_solo_solo.erb +11 -3
- data/templates/locales/en.yml +65 -25
- data/templates/{network_entry.erb → network_entry_debian.erb} +0 -0
- data/templates/network_entry_gentoo.erb +7 -0
- data/templates/network_entry_redhat.erb +8 -0
- data/test/vagrant/action/vm/check_box_test.rb +1 -0
- data/test/vagrant/action/vm/nfs_test.rb +7 -1
- data/test/vagrant/action/vm/provision_test.rb +24 -79
- data/test/vagrant/action/vm/share_folders_test.rb +6 -1
- data/test/vagrant/command/helpers_test.rb +2 -2
- data/test/vagrant/config/base_test.rb +0 -6
- data/test/vagrant/config/vagrant_test.rb +0 -8
- data/test/vagrant/config/vm/provisioner_test.rb +92 -0
- data/test/vagrant/config/vm_test.rb +8 -0
- data/test/vagrant/config_test.rb +49 -89
- data/test/vagrant/downloaders/file_test.rb +18 -4
- data/test/vagrant/environment_test.rb +36 -12
- data/test/vagrant/provisioners/base_test.rb +28 -1
- data/test/vagrant/provisioners/chef_server_test.rb +50 -41
- data/test/vagrant/provisioners/chef_solo_test.rb +39 -16
- data/test/vagrant/provisioners/chef_test.rb +11 -81
- data/test/vagrant/provisioners/puppet_server_test.rb +69 -0
- data/test/vagrant/provisioners/puppet_test.rb +69 -54
- data/test/vagrant/{ssh_session_test.rb → ssh/session_test.rb} +0 -0
- data/test/vagrant/ssh_test.rb +12 -1
- data/test/vagrant/systems/base_test.rb +18 -0
- data/test/vagrant/systems/linux_test.rb +2 -2
- data/test/vagrant/vm_test.rb +33 -5
- data/vagrant.gemspec +6 -5
- metadata +42 -16
- data/lib/vagrant/util/glob_loader.rb +0 -24
@@ -116,6 +116,7 @@ class ShareFoldersVMActionTest < Test::Unit::TestCase
|
|
116
116
|
@folders = stub_shared_folders(<<-sf)
|
117
117
|
config.vm.share_folder("foo", "fooguest", "foohost")
|
118
118
|
config.vm.share_folder("bar", "barguest", "barhost")
|
119
|
+
config.vm.share_folder("foo_no_mount", nil, "foohost2")
|
119
120
|
sf
|
120
121
|
@ssh = mock("ssh")
|
121
122
|
@vm.ssh.stubs(:execute).yields(@ssh)
|
@@ -125,7 +126,11 @@ class ShareFoldersVMActionTest < Test::Unit::TestCase
|
|
125
126
|
should "mount all shared folders to the VM" do
|
126
127
|
mount_seq = sequence("mount_seq")
|
127
128
|
@folders.each do |name, data|
|
128
|
-
|
129
|
+
if data[:guestpath]
|
130
|
+
@vm.system.expects(:mount_shared_folder).with(@ssh, name, data[:guestpath]).in_sequence(mount_seq)
|
131
|
+
else
|
132
|
+
@vm.system.expects(:mount_shared_folder).with(@ssh, name, anything).never
|
133
|
+
end
|
129
134
|
end
|
130
135
|
|
131
136
|
@instance.mount_shared_folders
|
@@ -52,7 +52,7 @@ class CommandHelpersTest < Test::Unit::TestCase
|
|
52
52
|
should "return the VM if no name is specified" do
|
53
53
|
instance = command([], @env)
|
54
54
|
assert_nothing_raised {
|
55
|
-
assert_equal @env.vms.values, instance.target_vms
|
55
|
+
assert_equal @env.vms.values.sort, instance.target_vms.sort
|
56
56
|
}
|
57
57
|
end
|
58
58
|
end
|
@@ -64,7 +64,7 @@ class CommandHelpersTest < Test::Unit::TestCase
|
|
64
64
|
|
65
65
|
should "return all the VMs if no name is specified" do
|
66
66
|
instance = command([], @env)
|
67
|
-
assert_equal @env.vms.values, instance.target_vms
|
67
|
+
assert_equal @env.vms.values.sort, instance.target_vms.sort
|
68
68
|
end
|
69
69
|
|
70
70
|
should "return only the specified VM if a name is given" do
|
@@ -42,12 +42,6 @@ class ConfigBaseTest < Test::Unit::TestCase
|
|
42
42
|
assert_equal @json, @base.to_json
|
43
43
|
end
|
44
44
|
|
45
|
-
should "not include env in the JSON hash" do
|
46
|
-
@base.env = "FOO"
|
47
|
-
hash = @base.instance_variables_hash
|
48
|
-
assert !hash.has_key?(:env)
|
49
|
-
end
|
50
|
-
|
51
45
|
should "not include top in the JSON hash" do
|
52
46
|
@base.top = "FOO"
|
53
47
|
hash = @base.instance_variables_hash
|
@@ -8,7 +8,6 @@ class ConfigVagrantTest < Test::Unit::TestCase
|
|
8
8
|
context "validation" do
|
9
9
|
setup do
|
10
10
|
@config.dotfile_name = "foo"
|
11
|
-
@config.home = "foo"
|
12
11
|
@config.host = "foo"
|
13
12
|
|
14
13
|
@errors = Vagrant::Config::ErrorRecorder.new
|
@@ -26,13 +25,6 @@ class ConfigVagrantTest < Test::Unit::TestCase
|
|
26
25
|
assert !@errors.errors.empty?
|
27
26
|
end
|
28
27
|
|
29
|
-
should "be invalid with no home" do
|
30
|
-
@config.home = nil
|
31
|
-
|
32
|
-
@config.validate(@errors)
|
33
|
-
assert !@errors.errors.empty?
|
34
|
-
end
|
35
|
-
|
36
28
|
should "be invalid with no host" do
|
37
29
|
@config.host = nil
|
38
30
|
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class ConfigVMProvisionerTest < Test::Unit::TestCase
|
4
|
+
setup do
|
5
|
+
@klass = Vagrant::Config::VMConfig::Provisioner
|
6
|
+
@top = Vagrant::Config::Top.new(nil)
|
7
|
+
end
|
8
|
+
|
9
|
+
context "initializing" do
|
10
|
+
should "expose the top instance that the provisioner belongs to" do
|
11
|
+
instance = @klass.new(@top, :chef_solo)
|
12
|
+
assert_equal @top, instance.top
|
13
|
+
end
|
14
|
+
|
15
|
+
should "expose the shortcut used" do
|
16
|
+
instance = @klass.new(@top, :chef_solo)
|
17
|
+
assert_equal :chef_solo, instance.shortcut
|
18
|
+
end
|
19
|
+
|
20
|
+
should "expose the provisioner class if its a valid shortcut" do
|
21
|
+
instance = @klass.new(@top, :chef_solo)
|
22
|
+
assert_equal Vagrant::Provisioners::ChefSolo, instance.provisioner
|
23
|
+
end
|
24
|
+
|
25
|
+
should "expose the provisioner class if its a valid class" do
|
26
|
+
instance = @klass.new(@top, Vagrant::Provisioners::ChefSolo)
|
27
|
+
assert_equal Vagrant::Provisioners::ChefSolo, instance.provisioner
|
28
|
+
end
|
29
|
+
|
30
|
+
should "have a nil provisioner class if invalid" do
|
31
|
+
instance = @klass.new(@top, :i_shall_never_exist)
|
32
|
+
assert_nil instance.provisioner
|
33
|
+
end
|
34
|
+
|
35
|
+
should "have a nil config instance if invalid" do
|
36
|
+
instance = @klass.new(@top, :i_shall_never_exist)
|
37
|
+
assert_nil instance.config
|
38
|
+
end
|
39
|
+
|
40
|
+
should "set the top of the config object to the given top" do
|
41
|
+
instance = @klass.new(@top, :chef_solo)
|
42
|
+
assert_equal @top, instance.config.top
|
43
|
+
end
|
44
|
+
|
45
|
+
should "configure the provisioner if valid" do
|
46
|
+
instance = @klass.new(@top, :chef_solo) do |chef|
|
47
|
+
chef.cookbooks_path = "foo"
|
48
|
+
end
|
49
|
+
|
50
|
+
assert_equal "foo", instance.config.cookbooks_path
|
51
|
+
end
|
52
|
+
|
53
|
+
should "configure the provisioner with a hash if valid" do
|
54
|
+
instance = @klass.new(@top, :chef_solo, :cookbooks_path => "foo")
|
55
|
+
assert_equal "foo", instance.config.cookbooks_path
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
context "validation" do
|
60
|
+
setup do
|
61
|
+
@errors = Vagrant::Config::ErrorRecorder.new
|
62
|
+
end
|
63
|
+
|
64
|
+
should "be invalid if provisioner is valid" do
|
65
|
+
instance = @klass.new(@top, :i_shall_never_exist)
|
66
|
+
instance.validate(@errors)
|
67
|
+
assert !@errors.errors.empty?
|
68
|
+
end
|
69
|
+
|
70
|
+
should "be invalid if provisioner doesn't inherit from provisioners base" do
|
71
|
+
klass = Class.new
|
72
|
+
instance = @klass.new(@top, klass)
|
73
|
+
instance.validate(@errors)
|
74
|
+
assert !@errors.errors.empty?
|
75
|
+
end
|
76
|
+
|
77
|
+
should "be valid with a valid provisioner" do
|
78
|
+
instance = @klass.new(@top, :chef_solo) do |chef|
|
79
|
+
chef.add_recipe "foo"
|
80
|
+
end
|
81
|
+
|
82
|
+
instance.validate(@errors)
|
83
|
+
assert @errors.errors.empty?
|
84
|
+
end
|
85
|
+
|
86
|
+
should "be invalid if a provisioner's config is invalid" do
|
87
|
+
instance = @klass.new(@top, :chef_solo)
|
88
|
+
instance.validate(@errors)
|
89
|
+
assert !@errors.errors.empty?
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -75,4 +75,12 @@ class ConfigVMTest < Test::Unit::TestCase
|
|
75
75
|
assert_equal @username, @config.shared_folder_gid
|
76
76
|
end
|
77
77
|
end
|
78
|
+
|
79
|
+
context "deprecated config" do
|
80
|
+
should "raise an error for provisioner=" do
|
81
|
+
assert_raises(Vagrant::Errors::VagrantError) {
|
82
|
+
@config.provisioner = :chef_solo
|
83
|
+
}
|
84
|
+
end
|
85
|
+
end
|
78
86
|
end
|
data/test/vagrant/config_test.rb
CHANGED
@@ -5,117 +5,79 @@ class ConfigTest < Test::Unit::TestCase
|
|
5
5
|
@klass = Vagrant::Config
|
6
6
|
end
|
7
7
|
|
8
|
-
context "with
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
8
|
+
context "with the class" do
|
9
|
+
should "allow access to the last proc" do
|
10
|
+
foo = mock("object")
|
11
|
+
foo.expects(:call).once
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
@klass.run { |config| foo.call }
|
14
|
+
value = @klass.last_proc.first
|
15
|
+
assert value.is_a?(Proc)
|
16
|
+
value.call(nil)
|
17
17
|
|
18
|
-
|
19
|
-
seq = sequence("sequence")
|
20
|
-
@klass.expects(:reset!).with(@env).in_sequence(seq)
|
21
|
-
@klass.expects(:execute!).in_sequence(seq)
|
22
|
-
@instance.load!
|
18
|
+
assert @klass.last_proc.nil?
|
23
19
|
end
|
20
|
+
end
|
24
21
|
|
25
|
-
|
26
|
-
|
27
|
-
@instance
|
28
|
-
result = @instance.load!
|
29
|
-
|
30
|
-
assert_equal "bar", result.vm.box
|
22
|
+
context "with an instance" do
|
23
|
+
setup do
|
24
|
+
@instance = @klass.new
|
31
25
|
end
|
32
26
|
|
33
|
-
should "
|
34
|
-
|
35
|
-
queue << Proc.new { |config| config.vm.box = "foo" }
|
36
|
-
queue << Proc.new { |config| config.vm.box = "bar" }
|
37
|
-
@instance.queue << queue
|
38
|
-
result = @instance.load!
|
27
|
+
should "load the config files in the given order" do
|
28
|
+
names = %w{alpha beta gamma}
|
39
29
|
|
40
|
-
|
41
|
-
end
|
30
|
+
@instance.load_order = [:alpha, :beta]
|
42
31
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
32
|
+
names.each do |name|
|
33
|
+
vagrantfile(vagrant_box(name), "config.vm.box = '#{name}'")
|
34
|
+
@instance.set(name.to_sym, vagrant_box(name).join("Vagrantfile"))
|
35
|
+
end
|
47
36
|
|
48
|
-
@instance.
|
49
|
-
|
37
|
+
config = @instance.load(nil)
|
38
|
+
assert_equal "beta", config.vm.box
|
50
39
|
end
|
51
40
|
|
52
|
-
should "
|
53
|
-
|
54
|
-
|
55
|
-
@instance.
|
41
|
+
should "load the config as procs" do
|
42
|
+
@instance.set(:proc, Proc.new { |config| config.vm.box = "proc" })
|
43
|
+
@instance.load_order = [:proc]
|
44
|
+
config = @instance.load(nil)
|
56
45
|
|
57
|
-
|
58
|
-
@instance.load!
|
46
|
+
assert_equal "proc", config.vm.box
|
59
47
|
end
|
60
48
|
|
61
|
-
should "
|
62
|
-
@instance.
|
63
|
-
|
64
|
-
@instance.
|
49
|
+
should "load an array of procs" do
|
50
|
+
@instance.set(:proc, [Proc.new { |config| config.vm.box = "proc" },
|
51
|
+
Proc.new { |config| config.vm.box = "proc2" }])
|
52
|
+
@instance.load_order = [:proc]
|
53
|
+
config = @instance.load(nil)
|
65
54
|
|
66
|
-
|
67
|
-
@instance.load!
|
68
|
-
}
|
55
|
+
assert_equal "proc2", config.vm.box
|
69
56
|
end
|
70
|
-
end
|
71
57
|
|
72
|
-
|
73
|
-
|
74
|
-
@
|
75
|
-
@
|
76
|
-
@klass.run { |config| }
|
77
|
-
@klass.execute!
|
58
|
+
should "not care if a file doesn't exist" do
|
59
|
+
@instance.load_order = [:foo]
|
60
|
+
assert_nothing_raised { @instance.set(:foo, "i/dont/exist") }
|
61
|
+
assert_nothing_raised { @instance.load(nil) }
|
78
62
|
end
|
79
63
|
|
80
|
-
should "
|
81
|
-
|
82
|
-
assert config.equal?(@klass.config)
|
83
|
-
end
|
64
|
+
should "not reload a file" do
|
65
|
+
foo_path = vagrant_box("foo").join("Vagrantfile")
|
84
66
|
|
85
|
-
|
86
|
-
|
87
|
-
@klass.reset!
|
88
|
-
assert !config.equal?(@klass.config)
|
89
|
-
end
|
67
|
+
vagrantfile(vagrant_box("foo"))
|
68
|
+
@instance.set(:foo, foo_path)
|
90
69
|
|
91
|
-
|
92
|
-
|
93
|
-
@
|
94
|
-
assert @klass.proc_stack.empty?
|
70
|
+
# Nothing should be raised in this case because the file isn't reloaded
|
71
|
+
vagrantfile(vagrant_box("foo"), "^%&8318")
|
72
|
+
assert_nothing_raised { @instance.set(:foo, foo_path) }
|
95
73
|
end
|
96
74
|
|
97
|
-
should "
|
98
|
-
|
99
|
-
@klass.expects(:config).with(env).once
|
100
|
-
@klass.reset!(env)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
context "initializing" do
|
105
|
-
setup do
|
106
|
-
@klass.reset!(vagrant_env)
|
107
|
-
end
|
108
|
-
|
109
|
-
should "add the given block to the proc stack" do
|
110
|
-
proc = Proc.new {}
|
111
|
-
@klass.run(&proc)
|
112
|
-
assert_equal [proc], @klass.proc_stack
|
113
|
-
end
|
75
|
+
should "raise an exception if there is a syntax error in a file" do
|
76
|
+
vagrantfile(vagrant_box("foo"), "^%&8318")
|
114
77
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
assert result.is_a?(@klass::Top)
|
78
|
+
assert_raises(Vagrant::Errors::VagrantfileSyntaxError) {
|
79
|
+
@instance.set(:foo, vagrant_box("foo").join("Vagrantfile"))
|
80
|
+
}
|
119
81
|
end
|
120
82
|
end
|
121
83
|
|
@@ -149,7 +111,6 @@ class ConfigTest < Test::Unit::TestCase
|
|
149
111
|
key = "key#{i}"
|
150
112
|
klass = mock("klass#{i}")
|
151
113
|
instance = mock("instance#{i}")
|
152
|
-
instance.expects(:env=).with(env)
|
153
114
|
instance.expects(:top=).with() do |top|
|
154
115
|
assert top.is_a?(@klass::Top)
|
155
116
|
true
|
@@ -165,7 +126,6 @@ class ConfigTest < Test::Unit::TestCase
|
|
165
126
|
key = "my_foo_bar_key"
|
166
127
|
klass = mock("klass")
|
167
128
|
instance = mock("instance")
|
168
|
-
instance.stubs(:env=)
|
169
129
|
instance.stubs(:top=)
|
170
130
|
klass.expects(:new).returns(instance)
|
171
131
|
@klass::Top.configures(key, klass)
|
@@ -17,11 +17,25 @@ class FileDownloaderTest < Test::Unit::TestCase
|
|
17
17
|
end
|
18
18
|
|
19
19
|
context "downloading" do
|
20
|
+
setup do
|
21
|
+
clean_paths
|
22
|
+
end
|
23
|
+
|
20
24
|
should "cp the file" do
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
+
uri = tmp_path.join("foo_source")
|
26
|
+
dest = tmp_path.join("foo_dest")
|
27
|
+
|
28
|
+
# Create the source file, then "download" it
|
29
|
+
File.open(uri, "w+") { |f| f.write("FOO") }
|
30
|
+
File.open(dest, "w+") do |dest_file|
|
31
|
+
@downloader.download!(uri, dest_file)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Finally, verify the destination file was properly created
|
35
|
+
assert File.file?(dest)
|
36
|
+
File.open(dest) do |f|
|
37
|
+
assert_equal "FOO", f.read
|
38
|
+
end
|
25
39
|
end
|
26
40
|
end
|
27
41
|
|
@@ -4,15 +4,17 @@ require "pathname"
|
|
4
4
|
class EnvironmentTest < Test::Unit::TestCase
|
5
5
|
setup do
|
6
6
|
@klass = Vagrant::Environment
|
7
|
+
|
8
|
+
clean_paths
|
7
9
|
end
|
8
10
|
|
9
11
|
context "class method check virtualbox version" do
|
10
12
|
setup do
|
11
|
-
VirtualBox.stubs(:version).returns("
|
13
|
+
VirtualBox.stubs(:version).returns("4.0.0")
|
12
14
|
end
|
13
15
|
|
14
16
|
should "not error and exit if everything is good" do
|
15
|
-
VirtualBox.expects(:version).returns("
|
17
|
+
VirtualBox.expects(:version).returns("4.0.0")
|
16
18
|
assert_nothing_raised { @klass.check_virtualbox! }
|
17
19
|
end
|
18
20
|
|
@@ -21,17 +23,11 @@ class EnvironmentTest < Test::Unit::TestCase
|
|
21
23
|
assert_raises(Vagrant::Errors::VirtualBoxNotDetected) { @klass.check_virtualbox! }
|
22
24
|
end
|
23
25
|
|
24
|
-
should "error and exit if VirtualBox is lower than version
|
25
|
-
version = "3.
|
26
|
+
should "error and exit if VirtualBox is lower than version 4.0" do
|
27
|
+
version = "3.2.12r1041"
|
26
28
|
VirtualBox.expects(:version).returns(version)
|
27
29
|
assert_raises(Vagrant::Errors::VirtualBoxInvalidVersion) { @klass.check_virtualbox! }
|
28
30
|
end
|
29
|
-
|
30
|
-
should "error and exit for OSE VirtualBox" do
|
31
|
-
version = "3.2.6_OSE"
|
32
|
-
VirtualBox.expects(:version).returns(version)
|
33
|
-
assert_raises(Vagrant::Errors::VirtualBoxInvalidOSE) { @klass.check_virtualbox! }
|
34
|
-
end
|
35
31
|
end
|
36
32
|
|
37
33
|
context "initialization" do
|
@@ -59,8 +55,21 @@ class EnvironmentTest < Test::Unit::TestCase
|
|
59
55
|
end
|
60
56
|
|
61
57
|
context "home path" do
|
58
|
+
setup do
|
59
|
+
@env = @klass.new
|
60
|
+
end
|
61
|
+
|
62
62
|
should "return the home path if it loaded" do
|
63
|
-
|
63
|
+
ENV["VAGRANT_HOME"] = nil
|
64
|
+
|
65
|
+
expected = Pathname.new(File.expand_path(@klass::DEFAULT_HOME))
|
66
|
+
assert_equal expected, @env.home_path
|
67
|
+
end
|
68
|
+
|
69
|
+
should "return the home path set by the environmental variable" do
|
70
|
+
ENV["VAGRANT_HOME"] = "foo"
|
71
|
+
|
72
|
+
expected = Pathname.new(File.expand_path(ENV["VAGRANT_HOME"]))
|
64
73
|
assert_equal expected, @env.home_path
|
65
74
|
end
|
66
75
|
end
|
@@ -391,7 +400,7 @@ class EnvironmentTest < Test::Unit::TestCase
|
|
391
400
|
create_box_vagrantfile
|
392
401
|
vagrantfile(@env.root_path, "config.vm.box = 'box'")
|
393
402
|
|
394
|
-
assert_equal "box.box", @env.config.package.name
|
403
|
+
assert_equal "box.box", @env.primary_vm.env.config.package.name
|
395
404
|
end
|
396
405
|
|
397
406
|
should "load from home path if exists" do
|
@@ -425,6 +434,21 @@ class EnvironmentTest < Test::Unit::TestCase
|
|
425
434
|
@env.load_config!
|
426
435
|
assert @env.instance_variable_get(:@logger).nil?
|
427
436
|
end
|
437
|
+
|
438
|
+
should "be able to reload config" do
|
439
|
+
vagrantfile(@env.root_path, "config.vm.box = 'box'")
|
440
|
+
|
441
|
+
# First load the config normally
|
442
|
+
@env.load_config!
|
443
|
+
assert_equal "box", @env.config.vm.box
|
444
|
+
assert_not_equal "set", @env.config.vm.base_mac
|
445
|
+
|
446
|
+
# Modify the Vagrantfile and reload it, then verify new results
|
447
|
+
# are available
|
448
|
+
vagrantfile(@env.root_path, "config.vm.base_mac = 'set'")
|
449
|
+
@env.reload_config!
|
450
|
+
assert_equal "set", @env.config.vm.base_mac
|
451
|
+
end
|
428
452
|
end
|
429
453
|
|
430
454
|
context "loading home directory" do
|