Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
test: remove check for specific byte size in gRPC tests (#1100)
Browse files Browse the repository at this point in the history
This check is prone to flaking with upgrades of `object-sizeof` package as well as being different across different versions of node. I think simply checking that the size was not zero is sufficient and avoids making the test too specific.
  • Loading branch information
aabmass committed Mar 29, 2023
1 parent 7248899 commit e3fb064
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/opencensus-instrumentation-grpc/test/test-grpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ describe('GrpcPlugin() ', function() {
}
}

function assertStats(testExporter: TestExporter, sentBytes: number) {
function assertStats(testExporter: TestExporter) {
assert.strictEqual(testExporter.registeredViews.length, 12);
assert.strictEqual(testExporter.recordedMeasurements.length, 10);
assert.strictEqual(
Expand Down Expand Up @@ -448,7 +448,7 @@ describe('GrpcPlugin() ', function() {
testExporter.recordedMeasurements[5].measure,
clientStats.GRPC_CLIENT_SENT_BYTES_PER_RPC
);
assert.strictEqual(testExporter.recordedMeasurements[5].value, sentBytes);
assert.ok(testExporter.recordedMeasurements[5].value > 0);
assert.strictEqual(
testExporter.recordedMeasurements[6].measure,
clientStats.GRPC_CLIENT_RECEIVED_BYTES_PER_RPC
Expand Down Expand Up @@ -508,7 +508,7 @@ describe('GrpcPlugin() ', function() {
grpcModule.status.OK
);
if (method.method === grpcClient.unaryMethod) {
assertStats(testExporter, 233);
assertStats(testExporter);
}
assertPropagation(clientRoot, serverRoot);
});
Expand Down Expand Up @@ -545,7 +545,7 @@ describe('GrpcPlugin() ', function() {
grpcModule.status.OK
);
if (method.method === grpcClient.unaryMethod) {
assertStats(testExporter, 294);
assertStats(testExporter);
}
assertPropagation(clientRoot, serverRoot);
assert.deepStrictEqual(globalStats.getCurrentTagContext(), tags);
Expand Down

0 comments on commit e3fb064

Please sign in to comment.