Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add some output to help debug flaky test #75

Merged
merged 2 commits into from
Feb 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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