Skip to content

Commit

Permalink
test: add some output to help debug flaky test (#75)
Browse files Browse the repository at this point in the history
Refs: #73
  • Loading branch information
trentm authored Feb 13, 2024
1 parent 41da745 commit 08d3697
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/opentelemetry-node/test/host-metrics.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,20 @@ const testFixtures = [
metric.gauge,
'data points are present in system.cpu.utilization metric'
);
const allInRange = metric.gauge?.dataPoints.every(
(dp) => dp.asDouble < 1
);
t.ok(
metric.gauge?.dataPoints.every((dp) => dp.asDouble < 1),
allInRange,
'"system.cpu.utilization" data points have a value between 0-1'
);
if (!allInRange) {
// Note: extra output to debug flaky test (https://github.com/elastic/elastic-otel-node/issues/73).
t.comment(
'cpuUtilizationMetrics: ' +
JSON.stringify(cpuUtilizationMetrics)
);
}
t.ok(
metric.gauge?.dataPoints.filter(
(dp) =>
Expand Down

0 comments on commit 08d3697

Please sign in to comment.