From 7a472d5c326fb74f54df0bb38425c30e414cf9ae Mon Sep 17 00:00:00 2001 From: Chase Engelbrecht Date: Thu, 17 Aug 2023 13:46:23 -0500 Subject: [PATCH] Fix unit tests Signed-off-by: Chase Engelbrecht --- .../dataprepper/plugins/sink/s3/S3SinkService.java | 2 +- .../plugins/sink/s3/S3SinkServiceTest.java | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/data-prepper-plugins/s3-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/s3/S3SinkService.java b/data-prepper-plugins/s3-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/s3/S3SinkService.java index 3cce52b1e2..ce556283fb 100644 --- a/data-prepper-plugins/s3-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/s3/S3SinkService.java +++ b/data-prepper-plugins/s3-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/s3/S3SinkService.java @@ -187,7 +187,7 @@ protected boolean retryFlushToS3(final Buffer currentBuffer, final String s3Key) } catch (AwsServiceException | SdkClientException e) { LOG.error("Exception occurred while uploading records to s3 bucket. Retry countdown : {} | exception:", retryCount, e); - LOG.info("Error Massage {}", e.getMessage()); + LOG.info("Error Message {}", e.getMessage()); --retryCount; if (retryCount == 0) { return isUploadedToS3; diff --git a/data-prepper-plugins/s3-sink/src/test/java/org/opensearch/dataprepper/plugins/sink/s3/S3SinkServiceTest.java b/data-prepper-plugins/s3-sink/src/test/java/org/opensearch/dataprepper/plugins/sink/s3/S3SinkServiceTest.java index 61404af8a1..c8427fd784 100644 --- a/data-prepper-plugins/s3-sink/src/test/java/org/opensearch/dataprepper/plugins/sink/s3/S3SinkServiceTest.java +++ b/data-prepper-plugins/s3-sink/src/test/java/org/opensearch/dataprepper/plugins/sink/s3/S3SinkServiceTest.java @@ -193,7 +193,7 @@ void test_output_with_threshold_set_as_more_then_zero_event_count() throws IOExc S3SinkService s3SinkService = createObjectUnderTest(); assertNotNull(s3SinkService); s3SinkService.output(generateRandomStringEventRecord()); - verify(snapshotSuccessCounter, times(50)).increment(); + verify(snapshotSuccessCounter, times(51)).increment(); } @@ -216,7 +216,7 @@ void test_output_with_threshold_set_as_zero_event_count() throws IOException { S3SinkService s3SinkService = createObjectUnderTest(); assertNotNull(s3SinkService); s3SinkService.output(generateRandomStringEventRecord()); - verify(snapshotSuccessCounter, times(50)).increment(); + verify(snapshotSuccessCounter, times(51)).increment(); } @Test @@ -235,7 +235,7 @@ void test_output_with_uploadedToS3_success() throws IOException { assertNotNull(s3SinkService); assertThat(s3SinkService, instanceOf(S3SinkService.class)); s3SinkService.output(generateRandomStringEventRecord()); - verify(snapshotSuccessCounter, times(50)).increment(); + verify(snapshotSuccessCounter, times(51)).increment(); } @Test @@ -254,7 +254,7 @@ void test_output_with_uploadedToS3_success_records_byte_count() throws IOExcepti final S3SinkService s3SinkService = createObjectUnderTest(); s3SinkService.output(generateRandomStringEventRecord()); - verify(s3ObjectSizeSummary, times(50)).record(objectSize); + verify(s3ObjectSizeSummary, times(51)).record(objectSize); } @Test @@ -280,7 +280,7 @@ void test_output_with_uploadedToS3_midBatch_generatesNewOutputStream() throws IO s3SinkService.output(generateEventRecords(2)); - verify(snapshotSuccessCounter, times(2)).increment(); + verify(snapshotSuccessCounter, times(3)).increment(); verify(codec).writeEvent(any(), eq(outputStream1)); verify(codec).writeEvent(any(), eq(outputStream2)); } @@ -318,7 +318,7 @@ void test_output_with_uploadedToS3_failure_does_not_record_byte_count() throws I s3SinkService.output(Collections.singletonList(new Record<>(event))); verify(s3ObjectSizeSummary, never()).record(anyLong()); - verify(buffer, times(3)).flushToS3(any(), anyString(), anyString()); + verify(buffer, times(6)).flushToS3(any(), anyString(), anyString()); } @Test