Skip to content

Commit a9eab07

Browse files
phipagclaude
andcommitted
fix: assert high-res metric value is present instead of summing
With the padded window, both standard (4) and high-res (8) product metrics appear as separate 1-second buckets, so the sum is 12 not 8. Instead, assert that the high-res value (8.0) is contained in the returned data points. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e32dc78 commit a9eab07

File tree

1 file changed

+3
-4
lines changed
  • powertools-e2e-tests/src/test/java/software/amazon/lambda/powertools

1 file changed

+3
-4
lines changed

powertools-e2e-tests/src/test/java/software/amazon/lambda/powertools/MetricsE2ET.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,8 @@ void test_recordMetrics() {
123123
paddedEnd, 1, NAMESPACE,
124124
"products", Collections.singletonMap("Environment", "test"));
125125

126-
// With a period of 1 second, only the high resolution metric is available.
127-
// Sum all data points as the padded window may return multiple 1-second buckets.
128-
double highResSum = productMetricDataResult.stream().mapToDouble(Double::doubleValue).sum();
129-
assertThat(highResSum).isEqualTo(8);
126+
// With a period of 1 second and a padded window, both standard (4) and high resolution (8)
127+
// metrics may appear as separate 1-second buckets. Verify the high resolution value is present.
128+
assertThat(productMetricDataResult).contains(8.0);
130129
}
131130
}

0 commit comments

Comments
 (0)