Skip to content
Snippets Groups Projects
Commit 25e3ba57 authored by Jan Tattermusch's avatar Jan Tattermusch
Browse files

improve shutdown tests

parent 739ee1b1
No related branches found
No related tags found
No related merge requests found
...@@ -59,10 +59,9 @@ namespace Grpc.Core.Tests ...@@ -59,10 +59,9 @@ namespace Grpc.Core.Tests
server.Start(); server.Start();
AppDomain.CurrentDomain.ProcessExit += (object sender, EventArgs e) => AppDomain.CurrentDomain.ProcessExit += (object sender, EventArgs e) =>
{ {
// TODO: expose API for killing all servers var shutdownChannelsTask = GrpcEnvironment.ShutdownChannelsAsync();
// TODO: expose API for closing all channels var killServersTask = GrpcEnvironment.KillServersAsync();
server.KillAsync(); Task.WaitAll(shutdownChannelsTask, killServersTask);
GrpcEnvironment.ReleaseAsync();
}; };
} }
......
...@@ -55,10 +55,10 @@ namespace Grpc.Core.Tests ...@@ -55,10 +55,10 @@ namespace Grpc.Core.Tests
public void AppDomainProcessExitHook() public void AppDomainProcessExitHook()
{ {
var channel = new Channel(Host, 1000, ChannelCredentials.Insecure); var channel = new Channel(Host, 1000, ChannelCredentials.Insecure);
var channel2 = new Channel(Host, 1001, ChannelCredentials.Insecure);
AppDomain.CurrentDomain.ProcessExit += (object sender, EventArgs e) => AppDomain.CurrentDomain.ProcessExit += (object sender, EventArgs e) =>
{ {
// TODO: expose API to shutdown all channels. GrpcEnvironment.ShutdownChannelsAsync().Wait();
channel.ShutdownAsync();
}; };
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment