Fix sometimes-failed test cases that may depend on running order

Signed-off-by: Mingxiang Xue <mingxiangxue@gmail.com>
This commit is contained in:
Mingxiang Xue 2020-07-03 20:40:02 +08:00
parent 7df0e62ade
commit 035ae6d460
5 changed files with 7 additions and 9 deletions

View File

@ -83,10 +83,10 @@ module VagrantPlugins
interfaces = VagrantPlugins::GuestLinux::Cap::NetworkInterfaces.network_interfaces(machine)
nettools = true
if systemd?(comm)
@logger.debug("Attempting to restart networking with systemctl")
logger.debug("Attempting to restart networking with systemctl")
nettools = false
else
@logger.debug("Attempting to restart networking with ifup/down nettools")
logger.debug("Attempting to restart networking with ifup/down nettools")
end
interfaces.each do |iface|

View File

@ -205,6 +205,7 @@ describe VagrantPlugins::ProviderVirtualBox::SyncedFolder do
allow(machine).to receive(:env)
allow(subject).to receive(:driver).and_return(driver)
allow(driver).to receive(:share_folders)
allow(ENV).to receive(:[]).and_call_original
allow(ENV).to receive(:[]).with("VAGRANT_DISABLE_VBOXSYMLINKCREATE").and_return(symlink_create_disable)
end

View File

@ -4,7 +4,8 @@ require "vagrant/util/experimental"
describe Vagrant::Util::Experimental do
include_context "unit"
before(:each) { described_class.reset! }
before(:all) { described_class.reset! }
after(:each) { described_class.reset! }
subject { described_class }
describe "#enabled?" do

View File

@ -4,7 +4,8 @@ require "vagrant/util/platform"
describe Vagrant::Util::Platform do
include_context "unit"
after{ described_class.reset! }
before(:all) { described_class.reset! }
after { described_class.reset! }
subject { described_class }
describe "#cygwin_path" do

View File

@ -48,11 +48,6 @@ describe Vagrant do
end
describe "has_plugin?" do
after(:each) do
manager.reset!
end
let(:manager) { described_class.plugin("2").manager }
it "should find the installed plugin by the registered name" do
Class.new(described_class.plugin(Vagrant::Config::CURRENT_VERSION)) do