vagrantup 0.8.10 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +77 -1
- data/Gemfile +0 -14
- data/LICENSE +1 -1
- data/bin/vagrant +47 -20
- data/config/default.rb +6 -14
- data/lib/vagrant/action/box/destroy.rb +7 -3
- data/lib/vagrant/action/box/download.rb +8 -8
- data/lib/vagrant/action/box/package.rb +2 -2
- data/lib/vagrant/action/box/unpackage.rb +13 -7
- data/lib/vagrant/action/box/verify.rb +5 -5
- data/lib/vagrant/action/builder.rb +23 -19
- data/lib/vagrant/action/builtin.rb +117 -79
- data/lib/vagrant/action/env/set.rb +7 -4
- data/lib/vagrant/action/environment.rb +3 -41
- data/lib/vagrant/action/general/package.rb +14 -29
- data/lib/vagrant/action/general/validate.rb +2 -2
- data/lib/vagrant/action/runner.rb +53 -0
- data/lib/vagrant/action/vm/boot.rb +9 -9
- data/lib/vagrant/action/vm/check_accessible.rb +2 -2
- data/lib/vagrant/action/vm/check_box.rb +10 -12
- data/lib/vagrant/action/vm/check_guest_additions.rb +8 -8
- data/lib/vagrant/action/vm/check_port_collisions.rb +85 -0
- data/lib/vagrant/action/vm/clean_machine_folder.rb +4 -4
- data/lib/vagrant/action/vm/clear_forwarded_ports.rb +3 -11
- data/lib/vagrant/action/vm/clear_network_interfaces.rb +31 -0
- data/lib/vagrant/action/vm/clear_shared_folders.rb +2 -11
- data/lib/vagrant/action/vm/customize.rb +19 -9
- data/lib/vagrant/action/vm/destroy.rb +4 -4
- data/lib/vagrant/action/vm/destroy_unused_network_interfaces.rb +2 -12
- data/lib/vagrant/action/vm/discard_state.rb +4 -4
- data/lib/vagrant/action/vm/export.rb +13 -8
- data/lib/vagrant/action/vm/forward_ports.rb +55 -102
- data/lib/vagrant/action/vm/halt.rb +9 -6
- data/lib/vagrant/action/vm/host_name.rb +4 -4
- data/lib/vagrant/action/vm/import.rb +19 -10
- data/lib/vagrant/action/vm/match_mac_address.rb +4 -9
- data/lib/vagrant/action/vm/network.rb +300 -94
- data/lib/vagrant/action/vm/nfs.rb +41 -26
- data/lib/vagrant/action/vm/package.rb +1 -1
- data/lib/vagrant/action/vm/package_vagrantfile.rb +5 -2
- data/lib/vagrant/action/vm/provision.rb +42 -13
- data/lib/vagrant/action/vm/provisioner_cleanup.rb +2 -2
- data/lib/vagrant/action/vm/{clear_nfs_exports.rb → prune_nfs_exports.rb} +7 -7
- data/lib/vagrant/action/vm/resume.rb +4 -4
- data/lib/vagrant/action/vm/setup_package_files.rb +54 -0
- data/lib/vagrant/action/vm/share_folders.rb +63 -39
- data/lib/vagrant/action/vm/suspend.rb +4 -4
- data/lib/vagrant/action/warden.rb +13 -6
- data/lib/vagrant/action.rb +45 -123
- data/lib/vagrant/box.rb +9 -55
- data/lib/vagrant/box_collection.rb +22 -17
- data/lib/vagrant/cli.rb +62 -47
- data/lib/vagrant/command/base.rb +135 -90
- data/lib/vagrant/command/box.rb +46 -21
- data/lib/vagrant/command/box_add.rb +33 -0
- data/lib/vagrant/command/box_list.rb +25 -0
- data/lib/vagrant/command/box_remove.rb +23 -0
- data/lib/vagrant/command/box_repackage.rb +23 -0
- data/lib/vagrant/command/destroy.rb +16 -5
- data/lib/vagrant/command/halt.rb +25 -7
- data/lib/vagrant/command/init.rb +30 -7
- data/lib/vagrant/command/package.rb +49 -18
- data/lib/vagrant/command/provision.rb +22 -9
- data/lib/vagrant/command/reload.rb +18 -5
- data/lib/vagrant/command/resume.rb +18 -5
- data/lib/vagrant/command/ssh.rb +69 -31
- data/lib/vagrant/command/ssh_config.rb +37 -22
- data/lib/vagrant/command/status.rb +22 -20
- data/lib/vagrant/command/suspend.rb +18 -5
- data/lib/vagrant/command/up.rb +41 -8
- data/lib/vagrant/command.rb +18 -20
- data/lib/vagrant/communication/base.rb +56 -0
- data/lib/vagrant/communication/ssh.rb +200 -0
- data/lib/vagrant/communication.rb +7 -0
- data/lib/vagrant/config/base.rb +18 -26
- data/lib/vagrant/config/container.rb +37 -0
- data/lib/vagrant/config/error_recorder.rb +1 -1
- data/lib/vagrant/config/loader.rb +125 -0
- data/lib/vagrant/config/nfs.rb +1 -3
- data/lib/vagrant/config/package.rb +1 -3
- data/lib/vagrant/config/ssh.rb +31 -16
- data/lib/vagrant/config/top.rb +36 -25
- data/lib/vagrant/config/vagrant.rb +2 -5
- data/lib/vagrant/config/vm/provisioner.rb +16 -20
- data/lib/vagrant/config/vm/sub_vm.rb +1 -1
- data/lib/vagrant/config/vm.rb +115 -56
- data/lib/vagrant/config.rb +29 -103
- data/lib/vagrant/data_store.rb +23 -15
- data/lib/vagrant/downloaders/base.rb +7 -5
- data/lib/vagrant/downloaders/file.rb +4 -4
- data/lib/vagrant/downloaders/http.rb +4 -5
- data/lib/vagrant/driver/virtualbox.rb +121 -0
- data/lib/vagrant/driver/virtualbox_4_0.rb +411 -0
- data/lib/vagrant/driver/virtualbox_4_1.rb +411 -0
- data/lib/vagrant/driver/virtualbox_base.rb +284 -0
- data/lib/vagrant/driver.rb +7 -0
- data/lib/vagrant/environment.rb +221 -240
- data/lib/vagrant/errors.rb +74 -25
- data/lib/vagrant/guest/arch.rb +48 -0
- data/lib/vagrant/{systems → guest}/base.rb +30 -18
- data/lib/vagrant/guest/debian.rb +61 -0
- data/lib/vagrant/{systems → guest}/freebsd.rb +11 -18
- data/lib/vagrant/guest/gentoo.rb +32 -0
- data/lib/vagrant/{systems → guest}/linux/config.rb +2 -4
- data/lib/vagrant/guest/linux/error.rb +9 -0
- data/lib/vagrant/guest/linux.rb +78 -0
- data/lib/vagrant/guest/redhat.rb +66 -0
- data/lib/vagrant/guest/solaris.rb +114 -0
- data/lib/vagrant/{systems → guest}/suse.rb +2 -2
- data/lib/vagrant/guest/ubuntu.rb +23 -0
- data/lib/vagrant/guest.rb +16 -0
- data/lib/vagrant/hosts/arch.rb +7 -3
- data/lib/vagrant/hosts/base.rb +36 -46
- data/lib/vagrant/hosts/bsd.rb +53 -16
- data/lib/vagrant/hosts/fedora.rb +14 -0
- data/lib/vagrant/hosts/freebsd.rb +6 -36
- data/lib/vagrant/hosts/linux.rb +45 -20
- data/lib/vagrant/hosts/windows.rb +16 -0
- data/lib/vagrant/hosts.rb +23 -6
- data/lib/vagrant/provisioners/base.rb +11 -34
- data/lib/vagrant/provisioners/chef.rb +30 -26
- data/lib/vagrant/provisioners/chef_client.rb +37 -23
- data/lib/vagrant/provisioners/chef_solo.rb +61 -16
- data/lib/vagrant/provisioners/puppet.rb +70 -38
- data/lib/vagrant/provisioners/puppet_server.rb +12 -13
- data/lib/vagrant/provisioners/shell.rb +24 -24
- data/lib/vagrant/provisioners.rb +10 -7
- data/lib/vagrant/registry.rb +49 -0
- data/lib/vagrant/ssh.rb +82 -153
- data/lib/vagrant/ui.rb +118 -50
- data/lib/vagrant/util/busy.rb +1 -1
- data/lib/vagrant/util/file_mode.rb +12 -0
- data/lib/vagrant/util/network_ip.rb +28 -0
- data/lib/vagrant/util/platform.rb +1 -0
- data/lib/vagrant/util/subprocess.rb +227 -0
- data/lib/vagrant/version.rb +1 -1
- data/lib/vagrant/vm.rb +111 -97
- data/lib/vagrant.rb +132 -5
- data/tasks/acceptance.rake +3 -3
- data/tasks/test.rake +7 -2
- data/templates/commands/init/Vagrantfile.erb +11 -4
- data/templates/{ssh_config.erb → commands/ssh_config/config.erb} +0 -0
- data/templates/guests/arch/network_dhcp.erb +7 -0
- data/templates/guests/arch/network_static.erb +7 -0
- data/templates/guests/debian/network_dhcp.erb +6 -0
- data/templates/guests/debian/network_static.erb +7 -0
- data/templates/guests/gentoo/network_dhcp.erb +4 -0
- data/templates/guests/gentoo/network_static.erb +4 -0
- data/templates/guests/redhat/network_dhcp.erb +6 -0
- data/templates/guests/redhat/network_static.erb +7 -0
- data/templates/locales/en.yml +241 -122
- data/templates/{chef_server_client.erb → provisioners/chef_client/client.erb} +0 -0
- data/templates/{chef_solo_solo.erb → provisioners/chef_solo/solo.erb} +0 -0
- data/test/acceptance/base.rb +10 -10
- data/test/acceptance/box_test.rb +28 -6
- data/test/acceptance/destroy_test.rb +1 -1
- data/test/acceptance/halt_test.rb +4 -4
- data/test/acceptance/init_test.rb +3 -3
- data/test/acceptance/networking/host_only_test.rb +37 -0
- data/test/acceptance/networking/port_forward_test.rb +125 -0
- data/test/acceptance/package_test.rb +46 -0
- data/test/acceptance/provisioning/basic_test.rb +61 -0
- data/test/acceptance/provisioning/chef_solo_test.rb +37 -0
- data/test/acceptance/provisioning/shell_test.rb +53 -0
- data/test/acceptance/resume_test.rb +1 -1
- data/test/acceptance/skeletons/chef_solo_basic/README.md +3 -0
- data/test/acceptance/skeletons/chef_solo_basic/cookbooks/basic/recipes/default.rb +5 -0
- data/test/acceptance/skeletons/chef_solo_json/README.md +3 -0
- data/test/acceptance/skeletons/chef_solo_json/cookbooks/basic/recipes/default.rb +6 -0
- data/test/acceptance/skeletons/provisioner_multi/README.md +3 -0
- data/test/acceptance/skeletons/provisioner_multi/cookbooks/basic/recipes/default.rb +5 -0
- data/test/acceptance/ssh_test.rb +7 -2
- data/test/acceptance/support/config.rb +1 -1
- data/test/acceptance/support/isolated_environment.rb +41 -150
- data/test/acceptance/support/matchers/match_output.rb +1 -1
- data/test/acceptance/support/matchers/succeed.rb +14 -0
- data/test/acceptance/support/network_tests.rb +29 -0
- data/test/acceptance/support/output.rb +9 -1
- data/test/acceptance/support/shared/base_context.rb +16 -9
- data/test/acceptance/support/shared/command_examples.rb +4 -4
- data/test/acceptance/suspend_test.rb +1 -1
- data/test/acceptance/up_basic_test.rb +26 -7
- data/test/acceptance/up_with_box_url.rb +1 -1
- data/test/acceptance/vagrant_test.rb +1 -1
- data/test/acceptance/version_test.rb +0 -5
- data/test/support/isolated_environment.rb +46 -0
- data/test/{acceptance/support → support}/tempdir.rb +0 -0
- data/test/unit/base.rb +21 -0
- data/test/unit/support/isolated_environment.rb +39 -0
- data/test/unit/support/shared/base_context.rb +30 -0
- data/test/unit/vagrant/action/builder_test.rb +126 -177
- data/test/unit/vagrant/action/environment_test.rb +10 -21
- data/test/unit/vagrant/action/runner_test.rb +65 -0
- data/test/unit/vagrant/action/warden_test.rb +64 -97
- data/test/unit/vagrant/box_collection_test.rb +44 -33
- data/test/unit/vagrant/box_test.rb +25 -65
- data/test/unit/vagrant/command/base_test.rb +141 -14
- data/test/unit/vagrant/config/base_test.rb +16 -43
- data/test/unit/vagrant/config/loader_test.rb +79 -0
- data/test/unit/vagrant/config/top_test.rb +69 -0
- data/test/unit/vagrant/config/vm_test.rb +62 -47
- data/test/unit/vagrant/config_test.rb +16 -151
- data/test/unit/vagrant/data_store_test.rb +43 -61
- data/test/unit/vagrant/downloaders/base_test.rb +12 -22
- data/test/unit/vagrant/downloaders/file_test.rb +58 -31
- data/test/unit/vagrant/downloaders/http_test.rb +12 -86
- data/test/unit/vagrant/environment_test.rb +107 -536
- data/test/unit/vagrant/hosts_test.rb +36 -0
- data/test/unit/vagrant/registry_test.rb +56 -0
- data/test/unit/vagrant/util/file_checksum_test.rb +23 -0
- data/test/unit/vagrant/util/hash_with_indifferent_access_test.rb +23 -24
- data/test/unit/vagrant/util/network_ip_test.rb +17 -0
- data/test/unit/vagrant/util/retryable_test.rb +90 -34
- data/test/unit/vagrant_test.rb +27 -0
- data/test/{unit → unit_legacy}/locales/en.yml +0 -0
- data/test/{unit → unit_legacy}/test_helper.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/destroy_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/download_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/package_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/unpackage_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/verify_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/env/set_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/general/package_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/general/validate_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/boot_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/check_accessible_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/check_box_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/check_guest_additions_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/clean_machine_folder_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/clear_forwarded_ports_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/clear_nfs_exports_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/clear_shared_folders_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/customize_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/destroy_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/destroy_unused_network_interfaces_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/discard_state_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/export_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/forward_ports_helpers_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/forward_ports_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/halt_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/host_name_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/import_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/match_mac_address_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/modify_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/network_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/nfs_helpers_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/nfs_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/package_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/package_vagrantfile_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/provision_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/provisioner_cleanup_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/resume_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/share_folders_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/suspend_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action_test.rb +0 -0
- data/test/unit_legacy/vagrant/box_collection_test.rb +45 -0
- data/test/unit_legacy/vagrant/box_test.rb +74 -0
- data/test/{unit → unit_legacy}/vagrant/cli_test.rb +0 -0
- data/test/unit_legacy/vagrant/command/base_test.rb +23 -0
- data/test/{unit → unit_legacy}/vagrant/command/group_base_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/command/helpers_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/command/init_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/command/package_test.rb +0 -0
- data/test/unit_legacy/vagrant/config/base_test.rb +52 -0
- data/test/{unit → unit_legacy}/vagrant/config/error_recorder_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/config/ssh_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/config/vagrant_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/config/vm/provisioner_test.rb +0 -0
- data/test/unit_legacy/vagrant/config/vm_test.rb +47 -0
- data/test/unit_legacy/vagrant/config_test.rb +148 -0
- data/test/unit_legacy/vagrant/downloaders/http_test.rb +93 -0
- data/test/unit_legacy/vagrant/environment_test.rb +539 -0
- data/test/{unit → unit_legacy}/vagrant/errors_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/hosts/base_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/hosts/bsd_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/hosts/linux_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/plugin_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/base_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/chef_client_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/chef_solo_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/chef_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/puppet_server_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/puppet_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/shell_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/ssh/session_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/ssh_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/systems/base_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/systems/linux_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/busy_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/counter_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/platform_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/stacked_proc_runner_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/template_renderer_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/vm_test.rb +0 -0
- data/vagrant.gemspec +7 -9
- metadata +183 -179
- data/keys/vagrant.ppk +0 -26
- data/lib/vagrant/action/box.rb +0 -11
- data/lib/vagrant/action/env.rb +0 -7
- data/lib/vagrant/action/general.rb +0 -8
- data/lib/vagrant/action/vm/forward_ports_helpers.rb +0 -28
- data/lib/vagrant/action/vm/modify.rb +0 -37
- data/lib/vagrant/action/vm/nfs_helpers.rb +0 -11
- data/lib/vagrant/action/vm.rb +0 -34
- data/lib/vagrant/command/group_base.rb +0 -107
- data/lib/vagrant/command/helpers.rb +0 -33
- data/lib/vagrant/command/named_base.rb +0 -14
- data/lib/vagrant/command/upgrade_to_060.rb +0 -45
- data/lib/vagrant/command/version.rb +0 -13
- data/lib/vagrant/ssh/session.rb +0 -136
- data/lib/vagrant/systems/arch.rb +0 -34
- data/lib/vagrant/systems/debian.rb +0 -36
- data/lib/vagrant/systems/gentoo.rb +0 -27
- data/lib/vagrant/systems/linux/error.rb +0 -9
- data/lib/vagrant/systems/linux.rb +0 -82
- data/lib/vagrant/systems/redhat.rb +0 -48
- data/lib/vagrant/systems/solaris.rb +0 -113
- data/lib/vagrant/systems/ubuntu.rb +0 -17
- data/lib/vagrant/systems.rb +0 -13
- data/templates/network_entry_arch.erb +0 -9
- data/templates/network_entry_debian.erb +0 -8
- data/templates/network_entry_gentoo.erb +0 -5
- data/templates/network_entry_redhat.erb +0 -9
- data/test/unit/vagrant/ui_test.rb +0 -29
@@ -1,598 +1,169 @@
|
|
1
|
-
require "
|
1
|
+
require File.expand_path("../../base", __FILE__)
|
2
2
|
require "pathname"
|
3
|
-
require "tempfile"
|
4
3
|
|
5
|
-
|
6
|
-
setup do
|
7
|
-
@klass = Vagrant::Environment
|
4
|
+
require "vagrant/util/file_mode"
|
8
5
|
|
9
|
-
|
10
|
-
end
|
6
|
+
require "support/tempdir"
|
11
7
|
|
12
|
-
|
13
|
-
|
14
|
-
VirtualBox.stubs(:version).returns("4.1.0")
|
15
|
-
end
|
8
|
+
describe Vagrant::Environment do
|
9
|
+
include_context "unit"
|
16
10
|
|
17
|
-
|
18
|
-
|
19
|
-
assert_nothing_raised { @klass.check_virtualbox! }
|
20
|
-
end
|
11
|
+
let(:home_path) { Pathname.new(Tempdir.new.path) }
|
12
|
+
let(:instance) { described_class.new(:home_path => home_path) }
|
21
13
|
|
22
|
-
|
23
|
-
|
24
|
-
|
14
|
+
describe "current working directory" do
|
15
|
+
it "is the cwd by default" do
|
16
|
+
described_class.new.cwd.should == Pathname.new(Dir.pwd)
|
25
17
|
end
|
26
18
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
assert_raises(Vagrant::Errors::VirtualBoxInvalidVersion) { @klass.check_virtualbox! }
|
19
|
+
it "is set to the cwd given" do
|
20
|
+
instance = described_class.new(:cwd => "foobarbaz")
|
21
|
+
instance.cwd.should == Pathname.new("foobarbaz")
|
31
22
|
end
|
32
23
|
end
|
33
24
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
25
|
+
describe "home path" do
|
26
|
+
it "is set to the home path given" do
|
27
|
+
dir = Tempdir.new.path
|
28
|
+
instance = described_class.new(:home_path => dir)
|
29
|
+
instance.home_path.should == Pathname.new(dir)
|
39
30
|
end
|
40
31
|
|
41
|
-
|
42
|
-
|
43
|
-
assert_equal Pathname.new(Dir.pwd), env.cwd
|
32
|
+
it "is set to the environmental variable VAGRANT_HOME" do
|
33
|
+
pending "A good temporary ENV thing"
|
44
34
|
end
|
45
|
-
end
|
46
35
|
|
47
|
-
|
48
|
-
|
49
|
-
|
36
|
+
it "is set to the DEFAULT_HOME by default" do
|
37
|
+
expected = Pathname.new(File.expand_path(described_class::DEFAULT_HOME))
|
38
|
+
described_class.new.home_path.should == expected
|
50
39
|
end
|
51
40
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
end
|
57
|
-
|
58
|
-
context "home path" do
|
59
|
-
setup do
|
60
|
-
@env = @klass.new
|
61
|
-
|
62
|
-
# Make a fake home directory for helping with tests
|
63
|
-
@home_path = tmp_path.join("home")
|
64
|
-
ENV["HOME"] = @home_path.to_s
|
65
|
-
FileUtils.rm_rf(@home_path)
|
66
|
-
FileUtils.mkdir_p(@home_path)
|
67
|
-
end
|
68
|
-
|
69
|
-
should "return the home path if it loaded" do
|
70
|
-
ENV["VAGRANT_HOME"] = nil
|
71
|
-
|
72
|
-
expected = Pathname.new(File.expand_path(@klass::DEFAULT_HOME))
|
73
|
-
assert_equal expected, @env.home_path
|
74
|
-
end
|
75
|
-
|
76
|
-
should "return the home path set by the environmental variable" do
|
77
|
-
ENV["VAGRANT_HOME"] = "foo"
|
78
|
-
|
79
|
-
expected = Pathname.new(File.expand_path(ENV["VAGRANT_HOME"]))
|
80
|
-
assert_equal expected, @env.home_path
|
81
|
-
end
|
82
|
-
|
83
|
-
should "move the old home directory to the new location" do
|
84
|
-
new_path = @home_path.join(".vagrant.d")
|
85
|
-
old_path = @home_path.join(".vagrant")
|
86
|
-
old_path.mkdir
|
87
|
-
|
88
|
-
# Get the home path
|
89
|
-
ENV["VAGRANT_HOME"] = new_path.to_s
|
90
|
-
|
91
|
-
assert !new_path.exist?
|
92
|
-
assert_equal new_path, @env.home_path
|
93
|
-
assert !old_path.exist?
|
94
|
-
assert new_path.exist?
|
95
|
-
end
|
96
|
-
|
97
|
-
should "not move the old home directory if the new one already exists" do
|
98
|
-
new_path = @home_path.join(".vagrant.d")
|
99
|
-
new_path.mkdir
|
100
|
-
|
101
|
-
old_path = @home_path.join(".vagrant")
|
102
|
-
old_path.mkdir
|
103
|
-
|
104
|
-
# Get the home path
|
105
|
-
ENV["VAGRANT_HOME"] = new_path.to_s
|
106
|
-
|
107
|
-
assert new_path.exist?
|
108
|
-
assert_equal new_path, @env.home_path
|
109
|
-
assert old_path.exist?
|
110
|
-
assert new_path.exist?
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
context "temp path" do
|
115
|
-
should "return the home path joined with 'tmp'" do
|
116
|
-
assert_equal @env.home_path.join("tmp"), @env.tmp_path
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
context "boxes path" do
|
121
|
-
should "return the home path joined with 'tmp'" do
|
122
|
-
assert_equal @env.home_path.join("boxes"), @env.boxes_path
|
123
|
-
end
|
41
|
+
it "throws an exception if inaccessible" do
|
42
|
+
expect {
|
43
|
+
described_class.new(:home_path => "/")
|
44
|
+
}.to raise_error(Vagrant::Errors::HomeDirectoryNotAccessible)
|
124
45
|
end
|
125
46
|
end
|
126
47
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
should "return 'vagrant' as a default" do
|
133
|
-
assert_equal 'vagrant', @env.resource
|
134
|
-
end
|
48
|
+
describe "copying the private SSH key" do
|
49
|
+
it "copies the SSH key into the home directory" do
|
50
|
+
env = isolated_environment
|
51
|
+
instance = described_class.new(:home_path => env.homedir)
|
135
52
|
|
136
|
-
|
137
|
-
|
138
|
-
|
53
|
+
pk = env.homedir.join("insecure_private_key")
|
54
|
+
pk.should be_exist
|
55
|
+
Vagrant::Util::FileMode.from_octal(pk.stat.mode).should == "600"
|
139
56
|
end
|
140
57
|
end
|
141
58
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
end
|
147
|
-
|
148
|
-
should "call and return the primary VM from the parent if has one" do
|
149
|
-
env = vagrant_env(vagrantfile(<<-vf))
|
150
|
-
config.vm.define(:web, :primary => true) do; end
|
151
|
-
config.vm.define :db do; end
|
152
|
-
vf
|
153
|
-
|
154
|
-
assert_equal :web, env.primary_vm.name
|
155
|
-
end
|
156
|
-
|
157
|
-
should "return nil if no VM is marked as primary" do
|
158
|
-
env = vagrant_env(vagrantfile(<<-vf))
|
159
|
-
config.vm.define :web
|
160
|
-
config.vm.define :db
|
161
|
-
config.vm.define :utility
|
162
|
-
vf
|
163
|
-
|
164
|
-
assert env.primary_vm.nil?
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
context "multivm? helper" do
|
169
|
-
should "return true if VM length greater than 1" do
|
170
|
-
env = vagrant_env(vagrantfile(<<-vf))
|
171
|
-
config.vm.define :web
|
172
|
-
config.vm.define :db
|
173
|
-
vf
|
174
|
-
|
175
|
-
assert env.multivm?
|
176
|
-
end
|
177
|
-
|
178
|
-
should "return true if VM length is 1 and a sub-VM is defined" do
|
179
|
-
env = vagrant_env(vagrantfile(<<-vf))
|
180
|
-
config.vm.define :web
|
181
|
-
vf
|
182
|
-
|
183
|
-
assert env.multivm?
|
184
|
-
end
|
185
|
-
|
186
|
-
should "return false if only default VM exists" do
|
187
|
-
assert !vagrant_env.multivm?
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
context "local data" do
|
192
|
-
should "lazy load the data store only once" do
|
193
|
-
result = { :foo => :bar }
|
194
|
-
Vagrant::DataStore.expects(:new).returns(result).once
|
195
|
-
env = vagrant_env
|
196
|
-
assert_equal result, env.local_data
|
197
|
-
assert_equal result, env.local_data
|
198
|
-
assert_equal result, env.local_data
|
199
|
-
end
|
200
|
-
|
201
|
-
should "return the parent's local data if a parent exists" do
|
202
|
-
env = vagrant_env(vagrantfile(<<-vf))
|
203
|
-
config.vm.define :web
|
204
|
-
config.vm.define :db
|
205
|
-
vf
|
206
|
-
|
207
|
-
env.local_data[:foo] = :bar
|
208
|
-
|
209
|
-
Vagrant::DataStore.expects(:new).never
|
210
|
-
assert_equal :bar, env.vms[:web].env.local_data[:foo]
|
211
|
-
end
|
212
|
-
end
|
213
|
-
|
214
|
-
context "accessing host" do
|
215
|
-
should "load the host once" do
|
216
|
-
env = @klass.new(:cwd => vagrantfile)
|
217
|
-
result = mock("result")
|
218
|
-
Vagrant::Hosts::Base.expects(:load).with(env, env.config.vagrant.host).once.returns(result)
|
219
|
-
assert_equal result, env.host
|
220
|
-
assert_equal result, env.host
|
221
|
-
assert_equal result, env.host
|
222
|
-
end
|
59
|
+
it "has a box collection pointed to the proper directory" do
|
60
|
+
collection = instance.boxes
|
61
|
+
collection.should be_kind_of(Vagrant::BoxCollection)
|
62
|
+
collection.directory.should == instance.boxes_path
|
223
63
|
end
|
224
64
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
result = mock("result")
|
229
|
-
Vagrant::Action.expects(:new).with(env).returns(result).once
|
230
|
-
assert_equal result, env.actions
|
231
|
-
assert_equal result, env.actions
|
232
|
-
assert_equal result, env.actions
|
233
|
-
end
|
234
|
-
end
|
235
|
-
|
236
|
-
context "global data" do
|
237
|
-
should "lazy load the data store only once" do
|
238
|
-
env = vagrant_env
|
239
|
-
store = env.global_data
|
240
|
-
|
241
|
-
assert env.global_data.equal?(store)
|
242
|
-
assert env.global_data.equal?(store)
|
243
|
-
assert env.global_data.equal?(store)
|
65
|
+
describe "action runner" do
|
66
|
+
it "has an action runner" do
|
67
|
+
instance.action_runner.should be_kind_of(Vagrant::Action::Runner)
|
244
68
|
end
|
245
69
|
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
config.vm.define :db
|
250
|
-
vf
|
70
|
+
it "has a `ui` in the globals" do
|
71
|
+
result = nil
|
72
|
+
callable = lambda { |env| result = env[:ui] }
|
251
73
|
|
252
|
-
|
253
|
-
|
74
|
+
instance.action_runner.run(callable)
|
75
|
+
result.should eql(instance.ui)
|
254
76
|
end
|
255
77
|
end
|
256
78
|
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
result = env.logger
|
261
|
-
assert result === env.logger
|
79
|
+
describe "action registry" do
|
80
|
+
it "has an action registry" do
|
81
|
+
instance.action_registry.should be_kind_of(Vagrant::Registry)
|
262
82
|
end
|
263
83
|
|
264
|
-
|
265
|
-
|
266
|
-
config.vm.define :web
|
267
|
-
config.vm.define :db
|
268
|
-
vf
|
269
|
-
|
270
|
-
assert env.logger === env.vms[:web].env.logger
|
84
|
+
it "should have the built-in actions in the registry" do
|
85
|
+
instance.action_registry.get(:provision).should_not be_nil
|
271
86
|
end
|
272
87
|
end
|
273
88
|
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
rootfile = "Foo"
|
283
|
-
|
284
|
-
search_seq = sequence("search_seq")
|
285
|
-
paths.each do |path|
|
286
|
-
File.expects(:exist?).with(path.join(rootfile).to_s).returns(false).in_sequence(search_seq)
|
287
|
-
File.expects(:exist?).with(path).returns(true).in_sequence(search_seq) if !path.root?
|
89
|
+
describe "loading configuration" do
|
90
|
+
it "should load global configuration" do
|
91
|
+
environment = isolated_environment do |env|
|
92
|
+
env.vagrantfile(<<-VF)
|
93
|
+
Vagrant::Config.run do |config|
|
94
|
+
config.vagrant.dotfile_name = "foo"
|
95
|
+
end
|
96
|
+
VF
|
288
97
|
end
|
289
98
|
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
should "should set the path for the rootfile" do
|
294
|
-
rootfile = "Foo"
|
295
|
-
path = Pathname.new(File.expand_path("/foo"))
|
296
|
-
File.expects(:exist?).with(path.join(rootfile).to_s).returns(true)
|
297
|
-
|
298
|
-
assert_equal path, @klass.new(:cwd => path, :vagrantfile_name => rootfile).root_path
|
299
|
-
end
|
300
|
-
|
301
|
-
should "not infinite loop on relative paths" do
|
302
|
-
assert @klass.new(:cwd => "../test").root_path.nil?
|
303
|
-
end
|
304
|
-
|
305
|
-
should "only load the root path once" do
|
306
|
-
rootfile = "foo"
|
307
|
-
env = @klass.new(:vagrantfile_name => rootfile)
|
308
|
-
File.expects(:exist?).with(env.cwd.join(rootfile).to_s).returns(true).once
|
309
|
-
|
310
|
-
assert_equal env.cwd, env.root_path
|
311
|
-
assert_equal env.cwd, env.root_path
|
312
|
-
assert_equal env.cwd, env.root_path
|
313
|
-
end
|
314
|
-
|
315
|
-
should "only load the root path once even if nil" do
|
316
|
-
File.stubs(:exist?).returns(false)
|
317
|
-
|
318
|
-
env = @klass.new
|
319
|
-
assert env.root_path.nil?
|
320
|
-
assert env.root_path.nil?
|
321
|
-
assert env.root_path.nil?
|
322
|
-
end
|
323
|
-
end
|
324
|
-
|
325
|
-
context "locking" do
|
326
|
-
setup do
|
327
|
-
@instance = @klass.new(:lock_path => Tempfile.new('vagrant-test').path)
|
328
|
-
end
|
329
|
-
|
330
|
-
should "allow nesting locks" do
|
331
|
-
assert_nothing_raised do
|
332
|
-
@instance.lock do
|
333
|
-
@instance.lock do
|
334
|
-
# Nothing
|
335
|
-
end
|
336
|
-
end
|
337
|
-
end
|
99
|
+
env = environment.create_vagrant_env
|
100
|
+
env.config.global.vagrant.dotfile_name.should == "foo"
|
338
101
|
end
|
339
102
|
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
Thread.current[:locked] = true
|
348
|
-
loop { sleep 1000 }
|
349
|
-
end
|
350
|
-
rescue Vagrant::Errors::EnvironmentLockedError
|
351
|
-
Thread.current[:locked] = false
|
352
|
-
end
|
353
|
-
end
|
354
|
-
|
355
|
-
# Wait until the first thread has acquired the lock
|
356
|
-
loop do
|
357
|
-
break if first[:locked] || !first.alive?
|
358
|
-
Thread.pass
|
359
|
-
end
|
360
|
-
|
361
|
-
# Verify that the fist got the lock
|
362
|
-
assert first[:locked]
|
363
|
-
|
364
|
-
# Create second locked thread which should fail
|
365
|
-
second = Thread.new do
|
366
|
-
begin
|
367
|
-
@another.lock do
|
368
|
-
Thread.current[:error] = false
|
369
|
-
end
|
370
|
-
rescue Vagrant::Errors::EnvironmentLockedError
|
371
|
-
Thread.current[:error] = true
|
372
|
-
end
|
103
|
+
it "should load VM configuration" do
|
104
|
+
environment = isolated_environment do |env|
|
105
|
+
env.vagrantfile(<<-VF)
|
106
|
+
Vagrant::Config.run do |config|
|
107
|
+
config.vagrant.dotfile_name = "foo"
|
108
|
+
end
|
109
|
+
VF
|
373
110
|
end
|
374
111
|
|
375
|
-
|
376
|
-
|
377
|
-
assert second[:error]
|
378
|
-
|
379
|
-
# Make sure both threads are killed
|
380
|
-
first.kill
|
381
|
-
second.kill
|
382
|
-
end
|
383
|
-
end
|
384
|
-
|
385
|
-
context "accessing the configuration" do
|
386
|
-
should "load the environment if its not already loaded" do
|
387
|
-
env = @klass.new(:cwd => vagrantfile)
|
388
|
-
env.expects(:load!).once
|
389
|
-
env.config
|
112
|
+
env = environment.create_vagrant_env
|
113
|
+
env.config.for_vm(:default).vm.name.should == :default
|
390
114
|
end
|
391
115
|
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
116
|
+
it "should load VM configuration with multiple VMs" do
|
117
|
+
environment = isolated_environment do |env|
|
118
|
+
env.vagrantfile(<<-VF)
|
119
|
+
Vagrant::Config.run do |config|
|
120
|
+
config.vm.define :foo do |vm|
|
121
|
+
vm.ssh.port = 100
|
397
122
|
end
|
398
123
|
|
399
|
-
|
400
|
-
|
401
|
-
env = vagrant_env
|
402
|
-
assert env.boxes.is_a?(Vagrant::BoxCollection)
|
403
|
-
assert_equal env, env.boxes.env
|
404
|
-
end
|
405
|
-
|
406
|
-
should "not load the environment if its already loaded" do
|
407
|
-
env = vagrant_env
|
408
|
-
env.expects(:load!).never
|
409
|
-
env.boxes
|
410
|
-
end
|
411
|
-
|
412
|
-
should "return the parent's box collection if it has one" do
|
413
|
-
env = vagrant_env(vagrantfile(<<-vf))
|
414
|
-
config.vm.define :web
|
415
|
-
config.vm.define :db
|
416
|
-
vf
|
417
|
-
|
418
|
-
assert env.vms[:web].env.boxes.equal?(env.boxes)
|
419
|
-
end
|
124
|
+
config.vm.define :bar do |vm|
|
125
|
+
vm.ssh.port = 200
|
420
126
|
end
|
421
|
-
|
422
|
-
|
423
|
-
should "return the box that is specified in the config" do
|
424
|
-
vagrant_box("foo")
|
425
|
-
env = vagrant_env(vagrantfile(<<-vf))
|
426
|
-
config.vm.box = "foo"
|
427
|
-
vf
|
428
|
-
|
429
|
-
assert env.box
|
430
|
-
assert_equal "foo", env.box.name
|
431
|
-
end
|
432
|
-
end
|
433
|
-
|
434
|
-
context "accessing the VMs hash" do
|
435
|
-
should "load the environment if its not already loaded" do
|
436
|
-
env = @klass.new(:cwd => vagrantfile)
|
437
|
-
assert !env.loaded?
|
438
|
-
env.vms
|
439
|
-
assert env.loaded?
|
440
|
-
end
|
441
|
-
|
442
|
-
should "not load the environment if its already loaded" do
|
443
|
-
env = vagrant_env
|
444
|
-
env.expects(:load!).never
|
445
|
-
env.vms
|
446
|
-
end
|
447
|
-
|
448
|
-
should "return the parent's VMs hash if it has one" do
|
449
|
-
env = vagrant_env(vagrantfile(<<-vf))
|
450
|
-
config.vm.define :web
|
451
|
-
config.vm.define :db
|
452
|
-
vf
|
453
|
-
|
454
|
-
assert env.vms[:web].env.vms.equal?(env.vms)
|
455
|
-
end
|
456
|
-
end
|
457
|
-
|
458
|
-
context "loading" do
|
459
|
-
context "overall load method" do
|
460
|
-
should "load! should call proper sequence and return itself" do
|
461
|
-
env = @klass.new(:cwd => vagrantfile)
|
462
|
-
call_seq = sequence("call_sequence")
|
463
|
-
@klass.expects(:check_virtualbox!).once.in_sequence(call_seq)
|
464
|
-
env.expects(:load_config!).once.in_sequence(call_seq)
|
465
|
-
assert_equal env, env.load!
|
466
|
-
end
|
467
|
-
end
|
468
|
-
|
469
|
-
context "loading config" do
|
470
|
-
setup do
|
471
|
-
clean_paths
|
472
|
-
@env = @klass.new(:cwd => vagrantfile)
|
473
|
-
end
|
474
|
-
|
475
|
-
def create_box_vagrantfile
|
476
|
-
vagrantfile(vagrant_box("box"), <<-FILE)
|
477
|
-
config.package.name = "box.box"
|
478
|
-
config.vm.base_mac = "set"
|
479
|
-
FILE
|
480
|
-
end
|
481
|
-
|
482
|
-
def create_home_vagrantfile
|
483
|
-
vagrantfile(home_path, 'config.package.name = "home.box"')
|
484
|
-
end
|
485
|
-
|
486
|
-
def create_root_vagrantfile
|
487
|
-
vagrantfile(@env.root_path, 'config.package.name = "root.box"')
|
488
|
-
end
|
489
|
-
|
490
|
-
should "load from the project root" do
|
491
|
-
assert_equal "package.box", @env.config.package.name
|
492
|
-
end
|
493
|
-
|
494
|
-
should "load from box if specified" do
|
495
|
-
create_box_vagrantfile
|
496
|
-
vagrantfile(@env.root_path, "config.vm.box = 'box'")
|
497
|
-
|
498
|
-
assert_equal "box.box", @env.primary_vm.env.config.package.name
|
499
|
-
end
|
500
|
-
|
501
|
-
should "load from home path if exists" do
|
502
|
-
create_home_vagrantfile
|
503
|
-
assert_equal "home.box", @env.config.package.name
|
504
|
-
end
|
505
|
-
|
506
|
-
should "load from root path" do
|
507
|
-
create_home_vagrantfile
|
508
|
-
create_root_vagrantfile
|
509
|
-
assert_equal "root.box", @env.config.package.name
|
510
|
-
end
|
511
|
-
|
512
|
-
should "load from a sub-vm configuration if environment represents a VM" do
|
513
|
-
create_home_vagrantfile
|
514
|
-
create_box_vagrantfile
|
515
|
-
vagrantfile(@env.root_path, <<-vf)
|
516
|
-
config.package.name = "root.box"
|
517
|
-
config.vm.define :web do |web|
|
518
|
-
web.vm.box = "box"
|
519
|
-
web.package.name = "web.box"
|
520
|
-
end
|
521
|
-
vf
|
522
|
-
|
523
|
-
assert_equal "root.box", @env.config.package.name
|
524
|
-
assert_equal "web.box", @env.vms[:web].env.config.package.name
|
525
|
-
assert_equal "set", @env.vms[:web].env.config.vm.base_mac
|
127
|
+
end
|
128
|
+
VF
|
526
129
|
end
|
527
130
|
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
# First load the config normally
|
532
|
-
@env.load_config!
|
533
|
-
assert_equal "box", @env.config.vm.box
|
534
|
-
assert_not_equal "set", @env.config.vm.base_mac
|
535
|
-
|
536
|
-
# Modify the Vagrantfile and reload it, then verify new results
|
537
|
-
# are available
|
538
|
-
vagrantfile(@env.root_path, "config.vm.base_mac = 'set'")
|
539
|
-
@env.reload_config!
|
540
|
-
assert_equal "set", @env.config.vm.base_mac
|
541
|
-
end
|
131
|
+
env = environment.create_vagrant_env
|
132
|
+
env.config.for_vm(:foo).ssh.port.should == 100
|
133
|
+
env.config.for_vm(:bar).ssh.port.should == 200
|
542
134
|
end
|
543
135
|
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
should "create each directory if it doesn't exist" do
|
553
|
-
create_seq = sequence("create_seq")
|
554
|
-
File.stubs(:directory?).returns(false)
|
555
|
-
@klass::HOME_SUBDIRS.each do |subdir|
|
556
|
-
FileUtils.expects(:mkdir_p).with(@env.home_path.join(subdir)).in_sequence(create_seq)
|
557
|
-
end
|
136
|
+
it "should load box configuration" do
|
137
|
+
environment = isolated_environment do |env|
|
138
|
+
env.vagrantfile(<<-VF)
|
139
|
+
Vagrant::Config.run do |config|
|
140
|
+
config.vm.box = "base"
|
141
|
+
end
|
142
|
+
VF
|
558
143
|
|
559
|
-
|
144
|
+
env.box("base", <<-VF)
|
145
|
+
Vagrant::Config.run do |config|
|
146
|
+
config.ssh.port = 100
|
147
|
+
end
|
148
|
+
VF
|
560
149
|
end
|
561
150
|
|
562
|
-
|
563
|
-
|
564
|
-
FileUtils.expects(:mkdir_p).never
|
565
|
-
@env.load_home_directory!
|
566
|
-
end
|
151
|
+
env = environment.create_vagrant_env
|
152
|
+
env.config.for_vm(:default).ssh.port.should == 100
|
567
153
|
end
|
154
|
+
end
|
568
155
|
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
should "load all the VMs from the dotfile" do
|
575
|
-
@env.local_data[:active] = { "foo" => "bar", "bar" => "baz" }
|
576
|
-
|
577
|
-
results = {}
|
578
|
-
@env.local_data[:active].each do |key, value|
|
579
|
-
vm = mock("vm#{key}")
|
580
|
-
Vagrant::VM.expects(:find).with(value, @env, key.to_sym).returns(vm)
|
581
|
-
results[key.to_sym] = vm
|
582
|
-
end
|
583
|
-
|
584
|
-
returned = @env.load_vms!
|
156
|
+
describe "ui" do
|
157
|
+
it "should be a silent UI by default" do
|
158
|
+
described_class.new.ui.should be_kind_of(Vagrant::UI::Silent)
|
159
|
+
end
|
585
160
|
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
end
|
161
|
+
it "should be a UI given in the constructor" do
|
162
|
+
# Create a custom UI for our test
|
163
|
+
class CustomUI < Vagrant::UI::Interface; end
|
590
164
|
|
591
|
-
|
592
|
-
|
593
|
-
@env.load_vms!
|
594
|
-
assert_nil @env.vm
|
595
|
-
end
|
165
|
+
instance = described_class.new(:ui_class => CustomUI)
|
166
|
+
instance.ui.should be_kind_of(CustomUI)
|
596
167
|
end
|
597
168
|
end
|
598
169
|
end
|