From d5b5b3593634702f175aef755ef51bdb46469490 Mon Sep 17 00:00:00 2001 From: Jeremy Michael Date: Mon, 27 Jan 2025 11:05:38 -0800 Subject: [PATCH] updated tests Signed-off-by: Jeremy Michael --- .../dataprepper/plugins/source/s3/SqsServiceIT.java | 4 ++-- .../opensearch/dataprepper/plugins/source/s3/SqsWorkerIT.java | 4 ++-- .../opensearch/dataprepper/plugins/source/s3/SqsService.java | 3 --- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/data-prepper-plugins/s3-source/src/integrationTest/java/org/opensearch/dataprepper/plugins/source/s3/SqsServiceIT.java b/data-prepper-plugins/s3-source/src/integrationTest/java/org/opensearch/dataprepper/plugins/source/s3/SqsServiceIT.java index 25cdb2be67..3d1e6343f0 100644 --- a/data-prepper-plugins/s3-source/src/integrationTest/java/org/opensearch/dataprepper/plugins/source/s3/SqsServiceIT.java +++ b/data-prepper-plugins/s3-source/src/integrationTest/java/org/opensearch/dataprepper/plugins/source/s3/SqsServiceIT.java @@ -22,6 +22,7 @@ import org.opensearch.dataprepper.plugins.source.s3.configuration.OnErrorOption; import org.opensearch.dataprepper.plugins.source.s3.configuration.AwsAuthenticationOptions; import org.opensearch.dataprepper.plugins.source.s3.configuration.SqsOptions; +import org.opensearch.dataprepper.plugins.source.sqs.common.SqsBackoff; import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider; import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider; import software.amazon.awssdk.regions.Region; @@ -154,8 +155,7 @@ public void test_sqsService(int numWorkers) throws IOException { } private void clearSqsQueue() { - Backoff backoff = Backoff.exponential(SqsService.INITIAL_DELAY, SqsService.MAXIMUM_DELAY).withJitter(SqsService.JITTER_RATE) - .withMaxAttempts(Integer.MAX_VALUE); + Backoff backoff = SqsBackoff.createExponentialBackoff(); final SqsWorker sqsWorker = new SqsWorker(acknowledgementSetManager, sqsClient, s3Service, s3SourceConfig, pluginMetrics, backoff); //final SqsService objectUnderTest = createObjectUnderTest(); int sqsMessagesProcessed; diff --git a/data-prepper-plugins/s3-source/src/integrationTest/java/org/opensearch/dataprepper/plugins/source/s3/SqsWorkerIT.java b/data-prepper-plugins/s3-source/src/integrationTest/java/org/opensearch/dataprepper/plugins/source/s3/SqsWorkerIT.java index 21475930ec..a74e1b35bb 100644 --- a/data-prepper-plugins/s3-source/src/integrationTest/java/org/opensearch/dataprepper/plugins/source/s3/SqsWorkerIT.java +++ b/data-prepper-plugins/s3-source/src/integrationTest/java/org/opensearch/dataprepper/plugins/source/s3/SqsWorkerIT.java @@ -27,6 +27,7 @@ import org.opensearch.dataprepper.plugins.source.s3.configuration.NotificationSourceOption; import org.opensearch.dataprepper.plugins.source.s3.configuration.OnErrorOption; import org.opensearch.dataprepper.plugins.source.s3.configuration.SqsOptions; +import org.opensearch.dataprepper.plugins.source.sqs.common.SqsBackoff; import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.s3.S3Client; import software.amazon.awssdk.services.sqs.SqsClient; @@ -93,8 +94,7 @@ void setUp() { .region(Region.of(System.getProperty("tests.s3source.region"))) .build(); - backoff = Backoff.exponential(SqsService.INITIAL_DELAY, SqsService.MAXIMUM_DELAY).withJitter(SqsService.JITTER_RATE) - .withMaxAttempts(Integer.MAX_VALUE); + backoff = SqsBackoff.createExponentialBackoff(); s3SourceConfig = mock(S3SourceConfig.class); s3Service = mock(S3Service.class); diff --git a/data-prepper-plugins/s3-source/src/main/java/org/opensearch/dataprepper/plugins/source/s3/SqsService.java b/data-prepper-plugins/s3-source/src/main/java/org/opensearch/dataprepper/plugins/source/s3/SqsService.java index ea3ed1defa..de35592b90 100644 --- a/data-prepper-plugins/s3-source/src/main/java/org/opensearch/dataprepper/plugins/source/s3/SqsService.java +++ b/data-prepper-plugins/s3-source/src/main/java/org/opensearch/dataprepper/plugins/source/s3/SqsService.java @@ -12,13 +12,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider; -import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration; -import software.amazon.awssdk.core.retry.RetryPolicy; import software.amazon.awssdk.services.sqs.SqsClient; import org.opensearch.dataprepper.plugins.source.sqs.common.SqsBackoff; import org.opensearch.dataprepper.plugins.source.sqs.common.SqsClientFactory; -import java.time.Duration; import java.util.List; import java.util.concurrent.TimeUnit; import java.util.concurrent.Executors;