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

Commit e3fb064

Browse files
authored
test: remove check for specific byte size in gRPC tests (#1100)
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.
1 parent 7248899 commit e3fb064

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/opencensus-instrumentation-grpc/test/test-grpc.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ describe('GrpcPlugin() ', function() {
418418
}
419419
}
420420

421-
function assertStats(testExporter: TestExporter, sentBytes: number) {
421+
function assertStats(testExporter: TestExporter) {
422422
assert.strictEqual(testExporter.registeredViews.length, 12);
423423
assert.strictEqual(testExporter.recordedMeasurements.length, 10);
424424
assert.strictEqual(
@@ -448,7 +448,7 @@ describe('GrpcPlugin() ', function() {
448448
testExporter.recordedMeasurements[5].measure,
449449
clientStats.GRPC_CLIENT_SENT_BYTES_PER_RPC
450450
);
451-
assert.strictEqual(testExporter.recordedMeasurements[5].value, sentBytes);
451+
assert.ok(testExporter.recordedMeasurements[5].value > 0);
452452
assert.strictEqual(
453453
testExporter.recordedMeasurements[6].measure,
454454
clientStats.GRPC_CLIENT_RECEIVED_BYTES_PER_RPC
@@ -508,7 +508,7 @@ describe('GrpcPlugin() ', function() {
508508
grpcModule.status.OK
509509
);
510510
if (method.method === grpcClient.unaryMethod) {
511-
assertStats(testExporter, 233);
511+
assertStats(testExporter);
512512
}
513513
assertPropagation(clientRoot, serverRoot);
514514
});
@@ -545,7 +545,7 @@ describe('GrpcPlugin() ', function() {
545545
grpcModule.status.OK
546546
);
547547
if (method.method === grpcClient.unaryMethod) {
548-
assertStats(testExporter, 294);
548+
assertStats(testExporter);
549549
}
550550
assertPropagation(clientRoot, serverRoot);
551551
assert.deepStrictEqual(globalStats.getCurrentTagContext(), tags);

0 commit comments

Comments
 (0)