Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: don't make network request in gRPC context test #970

Merged
merged 1 commit into from
Feb 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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