From 1a72c9b631498c090b5f14384ced07f5bff1636b Mon Sep 17 00:00:00 2001 From: sophia Date: Wed, 9 Sep 2020 11:35:31 -0500 Subject: [PATCH 1/2] Set "allow_fstab_modification" for command tests This will avoid the step where a deafult synced folder implementation is seached for. ref: https://github.com/hashicorp/vagrant/blob/master/plugins/kernel_v2/config/vm.rb#L728 --- test/unit/plugins/commands/port/command_test.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/unit/plugins/commands/port/command_test.rb b/test/unit/plugins/commands/port/command_test.rb index 257a99be9..6228179ae 100644 --- a/test/unit/plugins/commands/port/command_test.rb +++ b/test/unit/plugins/commands/port/command_test.rb @@ -11,6 +11,7 @@ describe VagrantPlugins::CommandPort::Command do iso_env.vagrantfile(<<-VF) Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise64" + config.vm.allow_fstab_modification = false end VF iso_env.create_vagrant_env @@ -30,6 +31,8 @@ describe VagrantPlugins::CommandPort::Command do before do allow(machine).to receive(:state).and_return(state) allow(machine).to receive_message_chain(:synced_folders).and_return( double(:types => []) ) + allow(machine).to receive_message_chain(:synced_folders).and_return( double(:types => []) ) + allow(subject).to receive(:with_target_vms) { |&block| block.call(machine) } end @@ -38,6 +41,7 @@ describe VagrantPlugins::CommandPort::Command do iso_env.vagrantfile <<-EOH Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise64" + config.vm.allow_fstab_modification = false config.push.define "noop" do |push| push.bad = "ham" From 25f9284884e36b1f903f6b6a302c24d3688fad55 Mon Sep 17 00:00:00 2001 From: sophia Date: Wed, 9 Sep 2020 11:48:53 -0500 Subject: [PATCH 2/2] Disable synced folders for command tests This avoids doing a validation for usable synced folder implementation, which are not relaated to these tests. --- test/unit/plugins/commands/port/command_test.rb | 8 ++------ test/unit/plugins/commands/push/command_test.rb | 2 ++ test/unit/plugins/commands/validate/command_test.rb | 5 +++++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/test/unit/plugins/commands/port/command_test.rb b/test/unit/plugins/commands/port/command_test.rb index 6228179ae..1f963fa17 100644 --- a/test/unit/plugins/commands/port/command_test.rb +++ b/test/unit/plugins/commands/port/command_test.rb @@ -11,7 +11,7 @@ describe VagrantPlugins::CommandPort::Command do iso_env.vagrantfile(<<-VF) Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise64" - config.vm.allow_fstab_modification = false + config.vm.synced_folder ".", "/vagrant", disabled: true end VF iso_env.create_vagrant_env @@ -30,9 +30,6 @@ describe VagrantPlugins::CommandPort::Command do before do allow(machine).to receive(:state).and_return(state) - allow(machine).to receive_message_chain(:synced_folders).and_return( double(:types => []) ) - allow(machine).to receive_message_chain(:synced_folders).and_return( double(:types => []) ) - allow(subject).to receive(:with_target_vms) { |&block| block.call(machine) } end @@ -41,8 +38,7 @@ describe VagrantPlugins::CommandPort::Command do iso_env.vagrantfile <<-EOH Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise64" - config.vm.allow_fstab_modification = false - + config.vm.synced_folder ".", "/vagrant", disabled: true config.push.define "noop" do |push| push.bad = "ham" end diff --git a/test/unit/plugins/commands/push/command_test.rb b/test/unit/plugins/commands/push/command_test.rb index bc562306b..cba5c46b1 100644 --- a/test/unit/plugins/commands/push/command_test.rb +++ b/test/unit/plugins/commands/push/command_test.rb @@ -11,6 +11,7 @@ describe VagrantPlugins::CommandPush::Command do iso_env.vagrantfile(<<-VF) Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise64" + config.vm.synced_folder ".", "/vagrant", disabled: true end VF iso_env.create_vagrant_env @@ -47,6 +48,7 @@ describe VagrantPlugins::CommandPush::Command do iso_env.vagrantfile <<-EOH Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise64" + config.vm.synced_folder ".", "/vagrant", disabled: true config.push.define "noop" do |push| push.bad = "ham" diff --git a/test/unit/plugins/commands/validate/command_test.rb b/test/unit/plugins/commands/validate/command_test.rb index 0bcd45cbc..7ce031b58 100644 --- a/test/unit/plugins/commands/validate/command_test.rb +++ b/test/unit/plugins/commands/validate/command_test.rb @@ -30,6 +30,7 @@ describe VagrantPlugins::CommandValidate::Command do <<-VF Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise64" + config.vm.synced_folder ".", "/vagrant", disabled: true end VF end @@ -52,6 +53,7 @@ describe VagrantPlugins::CommandValidate::Command do <<-VF Vagrant.configure("2") do |config| config.vm.bix = "hashicorp/precise64" + config.vm.synced_folder ".", "/vagrant", disabled: true end VF end @@ -67,6 +69,7 @@ describe VagrantPlugins::CommandValidate::Command do <<-VF Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise64" + config.vm.synced_folder ".", "/vagrant", disabled: true config.vm.define "test" do |vm| vm.vm.provider :virtualbox @@ -97,6 +100,7 @@ describe VagrantPlugins::CommandValidate::Command do <<-VF Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise64" + config.vm.synced_folder ".", "/vagrant", disabled: true config.vm.define "test" do |vm| vm.vm.provider :virtualbox @@ -127,6 +131,7 @@ describe VagrantPlugins::CommandValidate::Command do <<-VF Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise64" + config.vm.synced_folder ".", "/vagrant", disabled: true config.vm.define "test" do |vm| vm.vm.hostname = "test"