Skip to content

Commit

Permalink
disable long support in protobuf.js
Browse files Browse the repository at this point in the history
  • Loading branch information
glasser committed Jun 28, 2019
1 parent fd0efdd commit ec3a614
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
7 changes: 7 additions & 0 deletions packages/apollo-engine-reporting-protobuf/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
const protobuf = require('./protobuf');
const protobufJS = require('protobufjs/minimal');

// Remove Long support. Our uint64s tend to be small (less
// than 104 days).
// https://github.com/protobufjs/protobuf.js/issues/1253
protobufJS.util.Long = undefined;
protobufJS.configure();

// Override the generated protobuf Traces.encode function so that it will look
// for Traces that are already encoded to Buffer as well as unencoded
Expand Down
12 changes: 11 additions & 1 deletion packages/apollo-server-integration-testsuite/src/ApolloServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1966,7 +1966,17 @@ export function testApolloServer<AS extends ApolloServerBase>(
expect(earliestStartOffset).toBeLessThan(Infinity);
expect(latestEndOffset).toBeGreaterThan(-Infinity);
const resolverDuration = latestEndOffset - earliestStartOffset;
expect(resolverDuration).not.toBeGreaterThan(trace.durationNs);
expect(resolverDuration).toBeGreaterThan(0);
expect(trace.durationNs).toBeGreaterThanOrEqual(resolverDuration);

expect(trace.startTime.seconds).toBeLessThanOrEqual(
trace.endTime.seconds,
);
if (trace.startTime.seconds === trace.endTime.seconds) {
expect(trace.startTime.nanos).toBeLessThanOrEqual(
trace.endTime.nanos,
);
}
});
});

Expand Down

0 comments on commit ec3a614

Please sign in to comment.