Skip to content

Commit 7d5cdb0

Browse files
authored
chore(instr-perf-tools): add debugging comments to test asserts (open-telemetry#1961)
This is to give more detail if those asserts fail. I suspect the 'val < 1' test is flaky. Refs: open-telemetry#1960
1 parent 4483a32 commit 7d5cdb0

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

plugins/node/instrumentation-perf-hooks/test/event_loop_utilization.test.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,16 @@ describe('nodejs.event_loop.utilization', () => {
8787
const scopeMetrics =
8888
resourceMetrics[resourceMetrics.length - 1].scopeMetrics;
8989
const metrics = scopeMetrics[0].metrics;
90-
assert.strictEqual(metrics.length, 1);
91-
assert.strictEqual(metrics[0].dataPointType, DataPointType.GAUGE);
92-
assert.strictEqual(metrics[0].dataPoints.length, 1);
93-
assert.strictEqual(metrics[0].dataPoints[0].value > 0, true);
94-
assert.strictEqual(metrics[0].dataPoints[0].value < 1, true);
90+
assert.strictEqual(metrics.length, 1, 'one ScopeMetrics');
91+
assert.strictEqual(metrics[0].dataPointType, DataPointType.GAUGE, 'gauge');
92+
assert.strictEqual(metrics[0].dataPoints.length, 1, 'one data point');
93+
const val = metrics[0].dataPoints[0].value;
94+
assert.strictEqual(val > 0, true, `val (${val}) > 0`);
95+
assert.strictEqual(val < 1, true, `val (${val}) < 1`);
9596
assert.strictEqual(
9697
metrics[0].descriptor.name,
97-
'nodejs.event_loop.utilization'
98+
'nodejs.event_loop.utilization',
99+
'descriptor.name'
98100
);
99101
assert.strictEqual(
100102
metrics[0].descriptor.description,

0 commit comments

Comments
 (0)