diff --git a/Rakefile b/Rakefile index e6fe84b6b..f5f6bdf2e 100644 --- a/Rakefile +++ b/Rakefile @@ -6,6 +6,6 @@ Bundler::GemHelper.install_tasks task :default => :test Rake::TestTask.new do |t| - t.libs << "test" - t.pattern = 'test/**/*_test.rb' + t.libs << "test/unit" + t.pattern = 'test/unit/**/*_test.rb' end diff --git a/test/locales/en.yml b/test/unit/locales/en.yml similarity index 100% rename from test/locales/en.yml rename to test/unit/locales/en.yml diff --git a/test/test_helper.rb b/test/unit/test_helper.rb similarity index 100% rename from test/test_helper.rb rename to test/unit/test_helper.rb diff --git a/test/vagrant/action/box/destroy_test.rb b/test/unit/vagrant/action/box/destroy_test.rb similarity index 100% rename from test/vagrant/action/box/destroy_test.rb rename to test/unit/vagrant/action/box/destroy_test.rb diff --git a/test/vagrant/action/box/download_test.rb b/test/unit/vagrant/action/box/download_test.rb similarity index 100% rename from test/vagrant/action/box/download_test.rb rename to test/unit/vagrant/action/box/download_test.rb diff --git a/test/vagrant/action/box/package_test.rb b/test/unit/vagrant/action/box/package_test.rb similarity index 100% rename from test/vagrant/action/box/package_test.rb rename to test/unit/vagrant/action/box/package_test.rb diff --git a/test/vagrant/action/box/unpackage_test.rb b/test/unit/vagrant/action/box/unpackage_test.rb similarity index 100% rename from test/vagrant/action/box/unpackage_test.rb rename to test/unit/vagrant/action/box/unpackage_test.rb diff --git a/test/vagrant/action/box/verify_test.rb b/test/unit/vagrant/action/box/verify_test.rb similarity index 100% rename from test/vagrant/action/box/verify_test.rb rename to test/unit/vagrant/action/box/verify_test.rb diff --git a/test/vagrant/action/builder_test.rb b/test/unit/vagrant/action/builder_test.rb similarity index 100% rename from test/vagrant/action/builder_test.rb rename to test/unit/vagrant/action/builder_test.rb diff --git a/test/vagrant/action/env/set_test.rb b/test/unit/vagrant/action/env/set_test.rb similarity index 100% rename from test/vagrant/action/env/set_test.rb rename to test/unit/vagrant/action/env/set_test.rb diff --git a/test/vagrant/action/environment_test.rb b/test/unit/vagrant/action/environment_test.rb similarity index 100% rename from test/vagrant/action/environment_test.rb rename to test/unit/vagrant/action/environment_test.rb diff --git a/test/vagrant/action/general/package_test.rb b/test/unit/vagrant/action/general/package_test.rb similarity index 100% rename from test/vagrant/action/general/package_test.rb rename to test/unit/vagrant/action/general/package_test.rb diff --git a/test/vagrant/action/general/validate_test.rb b/test/unit/vagrant/action/general/validate_test.rb similarity index 100% rename from test/vagrant/action/general/validate_test.rb rename to test/unit/vagrant/action/general/validate_test.rb diff --git a/test/vagrant/action/vm/boot_test.rb b/test/unit/vagrant/action/vm/boot_test.rb similarity index 100% rename from test/vagrant/action/vm/boot_test.rb rename to test/unit/vagrant/action/vm/boot_test.rb diff --git a/test/vagrant/action/vm/check_accessible_test.rb b/test/unit/vagrant/action/vm/check_accessible_test.rb similarity index 100% rename from test/vagrant/action/vm/check_accessible_test.rb rename to test/unit/vagrant/action/vm/check_accessible_test.rb diff --git a/test/vagrant/action/vm/check_box_test.rb b/test/unit/vagrant/action/vm/check_box_test.rb similarity index 100% rename from test/vagrant/action/vm/check_box_test.rb rename to test/unit/vagrant/action/vm/check_box_test.rb diff --git a/test/vagrant/action/vm/check_guest_additions_test.rb b/test/unit/vagrant/action/vm/check_guest_additions_test.rb similarity index 100% rename from test/vagrant/action/vm/check_guest_additions_test.rb rename to test/unit/vagrant/action/vm/check_guest_additions_test.rb diff --git a/test/vagrant/action/vm/clean_machine_folder_test.rb b/test/unit/vagrant/action/vm/clean_machine_folder_test.rb similarity index 100% rename from test/vagrant/action/vm/clean_machine_folder_test.rb rename to test/unit/vagrant/action/vm/clean_machine_folder_test.rb diff --git a/test/vagrant/action/vm/clear_forwarded_ports_test.rb b/test/unit/vagrant/action/vm/clear_forwarded_ports_test.rb similarity index 100% rename from test/vagrant/action/vm/clear_forwarded_ports_test.rb rename to test/unit/vagrant/action/vm/clear_forwarded_ports_test.rb diff --git a/test/vagrant/action/vm/clear_nfs_exports_test.rb b/test/unit/vagrant/action/vm/clear_nfs_exports_test.rb similarity index 100% rename from test/vagrant/action/vm/clear_nfs_exports_test.rb rename to test/unit/vagrant/action/vm/clear_nfs_exports_test.rb diff --git a/test/vagrant/action/vm/clear_shared_folders_test.rb b/test/unit/vagrant/action/vm/clear_shared_folders_test.rb similarity index 100% rename from test/vagrant/action/vm/clear_shared_folders_test.rb rename to test/unit/vagrant/action/vm/clear_shared_folders_test.rb diff --git a/test/vagrant/action/vm/customize_test.rb b/test/unit/vagrant/action/vm/customize_test.rb similarity index 100% rename from test/vagrant/action/vm/customize_test.rb rename to test/unit/vagrant/action/vm/customize_test.rb diff --git a/test/vagrant/action/vm/destroy_test.rb b/test/unit/vagrant/action/vm/destroy_test.rb similarity index 100% rename from test/vagrant/action/vm/destroy_test.rb rename to test/unit/vagrant/action/vm/destroy_test.rb diff --git a/test/vagrant/action/vm/destroy_unused_network_interfaces_test.rb b/test/unit/vagrant/action/vm/destroy_unused_network_interfaces_test.rb similarity index 100% rename from test/vagrant/action/vm/destroy_unused_network_interfaces_test.rb rename to test/unit/vagrant/action/vm/destroy_unused_network_interfaces_test.rb diff --git a/test/vagrant/action/vm/discard_state_test.rb b/test/unit/vagrant/action/vm/discard_state_test.rb similarity index 100% rename from test/vagrant/action/vm/discard_state_test.rb rename to test/unit/vagrant/action/vm/discard_state_test.rb diff --git a/test/vagrant/action/vm/export_test.rb b/test/unit/vagrant/action/vm/export_test.rb similarity index 100% rename from test/vagrant/action/vm/export_test.rb rename to test/unit/vagrant/action/vm/export_test.rb diff --git a/test/vagrant/action/vm/forward_ports_helpers_test.rb b/test/unit/vagrant/action/vm/forward_ports_helpers_test.rb similarity index 88% rename from test/vagrant/action/vm/forward_ports_helpers_test.rb rename to test/unit/vagrant/action/vm/forward_ports_helpers_test.rb index d234bcd2d..d7caca041 100644 --- a/test/vagrant/action/vm/forward_ports_helpers_test.rb +++ b/test/unit/vagrant/action/vm/forward_ports_helpers_test.rb @@ -27,6 +27,7 @@ class ForwardPortsHelpersVMActionTest < Test::Unit::TestCase def mock_vm(options={}) options = { :running? => true, + :accessible? => true, :uuid => :foo }.merge(options) @@ -50,6 +51,12 @@ class ForwardPortsHelpersVMActionTest < Test::Unit::TestCase @instance.used_ports end + should "ignore VMs which aren't accessible" do + @vms << mock_vm(:accessible? => false) + @vms[0].expects(:forwarded_ports).never + @instance.used_ports + end + should "ignore VMs of the same uuid" do @vms << mock_vm(:uuid => @vm.uuid) @vms[0].expects(:forwarded_ports).never diff --git a/test/vagrant/action/vm/forward_ports_test.rb b/test/unit/vagrant/action/vm/forward_ports_test.rb similarity index 100% rename from test/vagrant/action/vm/forward_ports_test.rb rename to test/unit/vagrant/action/vm/forward_ports_test.rb diff --git a/test/vagrant/action/vm/halt_test.rb b/test/unit/vagrant/action/vm/halt_test.rb similarity index 100% rename from test/vagrant/action/vm/halt_test.rb rename to test/unit/vagrant/action/vm/halt_test.rb diff --git a/test/vagrant/action/vm/host_name_test.rb b/test/unit/vagrant/action/vm/host_name_test.rb similarity index 100% rename from test/vagrant/action/vm/host_name_test.rb rename to test/unit/vagrant/action/vm/host_name_test.rb diff --git a/test/vagrant/action/vm/import_test.rb b/test/unit/vagrant/action/vm/import_test.rb similarity index 100% rename from test/vagrant/action/vm/import_test.rb rename to test/unit/vagrant/action/vm/import_test.rb diff --git a/test/vagrant/action/vm/match_mac_address_test.rb b/test/unit/vagrant/action/vm/match_mac_address_test.rb similarity index 100% rename from test/vagrant/action/vm/match_mac_address_test.rb rename to test/unit/vagrant/action/vm/match_mac_address_test.rb diff --git a/test/vagrant/action/vm/modify_test.rb b/test/unit/vagrant/action/vm/modify_test.rb similarity index 100% rename from test/vagrant/action/vm/modify_test.rb rename to test/unit/vagrant/action/vm/modify_test.rb diff --git a/test/vagrant/action/vm/network_test.rb b/test/unit/vagrant/action/vm/network_test.rb similarity index 100% rename from test/vagrant/action/vm/network_test.rb rename to test/unit/vagrant/action/vm/network_test.rb diff --git a/test/vagrant/action/vm/nfs_helpers_test.rb b/test/unit/vagrant/action/vm/nfs_helpers_test.rb similarity index 100% rename from test/vagrant/action/vm/nfs_helpers_test.rb rename to test/unit/vagrant/action/vm/nfs_helpers_test.rb diff --git a/test/vagrant/action/vm/nfs_test.rb b/test/unit/vagrant/action/vm/nfs_test.rb similarity index 100% rename from test/vagrant/action/vm/nfs_test.rb rename to test/unit/vagrant/action/vm/nfs_test.rb diff --git a/test/vagrant/action/vm/package_test.rb b/test/unit/vagrant/action/vm/package_test.rb similarity index 100% rename from test/vagrant/action/vm/package_test.rb rename to test/unit/vagrant/action/vm/package_test.rb diff --git a/test/vagrant/action/vm/package_vagrantfile_test.rb b/test/unit/vagrant/action/vm/package_vagrantfile_test.rb similarity index 100% rename from test/vagrant/action/vm/package_vagrantfile_test.rb rename to test/unit/vagrant/action/vm/package_vagrantfile_test.rb diff --git a/test/vagrant/action/vm/provision_test.rb b/test/unit/vagrant/action/vm/provision_test.rb similarity index 100% rename from test/vagrant/action/vm/provision_test.rb rename to test/unit/vagrant/action/vm/provision_test.rb diff --git a/test/vagrant/action/vm/provisioner_cleanup_test.rb b/test/unit/vagrant/action/vm/provisioner_cleanup_test.rb similarity index 100% rename from test/vagrant/action/vm/provisioner_cleanup_test.rb rename to test/unit/vagrant/action/vm/provisioner_cleanup_test.rb diff --git a/test/vagrant/action/vm/resume_test.rb b/test/unit/vagrant/action/vm/resume_test.rb similarity index 100% rename from test/vagrant/action/vm/resume_test.rb rename to test/unit/vagrant/action/vm/resume_test.rb diff --git a/test/vagrant/action/vm/share_folders_test.rb b/test/unit/vagrant/action/vm/share_folders_test.rb similarity index 100% rename from test/vagrant/action/vm/share_folders_test.rb rename to test/unit/vagrant/action/vm/share_folders_test.rb diff --git a/test/vagrant/action/vm/suspend_test.rb b/test/unit/vagrant/action/vm/suspend_test.rb similarity index 100% rename from test/vagrant/action/vm/suspend_test.rb rename to test/unit/vagrant/action/vm/suspend_test.rb diff --git a/test/vagrant/action/warden_test.rb b/test/unit/vagrant/action/warden_test.rb similarity index 100% rename from test/vagrant/action/warden_test.rb rename to test/unit/vagrant/action/warden_test.rb diff --git a/test/vagrant/action_test.rb b/test/unit/vagrant/action_test.rb similarity index 100% rename from test/vagrant/action_test.rb rename to test/unit/vagrant/action_test.rb diff --git a/test/vagrant/box_collection_test.rb b/test/unit/vagrant/box_collection_test.rb similarity index 100% rename from test/vagrant/box_collection_test.rb rename to test/unit/vagrant/box_collection_test.rb diff --git a/test/vagrant/box_test.rb b/test/unit/vagrant/box_test.rb similarity index 100% rename from test/vagrant/box_test.rb rename to test/unit/vagrant/box_test.rb diff --git a/test/vagrant/cli_test.rb b/test/unit/vagrant/cli_test.rb similarity index 100% rename from test/vagrant/cli_test.rb rename to test/unit/vagrant/cli_test.rb diff --git a/test/vagrant/command/base_test.rb b/test/unit/vagrant/command/base_test.rb similarity index 100% rename from test/vagrant/command/base_test.rb rename to test/unit/vagrant/command/base_test.rb diff --git a/test/vagrant/command/group_base_test.rb b/test/unit/vagrant/command/group_base_test.rb similarity index 100% rename from test/vagrant/command/group_base_test.rb rename to test/unit/vagrant/command/group_base_test.rb diff --git a/test/vagrant/command/helpers_test.rb b/test/unit/vagrant/command/helpers_test.rb similarity index 100% rename from test/vagrant/command/helpers_test.rb rename to test/unit/vagrant/command/helpers_test.rb diff --git a/test/vagrant/command/package_test.rb b/test/unit/vagrant/command/package_test.rb similarity index 100% rename from test/vagrant/command/package_test.rb rename to test/unit/vagrant/command/package_test.rb diff --git a/test/vagrant/config/base_test.rb b/test/unit/vagrant/config/base_test.rb similarity index 100% rename from test/vagrant/config/base_test.rb rename to test/unit/vagrant/config/base_test.rb diff --git a/test/vagrant/config/error_recorder_test.rb b/test/unit/vagrant/config/error_recorder_test.rb similarity index 100% rename from test/vagrant/config/error_recorder_test.rb rename to test/unit/vagrant/config/error_recorder_test.rb diff --git a/test/vagrant/config/ssh_test.rb b/test/unit/vagrant/config/ssh_test.rb similarity index 100% rename from test/vagrant/config/ssh_test.rb rename to test/unit/vagrant/config/ssh_test.rb diff --git a/test/vagrant/config/vagrant_test.rb b/test/unit/vagrant/config/vagrant_test.rb similarity index 100% rename from test/vagrant/config/vagrant_test.rb rename to test/unit/vagrant/config/vagrant_test.rb diff --git a/test/vagrant/config/vm/provisioner_test.rb b/test/unit/vagrant/config/vm/provisioner_test.rb similarity index 100% rename from test/vagrant/config/vm/provisioner_test.rb rename to test/unit/vagrant/config/vm/provisioner_test.rb diff --git a/test/vagrant/config/vm_test.rb b/test/unit/vagrant/config/vm_test.rb similarity index 100% rename from test/vagrant/config/vm_test.rb rename to test/unit/vagrant/config/vm_test.rb diff --git a/test/vagrant/config_test.rb b/test/unit/vagrant/config_test.rb similarity index 100% rename from test/vagrant/config_test.rb rename to test/unit/vagrant/config_test.rb diff --git a/test/vagrant/data_store_test.rb b/test/unit/vagrant/data_store_test.rb similarity index 100% rename from test/vagrant/data_store_test.rb rename to test/unit/vagrant/data_store_test.rb diff --git a/test/vagrant/downloaders/base_test.rb b/test/unit/vagrant/downloaders/base_test.rb similarity index 100% rename from test/vagrant/downloaders/base_test.rb rename to test/unit/vagrant/downloaders/base_test.rb diff --git a/test/vagrant/downloaders/file_test.rb b/test/unit/vagrant/downloaders/file_test.rb similarity index 100% rename from test/vagrant/downloaders/file_test.rb rename to test/unit/vagrant/downloaders/file_test.rb diff --git a/test/vagrant/downloaders/http_test.rb b/test/unit/vagrant/downloaders/http_test.rb similarity index 100% rename from test/vagrant/downloaders/http_test.rb rename to test/unit/vagrant/downloaders/http_test.rb diff --git a/test/vagrant/environment_test.rb b/test/unit/vagrant/environment_test.rb similarity index 100% rename from test/vagrant/environment_test.rb rename to test/unit/vagrant/environment_test.rb diff --git a/test/vagrant/errors_test.rb b/test/unit/vagrant/errors_test.rb similarity index 100% rename from test/vagrant/errors_test.rb rename to test/unit/vagrant/errors_test.rb diff --git a/test/vagrant/hosts/base_test.rb b/test/unit/vagrant/hosts/base_test.rb similarity index 100% rename from test/vagrant/hosts/base_test.rb rename to test/unit/vagrant/hosts/base_test.rb diff --git a/test/vagrant/hosts/bsd_test.rb b/test/unit/vagrant/hosts/bsd_test.rb similarity index 100% rename from test/vagrant/hosts/bsd_test.rb rename to test/unit/vagrant/hosts/bsd_test.rb diff --git a/test/vagrant/hosts/linux_test.rb b/test/unit/vagrant/hosts/linux_test.rb similarity index 100% rename from test/vagrant/hosts/linux_test.rb rename to test/unit/vagrant/hosts/linux_test.rb diff --git a/test/vagrant/plugin_test.rb b/test/unit/vagrant/plugin_test.rb similarity index 100% rename from test/vagrant/plugin_test.rb rename to test/unit/vagrant/plugin_test.rb diff --git a/test/vagrant/provisioners/base_test.rb b/test/unit/vagrant/provisioners/base_test.rb similarity index 100% rename from test/vagrant/provisioners/base_test.rb rename to test/unit/vagrant/provisioners/base_test.rb diff --git a/test/vagrant/provisioners/chef_client_test.rb b/test/unit/vagrant/provisioners/chef_client_test.rb similarity index 100% rename from test/vagrant/provisioners/chef_client_test.rb rename to test/unit/vagrant/provisioners/chef_client_test.rb diff --git a/test/vagrant/provisioners/chef_solo_test.rb b/test/unit/vagrant/provisioners/chef_solo_test.rb similarity index 100% rename from test/vagrant/provisioners/chef_solo_test.rb rename to test/unit/vagrant/provisioners/chef_solo_test.rb diff --git a/test/vagrant/provisioners/chef_test.rb b/test/unit/vagrant/provisioners/chef_test.rb similarity index 100% rename from test/vagrant/provisioners/chef_test.rb rename to test/unit/vagrant/provisioners/chef_test.rb diff --git a/test/vagrant/provisioners/puppet_server_test.rb b/test/unit/vagrant/provisioners/puppet_server_test.rb similarity index 100% rename from test/vagrant/provisioners/puppet_server_test.rb rename to test/unit/vagrant/provisioners/puppet_server_test.rb diff --git a/test/vagrant/provisioners/puppet_test.rb b/test/unit/vagrant/provisioners/puppet_test.rb similarity index 100% rename from test/vagrant/provisioners/puppet_test.rb rename to test/unit/vagrant/provisioners/puppet_test.rb diff --git a/test/vagrant/provisioners/shell_test.rb b/test/unit/vagrant/provisioners/shell_test.rb similarity index 100% rename from test/vagrant/provisioners/shell_test.rb rename to test/unit/vagrant/provisioners/shell_test.rb diff --git a/test/vagrant/ssh/session_test.rb b/test/unit/vagrant/ssh/session_test.rb similarity index 100% rename from test/vagrant/ssh/session_test.rb rename to test/unit/vagrant/ssh/session_test.rb diff --git a/test/vagrant/ssh_test.rb b/test/unit/vagrant/ssh_test.rb similarity index 100% rename from test/vagrant/ssh_test.rb rename to test/unit/vagrant/ssh_test.rb diff --git a/test/vagrant/systems/base_test.rb b/test/unit/vagrant/systems/base_test.rb similarity index 100% rename from test/vagrant/systems/base_test.rb rename to test/unit/vagrant/systems/base_test.rb diff --git a/test/vagrant/systems/linux_test.rb b/test/unit/vagrant/systems/linux_test.rb similarity index 100% rename from test/vagrant/systems/linux_test.rb rename to test/unit/vagrant/systems/linux_test.rb diff --git a/test/vagrant/ui_test.rb b/test/unit/vagrant/ui_test.rb similarity index 100% rename from test/vagrant/ui_test.rb rename to test/unit/vagrant/ui_test.rb diff --git a/test/vagrant/util/busy_test.rb b/test/unit/vagrant/util/busy_test.rb similarity index 100% rename from test/vagrant/util/busy_test.rb rename to test/unit/vagrant/util/busy_test.rb diff --git a/test/vagrant/util/counter_test.rb b/test/unit/vagrant/util/counter_test.rb similarity index 100% rename from test/vagrant/util/counter_test.rb rename to test/unit/vagrant/util/counter_test.rb diff --git a/test/vagrant/util/hash_with_indifferent_access_test.rb b/test/unit/vagrant/util/hash_with_indifferent_access_test.rb similarity index 100% rename from test/vagrant/util/hash_with_indifferent_access_test.rb rename to test/unit/vagrant/util/hash_with_indifferent_access_test.rb diff --git a/test/vagrant/util/platform_test.rb b/test/unit/vagrant/util/platform_test.rb similarity index 100% rename from test/vagrant/util/platform_test.rb rename to test/unit/vagrant/util/platform_test.rb diff --git a/test/vagrant/util/retryable_test.rb b/test/unit/vagrant/util/retryable_test.rb similarity index 100% rename from test/vagrant/util/retryable_test.rb rename to test/unit/vagrant/util/retryable_test.rb diff --git a/test/vagrant/util/stacked_proc_runner_test.rb b/test/unit/vagrant/util/stacked_proc_runner_test.rb similarity index 100% rename from test/vagrant/util/stacked_proc_runner_test.rb rename to test/unit/vagrant/util/stacked_proc_runner_test.rb diff --git a/test/vagrant/util/template_renderer_test.rb b/test/unit/vagrant/util/template_renderer_test.rb similarity index 100% rename from test/vagrant/util/template_renderer_test.rb rename to test/unit/vagrant/util/template_renderer_test.rb diff --git a/test/vagrant/vm_test.rb b/test/unit/vagrant/vm_test.rb similarity index 96% rename from test/vagrant/vm_test.rb rename to test/unit/vagrant/vm_test.rb index a6b622ddd..d816859f8 100644 --- a/test/vagrant/vm_test.rb +++ b/test/unit/vagrant/vm_test.rb @@ -262,6 +262,7 @@ class VMTest < Test::Unit::TestCase setup do @mock_vm.stubs(:running?).returns(false) @mock_vm.stubs(:saved?).returns(false) + @mock_vm.stubs(:accessible?).returns(true) end should "not do anything if the VM is already running" do @@ -286,6 +287,14 @@ class VMTest < Test::Unit::TestCase @vm.env.actions.expects(:run).with(:start, :foo => :bar).once @vm.start(:foo => :bar) end + + should "raise an exception if the VM is not accessible" do + @mock_vm.stubs(:accessible?).returns(false) + + assert_raises(Vagrant::Errors::VMInaccessible) { + @vm.start + } + end end end end