From 1dc577ae71c8a1d10710f35f96a7f4547eff0d4a Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Thu, 14 Mar 2024 09:37:03 -0700 Subject: [PATCH] test: clarify [0,1] range for system.cpu.utilization metric test The <=1 should fix flakiness. The <=0 test might make this flaky again. Refs: #73 --- packages/opentelemetry-node/test/host-metrics.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/opentelemetry-node/test/host-metrics.test.js b/packages/opentelemetry-node/test/host-metrics.test.js index d88d377a..fe8cffe4 100644 --- a/packages/opentelemetry-node/test/host-metrics.test.js +++ b/packages/opentelemetry-node/test/host-metrics.test.js @@ -45,11 +45,11 @@ const testFixtures = [ 'data points are present in system.cpu.utilization metric' ); const allInRange = metric.gauge?.dataPoints.every( - (dp) => dp.asDouble < 1 + (dp) => 0 <= dp.asDouble && dp.asDouble <= 1 ); t.ok( allInRange, - '"system.cpu.utilization" data points have a value between 0-1' + '"system.cpu.utilization" data points are in the range [0,1]' ); if (!allInRange) { // Note: extra output to debug flaky test (https://github.com/elastic/elastic-otel-node/issues/73).