Update tests for GRPC errors

This commit is contained in:
sophia 2022-01-11 14:38:22 -06:00 committed by Paul Hinze
parent deb667ecd3
commit 53f7b3f8eb
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
2 changed files with 7 additions and 11 deletions

View File

@ -24,16 +24,12 @@ module VagrantPlugins
end
Thread.current.thread_variable_set(:service_info, info)
return if !block_given?
begin
yield info
rescue
raise
ensure
Service::ServiceInfo.manager_tracker.deactivate do
Vagrant.plugin("2").disable_remote_manager
end
Thread.current.thread_variable_set(:service_info, nil)
yield info
ensure
Service::ServiceInfo.manager_tracker.deactivate do
Vagrant.plugin("2").disable_remote_manager
end
Thread.current.thread_variable_set(:service_info, nil)
end
end
end

View File

@ -65,7 +65,7 @@ describe VagrantPlugins::CommandServe::Service::HostService do
it "raises an error for unknown plugins" do
ctx = DummyContext.new("idontexisthahaha")
expect { subject.parent("", ctx) }.to raise_error(RuntimeError)
expect { subject.parent("", ctx) }.to raise_error(GRPC::BadStatus)
end
it "requests parent from plugins" do
@ -101,7 +101,7 @@ describe VagrantPlugins::CommandServe::Service::HostService do
it "raises an error for unknown plugins" do
ctx = DummyContext.new("idontexisthahaha")
expect { subject.detect("", ctx) }.to raise_error(RuntimeError)
expect { subject.detect("", ctx) }.to raise_error(GRPC::BadStatus)
end
it "detects true plugins" do