aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2016-06-01 14:10:29 -0700
committerGravatar Jan Tattermusch <jtattermusch@google.com>2016-06-06 15:04:05 -0700
commit25e3ba57b135d75ae1985fc1a94b5c498b8c8a40 (patch)
tree21885adb890ccfac321b731b618026a0ca136844
parent739ee1b159cd0925cbc448c4b95728926f1a0e60 (diff)
improve shutdown tests
-rw-r--r--src/csharp/Grpc.Core.Tests/ShutdownHookServerTest.cs7
-rw-r--r--src/csharp/Grpc.Core.Tests/ShutdownHookTest.cs4
2 files changed, 5 insertions, 6 deletions
diff --git a/src/csharp/Grpc.Core.Tests/ShutdownHookServerTest.cs b/src/csharp/Grpc.Core.Tests/ShutdownHookServerTest.cs
index 7990a7d15f..2f40e1a8ef 100644
--- a/src/csharp/Grpc.Core.Tests/ShutdownHookServerTest.cs
+++ b/src/csharp/Grpc.Core.Tests/ShutdownHookServerTest.cs
@@ -59,10 +59,9 @@ namespace Grpc.Core.Tests
server.Start();
AppDomain.CurrentDomain.ProcessExit += (object sender, EventArgs e) =>
{
- // TODO: expose API for killing all servers
- // TODO: expose API for closing all channels
- server.KillAsync();
- GrpcEnvironment.ReleaseAsync();
+ var shutdownChannelsTask = GrpcEnvironment.ShutdownChannelsAsync();
+ var killServersTask = GrpcEnvironment.KillServersAsync();
+ Task.WaitAll(shutdownChannelsTask, killServersTask);
};
}
diff --git a/src/csharp/Grpc.Core.Tests/ShutdownHookTest.cs b/src/csharp/Grpc.Core.Tests/ShutdownHookTest.cs
index 301ae091c6..da71ed7e2e 100644
--- a/src/csharp/Grpc.Core.Tests/ShutdownHookTest.cs
+++ b/src/csharp/Grpc.Core.Tests/ShutdownHookTest.cs
@@ -55,10 +55,10 @@ namespace Grpc.Core.Tests
public void AppDomainProcessExitHook()
{
var channel = new Channel(Host, 1000, ChannelCredentials.Insecure);
+ var channel2 = new Channel(Host, 1001, ChannelCredentials.Insecure);
AppDomain.CurrentDomain.ProcessExit += (object sender, EventArgs e) =>
{
- // TODO: expose API to shutdown all channels.
- channel.ShutdownAsync();
+ GrpcEnvironment.ShutdownChannelsAsync().Wait();
};
}