|
|
|
@ -56,14 +56,21 @@ function multiDone(done, count) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
describe('end-to-end', function() { |
|
|
|
|
var server; |
|
|
|
|
var channel; |
|
|
|
|
before(function() { |
|
|
|
|
server = new grpc.Server(); |
|
|
|
|
var port_num = server.addHttp2Port('0.0.0.0:0'); |
|
|
|
|
server.start(); |
|
|
|
|
channel = new grpc.Channel('localhost:' + port_num); |
|
|
|
|
}); |
|
|
|
|
after(function() { |
|
|
|
|
server.shutdown(); |
|
|
|
|
}); |
|
|
|
|
it('should start and end a request without error', function(complete) { |
|
|
|
|
var server = new grpc.Server(); |
|
|
|
|
var done = multiDone(function() { |
|
|
|
|
complete(); |
|
|
|
|
server.shutdown(); |
|
|
|
|
}, 2); |
|
|
|
|
var port_num = server.addHttp2Port('0.0.0.0:0'); |
|
|
|
|
var channel = new grpc.Channel('localhost:' + port_num); |
|
|
|
|
var deadline = new Date(); |
|
|
|
|
deadline.setSeconds(deadline.getSeconds() + 3); |
|
|
|
|
var status_text = 'xyz'; |
|
|
|
@ -81,7 +88,6 @@ describe('end-to-end', function() { |
|
|
|
|
done(); |
|
|
|
|
}, 0); |
|
|
|
|
|
|
|
|
|
server.start(); |
|
|
|
|
server.requestCall(function(event) { |
|
|
|
|
assert.strictEqual(event.type, grpc.completionType.SERVER_RPC_NEW); |
|
|
|
|
var server_call = event.call; |
|
|
|
@ -109,13 +115,10 @@ describe('end-to-end', function() { |
|
|
|
|
it('should send and receive data without error', function(complete) { |
|
|
|
|
var req_text = 'client_request'; |
|
|
|
|
var reply_text = 'server_response'; |
|
|
|
|
var server = new grpc.Server(); |
|
|
|
|
var done = multiDone(function() { |
|
|
|
|
complete(); |
|
|
|
|
server.shutdown(); |
|
|
|
|
}, 6); |
|
|
|
|
var port_num = server.addHttp2Port('0.0.0.0:0'); |
|
|
|
|
var channel = new grpc.Channel('localhost:' + port_num); |
|
|
|
|
var deadline = new Date(); |
|
|
|
|
deadline.setSeconds(deadline.getSeconds() + 3); |
|
|
|
|
var status_text = 'success'; |
|
|
|
@ -151,8 +154,6 @@ describe('end-to-end', function() { |
|
|
|
|
assert.strictEqual(event.data.toString(), reply_text); |
|
|
|
|
done(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
server.start(); |
|
|
|
|
server.requestCall(function(event) { |
|
|
|
|
assert.strictEqual(event.type, grpc.completionType.SERVER_RPC_NEW); |
|
|
|
|
var server_call = event.call; |
|
|
|
|