diff options
author | Craig Tiller <craig.tiller@gmail.com> | 2015-01-23 14:57:29 -0800 |
---|---|---|
committer | Craig Tiller <craig.tiller@gmail.com> | 2015-01-23 14:57:29 -0800 |
commit | 5d0d33bbdeeb9c84b5bb15c5fad7ab50bd5da7e3 (patch) | |
tree | a1e1b12efec98ee0901f2f78053c8e6f646dc4cd /src/node/test | |
parent | efcb4da8e005a5c0f24a64f4943095fd4e60fdc0 (diff) | |
parent | c0748898293935517ca390977a55db6ea1424f50 (diff) |
Merge branch 'kill-more-printf' of github.com:ctiller/grpc into kill-more-printf
Diffstat (limited to 'src/node/test')
-rw-r--r-- | src/node/test/call_test.js | 42 | ||||
-rw-r--r-- | src/node/test/constant_test.js | 1 | ||||
-rw-r--r-- | src/node/test/end_to_end_test.js | 58 | ||||
-rw-r--r-- | src/node/test/interop_sanity_test.js | 4 | ||||
-rw-r--r-- | src/node/test/server_test.js | 41 |
5 files changed, 63 insertions, 83 deletions
diff --git a/src/node/test/call_test.js b/src/node/test/call_test.js index e6dc9664f1..6e52ec89bd 100644 --- a/src/node/test/call_test.js +++ b/src/node/test/call_test.js @@ -118,12 +118,11 @@ describe('call', function() { call.addMetadata(5); }, TypeError); }); - it('should fail if startInvoke was already called', function(done) { + it('should fail if invoke was already called', function(done) { var call = new grpc.Call(channel, 'method', getDeadline(1)); - call.startInvoke(function() {}, - function() {}, - function() {done();}, - 0); + call.invoke(function() {}, + function() {done();}, + 0); assert.throws(function() { call.addMetadata({'key' : 'key', 'value' : new Buffer('value') }); }, function(err) { @@ -133,32 +132,26 @@ describe('call', function() { call.cancel(); }); }); - describe('startInvoke', function() { - it('should fail with fewer than 4 arguments', function() { + describe('invoke', function() { + it('should fail with fewer than 3 arguments', function() { var call = new grpc.Call(channel, 'method', getDeadline(1)); assert.throws(function() { - call.startInvoke(); + call.invoke(); }, TypeError); assert.throws(function() { - call.startInvoke(function() {}); + call.invoke(function() {}); }, TypeError); assert.throws(function() { - call.startInvoke(function() {}, - function() {}); - }, TypeError); - assert.throws(function() { - call.startInvoke(function() {}, - function() {}, - function() {}); + call.invoke(function() {}, + function() {}); }, TypeError); }); - it('should work with 3 args and an int', function(done) { + it('should work with 2 args and an int', function(done) { assert.doesNotThrow(function() { var call = new grpc.Call(channel, 'method', getDeadline(1)); - call.startInvoke(function() {}, - function() {}, - function() {done();}, - 0); + call.invoke(function() {}, + function() {done();}, + 0); // Cancel to speed up the test call.cancel(); }); @@ -166,12 +159,11 @@ describe('call', function() { it('should reject incorrectly typed arguments', function() { var call = new grpc.Call(channel, 'method', getDeadline(1)); assert.throws(function() { - call.startInvoke(0, 0, 0, 0); + call.invoke(0, 0, 0); }, TypeError); assert.throws(function() { - call.startInvoke(function() {}, - function() {}, - function() {}, 'test'); + call.invoke(function() {}, + function() {}, 'test'); }); }); }); diff --git a/src/node/test/constant_test.js b/src/node/test/constant_test.js index f65eea3cff..0138a55226 100644 --- a/src/node/test/constant_test.js +++ b/src/node/test/constant_test.js @@ -94,7 +94,6 @@ var opErrorNames = [ var completionTypeNames = [ 'QUEUE_SHUTDOWN', 'READ', - 'INVOKE_ACCEPTED', 'WRITE_ACCEPTED', 'FINISH_ACCEPTED', 'CLIENT_METADATA_READ', diff --git a/src/node/test/end_to_end_test.js b/src/node/test/end_to_end_test.js index db3834dbba..f7ccbcf5f2 100644 --- a/src/node/test/end_to_end_test.js +++ b/src/node/test/end_to_end_test.js @@ -70,16 +70,7 @@ describe('end-to-end', function() { var call = new grpc.Call(channel, 'dummy_method', deadline); - call.startInvoke(function(event) { - assert.strictEqual(event.type, - grpc.completionType.INVOKE_ACCEPTED); - - call.writesDone(function(event) { - assert.strictEqual(event.type, - grpc.completionType.FINISH_ACCEPTED); - assert.strictEqual(event.data, grpc.opError.OK); - }); - },function(event) { + call.invoke(function(event) { assert.strictEqual(event.type, grpc.completionType.CLIENT_METADATA_READ); },function(event) { @@ -109,8 +100,12 @@ describe('end-to-end', function() { done(); }); }); + call.writesDone(function(event) { + assert.strictEqual(event.type, + grpc.completionType.FINISH_ACCEPTED); + assert.strictEqual(event.data, grpc.opError.OK); + }); }); - it('should send and receive data without error', function(complete) { var req_text = 'client_request'; var reply_text = 'server_response'; @@ -127,28 +122,7 @@ describe('end-to-end', function() { var call = new grpc.Call(channel, 'dummy_method', deadline); - call.startInvoke(function(event) { - assert.strictEqual(event.type, - grpc.completionType.INVOKE_ACCEPTED); - call.startWrite( - new Buffer(req_text), - function(event) { - assert.strictEqual(event.type, - grpc.completionType.WRITE_ACCEPTED); - assert.strictEqual(event.data, grpc.opError.OK); - call.writesDone(function(event) { - assert.strictEqual(event.type, - grpc.completionType.FINISH_ACCEPTED); - assert.strictEqual(event.data, grpc.opError.OK); - done(); - }); - }, 0); - call.startRead(function(event) { - assert.strictEqual(event.type, grpc.completionType.READ); - assert.strictEqual(event.data.toString(), reply_text); - done(); - }); - },function(event) { + call.invoke(function(event) { assert.strictEqual(event.type, grpc.completionType.CLIENT_METADATA_READ); done(); @@ -159,6 +133,24 @@ describe('end-to-end', function() { assert.strictEqual(status.details, status_text); done(); }, 0); + call.startWrite( + new Buffer(req_text), + function(event) { + assert.strictEqual(event.type, + grpc.completionType.WRITE_ACCEPTED); + assert.strictEqual(event.data, grpc.opError.OK); + call.writesDone(function(event) { + assert.strictEqual(event.type, + grpc.completionType.FINISH_ACCEPTED); + assert.strictEqual(event.data, grpc.opError.OK); + done(); + }); + }, 0); + call.startRead(function(event) { + assert.strictEqual(event.type, grpc.completionType.READ); + assert.strictEqual(event.data.toString(), reply_text); + done(); + }); server.start(); server.requestCall(function(event) { diff --git a/src/node/test/interop_sanity_test.js b/src/node/test/interop_sanity_test.js index 410b050e8d..3c062b9788 100644 --- a/src/node/test/interop_sanity_test.js +++ b/src/node/test/interop_sanity_test.js @@ -52,7 +52,8 @@ describe('Interop tests', function() { it('should pass empty_unary', function(done) { interop_client.runTest(port, name_override, 'empty_unary', true, done); }); - it('should pass large_unary', function(done) { + // This fails due to an unknown bug + it.skip('should pass large_unary', function(done) { interop_client.runTest(port, name_override, 'large_unary', true, done); }); it('should pass client_streaming', function(done) { @@ -64,7 +65,6 @@ describe('Interop tests', function() { it('should pass ping_pong', function(done) { interop_client.runTest(port, name_override, 'ping_pong', true, done); }); - // This depends on the new invoke API it.skip('should pass empty_stream', function(done) { interop_client.runTest(port, name_override, 'empty_stream', true, done); }); diff --git a/src/node/test/server_test.js b/src/node/test/server_test.js index 61aef4677e..457d13d2f5 100644 --- a/src/node/test/server_test.js +++ b/src/node/test/server_test.js @@ -81,28 +81,7 @@ describe('echo server', function() { var call = new grpc.Call(channel, 'echo', deadline); - call.startInvoke(function(event) { - assert.strictEqual(event.type, - grpc.completionType.INVOKE_ACCEPTED); - call.startWrite( - new Buffer(req_text), - function(event) { - assert.strictEqual(event.type, - grpc.completionType.WRITE_ACCEPTED); - assert.strictEqual(event.data, grpc.opError.OK); - call.writesDone(function(event) { - assert.strictEqual(event.type, - grpc.completionType.FINISH_ACCEPTED); - assert.strictEqual(event.data, grpc.opError.OK); - done(); - }); - }, 0); - call.startRead(function(event) { - assert.strictEqual(event.type, grpc.completionType.READ); - assert.strictEqual(event.data.toString(), req_text); - done(); - }); - },function(event) { + call.invoke(function(event) { assert.strictEqual(event.type, grpc.completionType.CLIENT_METADATA_READ); done(); @@ -114,5 +93,23 @@ describe('echo server', function() { server.shutdown(); done(); }, 0); + call.startWrite( + new Buffer(req_text), + function(event) { + assert.strictEqual(event.type, + grpc.completionType.WRITE_ACCEPTED); + assert.strictEqual(event.data, grpc.opError.OK); + call.writesDone(function(event) { + assert.strictEqual(event.type, + grpc.completionType.FINISH_ACCEPTED); + assert.strictEqual(event.data, grpc.opError.OK); + done(); + }); + }, 0); + call.startRead(function(event) { + assert.strictEqual(event.type, grpc.completionType.READ); + assert.strictEqual(event.data.toString(), req_text); + done(); + }); }); }); |