Fixed ordering assumptions in server_streaming interop test

This commit is contained in:
murgatroid99 2015-05-22 09:49:06 -07:00
parent 9ecee83d9a
commit 6664d4ad01
2 changed files with 7 additions and 7 deletions

View File

@ -154,13 +154,15 @@ function serverStreaming(client, done) {
arg.response_parameters[resp_index].size);
resp_index += 1;
});
call.on('status', function(status) {
assert.strictEqual(status.code, grpc.status.OK);
call.on('end', function() {
assert.strictEqual(resp_index, 4);
if (done) {
done();
}
});
call.on('status', function(status) {
assert.strictEqual(status.code, grpc.status.OK);
});
}
/**

View File

@ -81,7 +81,7 @@ function _write(chunk, encoding, callback) {
batch[grpc.opType.SEND_MESSAGE] = this.serialize(chunk);
this.call.startBatch(batch, function(err, event) {
if (err) {
// Something has gone wrong. Stop writing by failing to call callback
callback(err);
return;
}
callback();
@ -125,11 +125,9 @@ function _read(size) {
self.finished = true;
return;
}
if (self.finished) {
self.push(null);
return;
}
var data = event.read;
var deserialized = self.deserialize(data);
console.log(deserialized);
if (self.push(self.deserialize(data)) && data !== null) {
var read_batch = {};
read_batch[grpc.opType.RECV_MESSAGE] = true;