Skip to content

Commit

Permalink
test: don't make network request in gRPC context test (#970)
Browse files Browse the repository at this point in the history
  • Loading branch information
kjin authored Feb 14, 2019
1 parent 79e26a9 commit 82e4c24
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/test-grpc-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import { describeInterop } from './utils';
// because express can't be re-patched.
var agent = require('../..').start({
projectId: '0',
samplingRate: 0
samplingRate: 0,
ignoreUrls: ['/no-trace']
});

var common = require('./plugins/common'/*.js*/);
Expand All @@ -37,7 +38,9 @@ var client, grpcServer, server;
function makeHttpRequester(callback, expectedReqs) {
var pendingHttpReqs = expectedReqs;
return function() {
http.get('http://www.google.com/', function(httpRes) {
// Make a request to an endpoint that won't create an additional server
// trace.
http.get(`http://localhost:${common.serverPort}/no-trace`, function(httpRes) {
httpRes.on('data', function() {});
httpRes.on('end', function() {
if (--pendingHttpReqs === 0) {
Expand Down Expand Up @@ -71,6 +74,10 @@ describeInterop('grpc', fixture => {
var proto = grpc.load(protoFile).nodetest;
var app = express();

app.get('/no-trace', function(req, res) {
res.sendStatus(200);
});

app.get('/unary', function(req, res) {
var httpRequester = requestAndSendHTTPStatus(res, 1);
client.testUnary({n: 42}, httpRequester);
Expand Down

0 comments on commit 82e4c24

Please sign in to comment.