vagrantup 0.4.3.dev → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/config/default.rb +6 -6
- data/lib/vagrant.rb +6 -3
- data/lib/vagrant/action.rb +77 -0
- data/lib/vagrant/action/action_exception.rb +16 -0
- data/lib/vagrant/action/box/destroy.rb +19 -0
- data/lib/vagrant/action/box/download.rb +78 -0
- data/lib/vagrant/action/box/unpackage.rb +58 -0
- data/lib/vagrant/action/box/verify.rb +23 -0
- data/lib/vagrant/action/builder.rb +151 -0
- data/lib/vagrant/action/builtin.rb +114 -0
- data/lib/vagrant/action/env/error_halt.rb +16 -0
- data/lib/vagrant/action/env/set.rb +18 -0
- data/lib/vagrant/action/environment.rb +98 -0
- data/lib/vagrant/action/exception_catcher.rb +14 -0
- data/lib/vagrant/action/vm/boot.rb +54 -0
- data/lib/vagrant/action/vm/check_box.rb +27 -0
- data/lib/vagrant/action/vm/check_guest_additions.rb +32 -0
- data/lib/vagrant/action/vm/clean_machine_folder.rb +43 -0
- data/lib/vagrant/action/vm/clear_forwarded_ports.rb +39 -0
- data/lib/vagrant/action/vm/clear_nfs_exports.rb +20 -0
- data/lib/vagrant/action/vm/clear_shared_folders.rb +32 -0
- data/lib/vagrant/action/vm/customize.rb +21 -0
- data/lib/vagrant/action/vm/destroy.rb +20 -0
- data/lib/vagrant/action/vm/destroy_unused_network_interfaces.rb +35 -0
- data/lib/vagrant/action/vm/disable_networks.rb +26 -0
- data/lib/vagrant/action/vm/export.rb +53 -0
- data/lib/vagrant/action/vm/forward_ports.rb +121 -0
- data/lib/vagrant/action/vm/forward_ports_helpers.rb +28 -0
- data/lib/vagrant/action/vm/halt.rb +34 -0
- data/lib/vagrant/action/vm/import.rb +33 -0
- data/lib/vagrant/action/vm/match_mac_address.rb +19 -0
- data/lib/vagrant/{actions → action}/vm/network.rb +47 -55
- data/lib/vagrant/action/vm/nfs.rb +161 -0
- data/lib/vagrant/action/vm/nfs_helpers.rb +11 -0
- data/lib/vagrant/action/vm/package.rb +99 -0
- data/lib/vagrant/action/vm/persist.rb +22 -0
- data/lib/vagrant/action/vm/provision.rb +50 -0
- data/lib/vagrant/action/vm/resume.rb +20 -0
- data/lib/vagrant/{actions/vm/shared_folders.rb → action/vm/share_folders.rb} +48 -45
- data/lib/vagrant/action/vm/suspend.rb +20 -0
- data/lib/vagrant/box.rb +3 -7
- data/lib/vagrant/commands/base.rb +1 -3
- data/lib/vagrant/commands/package.rb +4 -9
- data/lib/vagrant/commands/up.rb +0 -2
- data/lib/vagrant/config.rb +15 -1
- data/lib/vagrant/downloaders/file.rb +1 -1
- data/lib/vagrant/downloaders/http.rb +2 -1
- data/lib/vagrant/environment.rb +18 -14
- data/lib/vagrant/hosts/base.rb +77 -0
- data/lib/vagrant/hosts/bsd.rb +53 -0
- data/lib/vagrant/hosts/linux.rb +52 -0
- data/lib/vagrant/provisioners/base.rb +17 -9
- data/lib/vagrant/provisioners/chef.rb +1 -1
- data/lib/vagrant/provisioners/chef_server.rb +4 -8
- data/lib/vagrant/provisioners/chef_solo.rb +1 -2
- data/lib/vagrant/ssh.rb +12 -4
- data/lib/vagrant/systems/base.rb +4 -0
- data/lib/vagrant/systems/linux.rb +12 -1
- data/lib/vagrant/util.rb +16 -0
- data/lib/vagrant/util/busy.rb +59 -0
- data/lib/vagrant/util/plain_logger.rb +11 -0
- data/lib/vagrant/util/platform.rb +18 -0
- data/lib/vagrant/util/resource_logger.rb +128 -0
- data/lib/vagrant/version.rb +6 -0
- data/lib/vagrant/vm.rb +10 -12
- data/templates/chef_solo_solo.erb +2 -1
- data/templates/nfs/exports.erb +3 -0
- data/templates/nfs/exports_linux.erb +3 -0
- data/templates/strings.yml +23 -3
- metadata +121 -196
- data/.gitignore +0 -11
- data/Gemfile +0 -18
- data/Rakefile +0 -41
- data/VERSION +0 -1
- data/bin/.gitignore +0 -0
- data/lib/vagrant/actions/base.rb +0 -130
- data/lib/vagrant/actions/box/add.rb +0 -23
- data/lib/vagrant/actions/box/destroy.rb +0 -14
- data/lib/vagrant/actions/box/download.rb +0 -67
- data/lib/vagrant/actions/box/unpackage.rb +0 -42
- data/lib/vagrant/actions/box/verify.rb +0 -32
- data/lib/vagrant/actions/collection.rb +0 -36
- data/lib/vagrant/actions/runner.rb +0 -131
- data/lib/vagrant/actions/vm/boot.rb +0 -43
- data/lib/vagrant/actions/vm/customize.rb +0 -19
- data/lib/vagrant/actions/vm/destroy.rb +0 -24
- data/lib/vagrant/actions/vm/down.rb +0 -22
- data/lib/vagrant/actions/vm/export.rb +0 -45
- data/lib/vagrant/actions/vm/forward_ports.rb +0 -134
- data/lib/vagrant/actions/vm/halt.rb +0 -24
- data/lib/vagrant/actions/vm/import.rb +0 -23
- data/lib/vagrant/actions/vm/move_hard_drive.rb +0 -51
- data/lib/vagrant/actions/vm/package.rb +0 -94
- data/lib/vagrant/actions/vm/provision.rb +0 -49
- data/lib/vagrant/actions/vm/reload.rb +0 -17
- data/lib/vagrant/actions/vm/resume.rb +0 -16
- data/lib/vagrant/actions/vm/start.rb +0 -26
- data/lib/vagrant/actions/vm/suspend.rb +0 -16
- data/lib/vagrant/actions/vm/up.rb +0 -53
- data/lib/vagrant/busy.rb +0 -79
- data/lib/vagrant/resource_logger.rb +0 -126
- data/lib/vagrant/util/error_helper.rb +0 -13
- data/lib/vagrant/util/output_helper.rb +0 -9
- data/test/test_helper.rb +0 -149
- data/test/vagrant/actions/base_test.rb +0 -32
- data/test/vagrant/actions/box/add_test.rb +0 -36
- data/test/vagrant/actions/box/destroy_test.rb +0 -17
- data/test/vagrant/actions/box/download_test.rb +0 -137
- data/test/vagrant/actions/box/unpackage_test.rb +0 -99
- data/test/vagrant/actions/box/verify_test.rb +0 -44
- data/test/vagrant/actions/collection_test.rb +0 -113
- data/test/vagrant/actions/runner_test.rb +0 -268
- data/test/vagrant/actions/vm/boot_test.rb +0 -49
- data/test/vagrant/actions/vm/customize_test.rb +0 -21
- data/test/vagrant/actions/vm/destroy_test.rb +0 -37
- data/test/vagrant/actions/vm/down_test.rb +0 -39
- data/test/vagrant/actions/vm/export_test.rb +0 -88
- data/test/vagrant/actions/vm/forward_ports_test.rb +0 -253
- data/test/vagrant/actions/vm/halt_test.rb +0 -65
- data/test/vagrant/actions/vm/import_test.rb +0 -45
- data/test/vagrant/actions/vm/move_hard_drive_test.rb +0 -106
- data/test/vagrant/actions/vm/network_test.rb +0 -291
- data/test/vagrant/actions/vm/package_test.rb +0 -254
- data/test/vagrant/actions/vm/provision_test.rb +0 -99
- data/test/vagrant/actions/vm/reload_test.rb +0 -46
- data/test/vagrant/actions/vm/resume_test.rb +0 -26
- data/test/vagrant/actions/vm/shared_folders_test.rb +0 -211
- data/test/vagrant/actions/vm/start_test.rb +0 -73
- data/test/vagrant/actions/vm/suspend_test.rb +0 -26
- data/test/vagrant/actions/vm/up_test.rb +0 -96
- data/test/vagrant/active_list_test.rb +0 -173
- data/test/vagrant/box_test.rb +0 -154
- data/test/vagrant/busy_test.rb +0 -78
- data/test/vagrant/command_test.rb +0 -53
- data/test/vagrant/commands/base_test.rb +0 -139
- data/test/vagrant/commands/box/add_test.rb +0 -34
- data/test/vagrant/commands/box/list_test.rb +0 -32
- data/test/vagrant/commands/box/remove_test.rb +0 -41
- data/test/vagrant/commands/destroy_test.rb +0 -44
- data/test/vagrant/commands/halt_test.rb +0 -50
- data/test/vagrant/commands/init_test.rb +0 -55
- data/test/vagrant/commands/package_test.rb +0 -104
- data/test/vagrant/commands/provision_test.rb +0 -60
- data/test/vagrant/commands/reload_test.rb +0 -44
- data/test/vagrant/commands/resume_test.rb +0 -44
- data/test/vagrant/commands/ssh_config_test.rb +0 -77
- data/test/vagrant/commands/ssh_test.rb +0 -129
- data/test/vagrant/commands/status_test.rb +0 -40
- data/test/vagrant/commands/suspend_test.rb +0 -44
- data/test/vagrant/commands/up_test.rb +0 -47
- data/test/vagrant/config_test.rb +0 -287
- data/test/vagrant/downloaders/base_test.rb +0 -28
- data/test/vagrant/downloaders/file_test.rb +0 -33
- data/test/vagrant/downloaders/http_test.rb +0 -62
- data/test/vagrant/environment_test.rb +0 -770
- data/test/vagrant/provisioners/base_test.rb +0 -33
- data/test/vagrant/provisioners/chef_server_test.rb +0 -176
- data/test/vagrant/provisioners/chef_solo_test.rb +0 -183
- data/test/vagrant/provisioners/chef_test.rb +0 -175
- data/test/vagrant/resource_logger_test.rb +0 -145
- data/test/vagrant/ssh_session_test.rb +0 -46
- data/test/vagrant/ssh_test.rb +0 -296
- data/test/vagrant/systems/linux_test.rb +0 -179
- data/test/vagrant/util/error_helper_test.rb +0 -5
- data/test/vagrant/util/output_helper_test.rb +0 -5
- data/test/vagrant/util/plain_logger_test.rb +0 -17
- data/test/vagrant/util/platform_test.rb +0 -18
- data/test/vagrant/util/stacked_proc_runner_test.rb +0 -43
- data/test/vagrant/util/template_renderer_test.rb +0 -144
- data/test/vagrant/util/translator_test.rb +0 -61
- data/test/vagrant/util_test.rb +0 -27
- data/test/vagrant/vm_test.rb +0 -235
- data/vagrant.gemspec +0 -291
@@ -1,40 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
|
2
|
-
|
3
|
-
class CommandsStatusTest < Test::Unit::TestCase
|
4
|
-
setup do
|
5
|
-
@klass = Vagrant::Commands::Status
|
6
|
-
|
7
|
-
@persisted_vm = mock("persisted_vm")
|
8
|
-
@persisted_vm.stubs(:execute!)
|
9
|
-
|
10
|
-
@env = mock_environment
|
11
|
-
@env.stubs(:require_persisted_vm)
|
12
|
-
@env.stubs(:vm).returns(@persisted_vm)
|
13
|
-
|
14
|
-
@instance = @klass.new(@env)
|
15
|
-
end
|
16
|
-
|
17
|
-
context "executing" do
|
18
|
-
should "show local status by default" do
|
19
|
-
@instance.expects(:show_local_status).once
|
20
|
-
@instance.expects(:show_global_status).never
|
21
|
-
@instance.execute
|
22
|
-
end
|
23
|
-
|
24
|
-
should "show global status if flagged" do
|
25
|
-
@instance.expects(:show_local_status).never
|
26
|
-
@instance.expects(:show_global_status).once
|
27
|
-
@instance.execute(["--global"])
|
28
|
-
end
|
29
|
-
|
30
|
-
should "show help if too many args are given" do
|
31
|
-
@instance.expects(:show_help).once
|
32
|
-
@instance.execute(["1","2","3"])
|
33
|
-
end
|
34
|
-
|
35
|
-
should "pass the VM name to local status if given" do
|
36
|
-
@instance.expects(:show_local_status).with("foo").once
|
37
|
-
@instance.execute(["foo"])
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
|
2
|
-
|
3
|
-
class CommandsSuspendTest < Test::Unit::TestCase
|
4
|
-
setup do
|
5
|
-
@klass = Vagrant::Commands::Suspend
|
6
|
-
|
7
|
-
@env = mock_environment
|
8
|
-
@instance = @klass.new(@env)
|
9
|
-
end
|
10
|
-
|
11
|
-
context "executing" do
|
12
|
-
should "call all or single for the method" do
|
13
|
-
@instance.expects(:all_or_single).with([], :suspend)
|
14
|
-
@instance.execute
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
context "suspending a single VM" do
|
19
|
-
setup do
|
20
|
-
@foo_vm = mock("vm")
|
21
|
-
@foo_vm.stubs(:env).returns(@env)
|
22
|
-
vms = { :foo => @foo_vm }
|
23
|
-
@env.stubs(:vms).returns(vms)
|
24
|
-
end
|
25
|
-
|
26
|
-
should "error and exit if the VM doesn't exist" do
|
27
|
-
@env.stubs(:vms).returns({})
|
28
|
-
@instance.expects(:error_and_exit).with(:unknown_vm, :vm => :foo).once
|
29
|
-
@instance.suspend_single(:foo)
|
30
|
-
end
|
31
|
-
|
32
|
-
should "suspend if its created" do
|
33
|
-
@foo_vm.stubs(:created?).returns(true)
|
34
|
-
@foo_vm.expects(:suspend).once
|
35
|
-
@instance.execute(["foo"])
|
36
|
-
end
|
37
|
-
|
38
|
-
should "do nothing if its not created" do
|
39
|
-
@foo_vm.stubs(:created?).returns(false)
|
40
|
-
@foo_vm.expects(:suspend).never
|
41
|
-
@instance.suspend_single(:foo)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
|
2
|
-
|
3
|
-
class CommandsUpTest < Test::Unit::TestCase
|
4
|
-
setup do
|
5
|
-
@klass = Vagrant::Commands::Up
|
6
|
-
|
7
|
-
@env = mock_environment
|
8
|
-
@instance = @klass.new(@env)
|
9
|
-
end
|
10
|
-
|
11
|
-
context "executing" do
|
12
|
-
should "call all or single for the method" do
|
13
|
-
@instance.expects(:all_or_single).with([], :up)
|
14
|
-
@instance.execute
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
context "upping a single VM" do
|
19
|
-
setup do
|
20
|
-
@vm = mock("vm")
|
21
|
-
@vm.stubs(:env).returns(@env)
|
22
|
-
|
23
|
-
@vms = {:foo => @vm}
|
24
|
-
@env.stubs(:vms).returns(@vms)
|
25
|
-
end
|
26
|
-
|
27
|
-
should "error and exit if the VM doesn't exist" do
|
28
|
-
@env.stubs(:vms).returns({})
|
29
|
-
@instance.expects(:error_and_exit).with(:unknown_vm, :vm => :foo).once
|
30
|
-
@instance.up_single(:foo)
|
31
|
-
end
|
32
|
-
|
33
|
-
should "start created VMs" do
|
34
|
-
@vm.stubs(:created?).returns(true)
|
35
|
-
@vm.expects(:start).once
|
36
|
-
@instance.up_single(:foo)
|
37
|
-
end
|
38
|
-
|
39
|
-
should "up non-created VMs" do
|
40
|
-
@vm.stubs(:created?).returns(false)
|
41
|
-
@vm.env.expects(:require_box).once
|
42
|
-
@vm.expects(:up).once
|
43
|
-
@vm.expects(:start).never
|
44
|
-
@instance.up_single(:foo)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
data/test/vagrant/config_test.rb
DELETED
@@ -1,287 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '..', 'test_helper')
|
2
|
-
|
3
|
-
class ConfigTest < Test::Unit::TestCase
|
4
|
-
context "the ssh config" do
|
5
|
-
setup do
|
6
|
-
@env = mock_environment
|
7
|
-
@env.stubs(:root_path).returns("foo")
|
8
|
-
end
|
9
|
-
|
10
|
-
should "expand any path when requesting the value" do
|
11
|
-
result = File.expand_path(@env.config.ssh[:private_key_path], @env.root_path)
|
12
|
-
assert_equal result, @env.config.ssh.private_key_path
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
context "adding configures" do
|
17
|
-
should "forward the method to the Top class" do
|
18
|
-
key = mock("key")
|
19
|
-
klass = mock("klass")
|
20
|
-
Vagrant::Config::Top.expects(:configures).with(key, klass)
|
21
|
-
Vagrant::Config.configures(key, klass)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
context "resetting" do
|
26
|
-
setup do
|
27
|
-
Vagrant::Config.run { |config| }
|
28
|
-
Vagrant::Config.execute!
|
29
|
-
end
|
30
|
-
|
31
|
-
should "return the same config object typically" do
|
32
|
-
config = Vagrant::Config.config
|
33
|
-
assert config.equal?(Vagrant::Config.config)
|
34
|
-
end
|
35
|
-
|
36
|
-
should "create a new object if cleared" do
|
37
|
-
config = Vagrant::Config.config
|
38
|
-
Vagrant::Config.reset!
|
39
|
-
assert !config.equal?(Vagrant::Config.config)
|
40
|
-
end
|
41
|
-
|
42
|
-
should "empty the proc stack" do
|
43
|
-
assert !Vagrant::Config.proc_stack.empty?
|
44
|
-
Vagrant::Config.reset!
|
45
|
-
assert Vagrant::Config.proc_stack.empty?
|
46
|
-
end
|
47
|
-
|
48
|
-
should "reload the config object based on the given environment" do
|
49
|
-
env = mock("env")
|
50
|
-
Vagrant::Config.expects(:config).with(env).once
|
51
|
-
Vagrant::Config.reset!(env)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
context "initializing" do
|
56
|
-
setup do
|
57
|
-
Vagrant::Config.reset!
|
58
|
-
end
|
59
|
-
|
60
|
-
should "add the given block to the proc stack" do
|
61
|
-
proc = Proc.new {}
|
62
|
-
Vagrant::Config.run(&proc)
|
63
|
-
assert_equal [proc], Vagrant::Config.proc_stack
|
64
|
-
end
|
65
|
-
|
66
|
-
should "run the proc stack with the config when execute is called" do
|
67
|
-
Vagrant::Config.expects(:run_procs!).with(Vagrant::Config.config).once
|
68
|
-
Vagrant::Config.execute!
|
69
|
-
end
|
70
|
-
|
71
|
-
should "not be loaded, initially" do
|
72
|
-
assert !Vagrant::Config.config.loaded?
|
73
|
-
end
|
74
|
-
|
75
|
-
should "be loaded after running" do
|
76
|
-
Vagrant::Config.run {}
|
77
|
-
Vagrant::Config.execute!
|
78
|
-
assert Vagrant::Config.config.loaded?
|
79
|
-
end
|
80
|
-
|
81
|
-
should "return the configuration on execute!" do
|
82
|
-
Vagrant::Config.run {}
|
83
|
-
result = Vagrant::Config.execute!
|
84
|
-
assert result.is_a?(Vagrant::Config::Top)
|
85
|
-
end
|
86
|
-
|
87
|
-
should "use given configuration object if given" do
|
88
|
-
fake_env = mock("env")
|
89
|
-
config = Vagrant::Config::Top.new(fake_env)
|
90
|
-
result = Vagrant::Config.execute!(config)
|
91
|
-
assert_equal config.env, result.env
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
context "base class" do
|
96
|
-
setup do
|
97
|
-
@base = Vagrant::Config::Base.new
|
98
|
-
end
|
99
|
-
|
100
|
-
should "forward [] access to methods" do
|
101
|
-
@base.expects(:foo).once
|
102
|
-
@base[:foo]
|
103
|
-
end
|
104
|
-
|
105
|
-
should "return a hash of instance variables" do
|
106
|
-
data = { :foo => "bar", :bar => "baz" }
|
107
|
-
|
108
|
-
data.each do |iv, value|
|
109
|
-
@base.instance_variable_set("@#{iv}".to_sym, value)
|
110
|
-
end
|
111
|
-
|
112
|
-
result = @base.instance_variables_hash
|
113
|
-
assert_equal data.length, result.length
|
114
|
-
|
115
|
-
data.each do |iv, value|
|
116
|
-
assert_equal value, result[iv]
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
context "converting to JSON" do
|
121
|
-
should "convert instance variable hash to json" do
|
122
|
-
@json = mock("json")
|
123
|
-
@iv_hash = mock("iv_hash")
|
124
|
-
@iv_hash.expects(:to_json).once.returns(@json)
|
125
|
-
@base.expects(:instance_variables_hash).returns(@iv_hash)
|
126
|
-
assert_equal @json, @base.to_json
|
127
|
-
end
|
128
|
-
|
129
|
-
should "not include env in the JSON hash" do
|
130
|
-
@base.env = "FOO"
|
131
|
-
hash = @base.instance_variables_hash
|
132
|
-
assert !hash.has_key?(:env)
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
context "top config class" do
|
138
|
-
setup do
|
139
|
-
@configures_list = []
|
140
|
-
Vagrant::Config::Top.stubs(:configures_list).returns(@configures_list)
|
141
|
-
end
|
142
|
-
|
143
|
-
context "adding configure keys" do
|
144
|
-
setup do
|
145
|
-
@key = "top_config_foo"
|
146
|
-
@klass = mock("klass")
|
147
|
-
end
|
148
|
-
|
149
|
-
should "add key and klass to configures list" do
|
150
|
-
@configures_list.expects(:<<).with([@key, @klass])
|
151
|
-
Vagrant::Config::Top.configures(@key, @klass)
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
context "configuration keys on instance" do
|
156
|
-
setup do
|
157
|
-
@configures_list.clear
|
158
|
-
end
|
159
|
-
|
160
|
-
should "initialize each configurer and set it to its key" do
|
161
|
-
env = mock('env')
|
162
|
-
|
163
|
-
5.times do |i|
|
164
|
-
key = "key#{i}"
|
165
|
-
klass = mock("klass#{i}")
|
166
|
-
instance = mock("instance#{i}")
|
167
|
-
instance.expects(:env=).with(env)
|
168
|
-
klass.expects(:new).returns(instance)
|
169
|
-
@configures_list << [key, klass]
|
170
|
-
end
|
171
|
-
|
172
|
-
Vagrant::Config::Top.new(env)
|
173
|
-
end
|
174
|
-
|
175
|
-
should "allow reading via methods" do
|
176
|
-
key = "my_foo_bar_key"
|
177
|
-
klass = mock("klass")
|
178
|
-
instance = mock("instance")
|
179
|
-
instance.stubs(:env=)
|
180
|
-
klass.expects(:new).returns(instance)
|
181
|
-
Vagrant::Config::Top.configures(key, klass)
|
182
|
-
|
183
|
-
config = Vagrant::Config::Top.new
|
184
|
-
assert_equal instance, config.send(key)
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
context "loaded status" do
|
189
|
-
setup do
|
190
|
-
@top= Vagrant::Config::Top.new
|
191
|
-
end
|
192
|
-
|
193
|
-
should "not be loaded by default" do
|
194
|
-
assert !@top.loaded?
|
195
|
-
end
|
196
|
-
|
197
|
-
should "be loaded after calling loaded!" do
|
198
|
-
@top.loaded!
|
199
|
-
assert @top.loaded?
|
200
|
-
end
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
context "vagrant configuration" do
|
205
|
-
setup do
|
206
|
-
@config = Vagrant::Config::VagrantConfig.new
|
207
|
-
end
|
208
|
-
|
209
|
-
should "return nil if home is nil" do
|
210
|
-
File.expects(:expand_path).never
|
211
|
-
assert @config.home.nil?
|
212
|
-
end
|
213
|
-
|
214
|
-
should "expand the path if home is not nil" do
|
215
|
-
@config.home = "foo"
|
216
|
-
File.expects(:expand_path).with("foo").once.returns("result")
|
217
|
-
assert_equal "result", @config.home
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
context "VM configuration" do
|
222
|
-
setup do
|
223
|
-
@env = mock_environment
|
224
|
-
@config = @env.config.vm
|
225
|
-
@env.config.ssh.username = @username
|
226
|
-
end
|
227
|
-
|
228
|
-
context "defining VMs" do
|
229
|
-
should "store the proc by name but not run it" do
|
230
|
-
foo = mock("proc")
|
231
|
-
foo.expects(:call).never
|
232
|
-
|
233
|
-
proc = Proc.new { foo.call }
|
234
|
-
@config.define(:name, &proc)
|
235
|
-
assert @config.defined_vms[:name].proc_stack.include?(proc)
|
236
|
-
end
|
237
|
-
|
238
|
-
should "store the options" do
|
239
|
-
@config.define(:name, :set => true)
|
240
|
-
assert @config.defined_vms[:name].options[:set]
|
241
|
-
end
|
242
|
-
|
243
|
-
should "not have multi-VMs by default" do
|
244
|
-
assert !@config.has_multi_vms?
|
245
|
-
end
|
246
|
-
|
247
|
-
should "have multi-VMs once one is specified" do
|
248
|
-
@config.define(:foo) {}
|
249
|
-
assert @config.has_multi_vms?
|
250
|
-
end
|
251
|
-
end
|
252
|
-
|
253
|
-
context "customizing" do
|
254
|
-
should "include the stacked proc runner module" do
|
255
|
-
assert @config.class.included_modules.include?(Vagrant::Util::StackedProcRunner)
|
256
|
-
end
|
257
|
-
|
258
|
-
should "add the customize proc to the proc stack" do
|
259
|
-
proc = Proc.new {}
|
260
|
-
@config.customize(&proc)
|
261
|
-
assert_equal [proc], @config.proc_stack
|
262
|
-
end
|
263
|
-
end
|
264
|
-
|
265
|
-
context "uid/gid" do
|
266
|
-
should "return the shared folder UID if set" do
|
267
|
-
@config.shared_folder_uid = "foo"
|
268
|
-
assert_equal "foo", @config.shared_folder_uid
|
269
|
-
end
|
270
|
-
|
271
|
-
should "return the SSH username if UID not set" do
|
272
|
-
@config.shared_folder_uid = nil
|
273
|
-
assert_equal @username, @config.shared_folder_uid
|
274
|
-
end
|
275
|
-
|
276
|
-
should "return the shared folder GID if set" do
|
277
|
-
@config.shared_folder_gid = "foo"
|
278
|
-
assert_equal "foo", @config.shared_folder_gid
|
279
|
-
end
|
280
|
-
|
281
|
-
should "return the SSH username if GID not set" do
|
282
|
-
@config.shared_folder_gid = nil
|
283
|
-
assert_equal @username, @config.shared_folder_gid
|
284
|
-
end
|
285
|
-
end
|
286
|
-
end
|
287
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
|
2
|
-
|
3
|
-
class BaseDownloaderTest < Test::Unit::TestCase
|
4
|
-
should "include the util class so subclasses have access to it" do
|
5
|
-
assert Vagrant::Downloaders::Base.include?(Vagrant::Util)
|
6
|
-
end
|
7
|
-
|
8
|
-
context "base instance" do
|
9
|
-
setup do
|
10
|
-
@env = mock_environment
|
11
|
-
@base = Vagrant::Downloaders::Base.new(@env)
|
12
|
-
end
|
13
|
-
|
14
|
-
should "implement prepare which does nothing" do
|
15
|
-
assert_nothing_raised do
|
16
|
-
assert @base.respond_to?(:prepare)
|
17
|
-
@base.prepare("source")
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
should "implement download! which does nothing" do
|
22
|
-
assert_nothing_raised do
|
23
|
-
assert @base.respond_to?(:download!)
|
24
|
-
@base.download!("source", "destination")
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|