Skip to content

Commit

Permalink
Add test fixture for gRPC 0.15 (#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
misterpoe authored and matthewloring committed Jun 28, 2016
1 parent 693b6ae commit 6e81d88
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
1 change: 1 addition & 0 deletions test/hooks/fixtures/grpc0.15/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('grpc');
8 changes: 8 additions & 0 deletions test/hooks/fixtures/grpc0.15/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "grpc0.15",
"version": "1.0.0",
"main": "index.js",
"dependencies": {
"grpc": "^0.15.0"
}
}
37 changes: 36 additions & 1 deletion test/hooks/test-trace-grpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ var traceLabels = require('../../lib/trace-labels.js');

var versions = {
grpc013: require('./fixtures/grpc0.13'),
grpc014: require('./fixtures/grpc0.14')
grpc014: require('./fixtures/grpc0.14'),
grpc015: require('./fixtures/grpc0.15')
};
var protoFile = __dirname + '/../fixtures/test-grpc.proto';
var grpcPort = 50051;
Expand Down Expand Up @@ -230,6 +231,40 @@ Object.keys(versions).forEach(function(version) {
stream.end();
});
});
} else {
it('should work for new argument orders (unary)', function(done) {
common.runInTransaction(function(endTransaction) {
client.testUnary({n: 42}, new grpc.Metadata(), {},
function(err, result) {
endTransaction();
assert.ifError(err);
assert.strictEqual(result.n, 42);
var trace = common.getMatchingSpan(grpcPredicate);
assert(trace);
common.assertDurationCorrect();
done();
});
});
});

it('should work for new argument orders (stream)', function(done) {
common.runInTransaction(function(endTransaction) {
var stream = client.testClientStream(new grpc.Metadata(), {},
function(err, result) {
endTransaction();
assert.ifError(err);
assert.strictEqual(result.n, 45);
var trace = common.getMatchingSpan(grpcPredicate);
assert(trace);
common.assertDurationCorrect();
done();
});
for (var i = 0; i < 10; ++i) {
stream.write({n: i});
}
stream.end();
});
});
}
});
});
Expand Down
3 changes: 2 additions & 1 deletion test/standalone/test-grpc-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ agent.logger.debug = function(error) {

var versions = {
grpc013: require('../hooks/fixtures/grpc0.13'),
grpc014: require('../hooks/fixtures/grpc0.14')
grpc014: require('../hooks/fixtures/grpc0.14'),
grpc015: require('../hooks/fixtures/grpc0.15')
};

Object.keys(versions).forEach(function(version) {
Expand Down

0 comments on commit 6e81d88

Please sign in to comment.