aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/node/test
diff options
context:
space:
mode:
authorGravatar murgatroid99 <mlumish@google.com>2015-08-20 11:32:08 -0700
committerGravatar murgatroid99 <mlumish@google.com>2015-08-20 11:32:08 -0700
commit5bb9fc178913a68bcb1a021a2d820632f9b0d8c0 (patch)
treefebeb5abde0a2a4b1c49ee7c5162152ce097addf /src/node/test
parente796e1fd7c6a01825745a308309ad8621202e53a (diff)
parentc5dac97bd3b1e87b228d0d130ce2cb457297fdd0 (diff)
Merge branch 'node_server_graceful_shutdown' into node_metadata_class
Diffstat (limited to 'src/node/test')
-rw-r--r--src/node/test/call_test.js2
-rw-r--r--src/node/test/end_to_end_test.js2
-rw-r--r--src/node/test/health_test.js2
-rw-r--r--src/node/test/interop_sanity_test.js2
-rw-r--r--src/node/test/math_client_test.js2
-rw-r--r--src/node/test/server_test.js31
-rw-r--r--src/node/test/surface_test.js16
7 files changed, 43 insertions, 14 deletions
diff --git a/src/node/test/call_test.js b/src/node/test/call_test.js
index 8d0f20b074..e7f071bcd5 100644
--- a/src/node/test/call_test.js
+++ b/src/node/test/call_test.js
@@ -61,7 +61,7 @@ describe('call', function() {
channel = new grpc.Channel('localhost:' + port, insecureCreds);
});
after(function() {
- server.shutdown();
+ server.forceShutdown();
});
describe('constructor', function() {
it('should reject anything less than 3 arguments', function() {
diff --git a/src/node/test/end_to_end_test.js b/src/node/test/end_to_end_test.js
index 7574d98b8a..4b8da3bfb1 100644
--- a/src/node/test/end_to_end_test.js
+++ b/src/node/test/end_to_end_test.js
@@ -70,7 +70,7 @@ describe('end-to-end', function() {
channel = new grpc.Channel('localhost:' + port_num, insecureCreds);
});
after(function() {
- server.shutdown();
+ server.forceShutdown();
});
it('should start and end a request without error', function(complete) {
var done = multiDone(complete, 2);
diff --git a/src/node/test/health_test.js b/src/node/test/health_test.js
index be4ef1d251..22c58d3956 100644
--- a/src/node/test/health_test.js
+++ b/src/node/test/health_test.js
@@ -61,7 +61,7 @@ describe('Health Checking', function() {
grpc.Credentials.createInsecure());
});
after(function() {
- healthServer.shutdown();
+ healthServer.forceShutdown();
});
it('should say an enabled service is SERVING', function(done) {
healthClient.check({service: ''}, function(err, response) {
diff --git a/src/node/test/interop_sanity_test.js b/src/node/test/interop_sanity_test.js
index 0a5eb29c0c..2ca07c1d50 100644
--- a/src/node/test/interop_sanity_test.js
+++ b/src/node/test/interop_sanity_test.js
@@ -51,7 +51,7 @@ describe('Interop tests', function() {
done();
});
after(function() {
- server.shutdown();
+ server.forceShutdown();
});
// This depends on not using a binary stream
it('should pass empty_unary', function(done) {
diff --git a/src/node/test/math_client_test.js b/src/node/test/math_client_test.js
index ef01870a4c..80b0c5ff2a 100644
--- a/src/node/test/math_client_test.js
+++ b/src/node/test/math_client_test.js
@@ -59,7 +59,7 @@ describe('Math client', function() {
done();
});
after(function() {
- server.shutdown();
+ server.forceShutdown();
});
it('should handle a single request', function(done) {
var arg = {dividend: 7, divisor: 4};
diff --git a/src/node/test/server_test.js b/src/node/test/server_test.js
index 20c9a07ffa..9574709f60 100644
--- a/src/node/test/server_test.js
+++ b/src/node/test/server_test.js
@@ -90,7 +90,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() {
@@ -98,4 +98,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();
+ });
+ });
});
diff --git a/src/node/test/surface_test.js b/src/node/test/surface_test.js
index c3caa4d5a3..f000983a4a 100644
--- a/src/node/test/surface_test.js
+++ b/src/node/test/surface_test.js
@@ -104,7 +104,7 @@ describe('Server.prototype.addProtoService', function() {
server = new grpc.Server();
});
afterEach(function() {
- server.shutdown();
+ server.forceShutdown();
});
it('Should succeed with a single service', function() {
assert.doesNotThrow(function() {
@@ -148,7 +148,7 @@ describe('Client#$waitForReady', function() {
client = new Client('localhost:' + port, grpc.Credentials.createInsecure());
});
after(function() {
- server.shutdown();
+ server.forceShutdown();
});
it('should complete when called alone', function(done) {
client.$waitForReady(Infinity, function(error) {
@@ -203,7 +203,7 @@ describe('Echo service', function() {
server.start();
});
after(function() {
- server.shutdown();
+ server.forceShutdown();
});
it('should echo the recieved message directly', function(done) {
client.echo({value: 'test value', value2: 3}, function(error, response) {
@@ -248,7 +248,7 @@ describe('Generic client and server', function() {
grpc.Credentials.createInsecure());
});
after(function() {
- server.shutdown();
+ server.forceShutdown();
});
it('Should respond with a capitalized string', function(done) {
client.capitalize('abc', function(err, response) {
@@ -299,7 +299,7 @@ describe('Echo metadata', function() {
metadata.set('key', 'value');
});
after(function() {
- server.shutdown();
+ server.forceShutdown();
});
it('with unary call', function(done) {
var call = client.unary({}, function(err, data) {
@@ -422,7 +422,7 @@ describe('Other conditions', function() {
server.start();
});
after(function() {
- server.shutdown();
+ server.forceShutdown();
});
it('channel.getTarget should be available', function() {
assert.strictEqual(typeof client.channel.getTarget(), 'string');
@@ -684,7 +684,7 @@ describe('Other conditions', function() {
});
afterEach(function() {
console.log('Shutting down server');
- proxy.shutdown();
+ proxy.forceShutdown();
});
describe('Cancellation', function() {
it('With a unary call', function(done) {
@@ -850,7 +850,7 @@ describe('Cancelling surface client', function() {
server.start();
});
after(function() {
- server.shutdown();
+ server.forceShutdown();
});
it('Should correctly cancel a unary call', function(done) {
var call = client.div({'divisor': 0, 'dividend': 0}, function(err, resp) {