From ff3fd51651fe8605ae6dabd90576af87f89db681 Mon Sep 17 00:00:00 2001 From: RanVaknin <50976344+RanVaknin@users.noreply.github.com> Date: Tue, 14 Jul 2026 14:46:51 -0700 Subject: [PATCH] Fix flakey integ test by adding params --- .../services/cloudwatch/CloudWatchIntegrationTest.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/services/cloudwatch/src/it/java/software/amazon/awssdk/services/cloudwatch/CloudWatchIntegrationTest.java b/services/cloudwatch/src/it/java/software/amazon/awssdk/services/cloudwatch/CloudWatchIntegrationTest.java index 763d820f3f17..de492783d219 100644 --- a/services/cloudwatch/src/it/java/software/amazon/awssdk/services/cloudwatch/CloudWatchIntegrationTest.java +++ b/services/cloudwatch/src/it/java/software/amazon/awssdk/services/cloudwatch/CloudWatchIntegrationTest.java @@ -27,7 +27,6 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import static software.amazon.awssdk.testutils.service.AwsTestBase.isValidSdkServiceException; import java.io.IOException; import java.time.Duration; @@ -42,7 +41,6 @@ import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; import software.amazon.awssdk.core.CompressionConfiguration; import software.amazon.awssdk.core.SdkGlobalTime; -import software.amazon.awssdk.core.exception.SdkServiceException; import software.amazon.awssdk.core.interceptor.SdkInternalExecutionAttribute; import software.amazon.awssdk.core.internal.interceptor.trait.RequestCompression; import software.amazon.awssdk.regions.Region; @@ -368,9 +366,15 @@ private List createTwoNewAlarms(String metricName) { */ @Test public void testExceptionHandling() throws Exception { + Instant endTime = Instant.now(); try { cloudwatch.getMetricStatistics(GetMetricStatisticsRequest.builder() - .namespace("fake-namespace").build()); + .namespace("fake-namespace") + .startTime(endTime.minus(Duration.ofMinutes(5))) + .endTime(endTime) + .period(60) + .statistics(Statistic.AVERAGE) + .build()); fail("Expected an SdkServiceException, but wasn't thrown"); } catch (MissingRequiredParameterException e) { // There is a strong contract on the value of these fields, and they should never change unexpectedly