Skip to content

Commit

Permalink
chore(instr-perf-tools): add debugging comments to test asserts (#1961)
Browse files Browse the repository at this point in the history
This is to give more detail if those asserts fail. I suspect the
'val < 1' test is flaky.

Refs: #1960
  • Loading branch information
trentm authored Feb 26, 2024
1 parent 4483a32 commit 7d5cdb0
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,16 @@ describe('nodejs.event_loop.utilization', () => {
const scopeMetrics =
resourceMetrics[resourceMetrics.length - 1].scopeMetrics;
const metrics = scopeMetrics[0].metrics;
assert.strictEqual(metrics.length, 1);
assert.strictEqual(metrics[0].dataPointType, DataPointType.GAUGE);
assert.strictEqual(metrics[0].dataPoints.length, 1);
assert.strictEqual(metrics[0].dataPoints[0].value > 0, true);
assert.strictEqual(metrics[0].dataPoints[0].value < 1, true);
assert.strictEqual(metrics.length, 1, 'one ScopeMetrics');
assert.strictEqual(metrics[0].dataPointType, DataPointType.GAUGE, 'gauge');
assert.strictEqual(metrics[0].dataPoints.length, 1, 'one data point');
const val = metrics[0].dataPoints[0].value;
assert.strictEqual(val > 0, true, `val (${val}) > 0`);
assert.strictEqual(val < 1, true, `val (${val}) < 1`);
assert.strictEqual(
metrics[0].descriptor.name,
'nodejs.event_loop.utilization'
'nodejs.event_loop.utilization',
'descriptor.name'
);
assert.strictEqual(
metrics[0].descriptor.description,
Expand Down

0 comments on commit 7d5cdb0

Please sign in to comment.