aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/node/test/server_test.js
diff options
context:
space:
mode:
authorGravatar Tim Emiola <tbetbetbe@users.noreply.github.com>2015-08-26 14:23:14 -0700
committerGravatar Tim Emiola <tbetbetbe@users.noreply.github.com>2015-08-26 14:23:14 -0700
commitda22c1521130336e4f3fdcf6b2f7f20fb944ef47 (patch)
treef586392b27fbefcb8b8a28802fbb22d2c16e0fd4 /src/node/test/server_test.js
parent495c0d332e3ad398d9b3ec7fa3f0f4811032bfa1 (diff)
parentda96957533c5288e679e2e5113c4ab3bfc0bef11 (diff)
Merge pull request #2993 from murgatroid99/node_server_graceful_shutdown
Prevent the Node server from locking up when shutting down
Diffstat (limited to 'src/node/test/server_test.js')
-rw-r--r--src/node/test/server_test.js31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/node/test/server_test.js b/src/node/test/server_test.js
index 78bac8da29..1e69d52e58 100644
--- a/src/node/test/server_test.js
+++ b/src/node/test/server_test.js
@@ -92,7 +92,7 @@ describe('server', function() {
server.addHttp2Port('0.0.0.0:0', grpc.ServerCredentials.createInsecure());
});
after(function() {
- server.shutdown();
+ server.forceShutdown();
});
it('should start without error', function() {
assert.doesNotThrow(function() {
@@ -100,4 +100,33 @@ describe('server', function() {
});
});
});
+ describe('shutdown', function() {
+ var server;
+ beforeEach(function() {
+ server = new grpc.Server();
+ server.addHttp2Port('0.0.0.0:0', grpc.ServerCredentials.createInsecure());
+ server.start();
+ });
+ afterEach(function() {
+ server.forceShutdown();
+ });
+ it('tryShutdown should shutdown successfully', function(done) {
+ server.tryShutdown(done);
+ });
+ it('forceShutdown should shutdown successfully', function() {
+ server.forceShutdown();
+ });
+ it('tryShutdown should be idempotent', function(done) {
+ server.tryShutdown(done);
+ server.tryShutdown(function() {});
+ });
+ it('forceShutdown should be idempotent', function() {
+ server.forceShutdown();
+ server.forceShutdown();
+ });
+ it('forceShutdown should trigger tryShutdown', function(done) {
+ server.tryShutdown(done);
+ server.forceShutdown();
+ });
+ });
});