From 11c5d8fe519e57f66dca261d539b5abb81164c6b Mon Sep 17 00:00:00 2001 From: Hai Yan Date: Fri, 10 Jan 2025 12:56:23 +0800 Subject: [PATCH] Add sleep time before checking Signed-off-by: Hai Yan --- .../plugins/source/rds/export/DataFileSchedulerTest.java | 3 ++- .../plugins/source/rds/export/ExportSchedulerTest.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/data-prepper-plugins/rds-source/src/test/java/org/opensearch/dataprepper/plugins/source/rds/export/DataFileSchedulerTest.java b/data-prepper-plugins/rds-source/src/test/java/org/opensearch/dataprepper/plugins/source/rds/export/DataFileSchedulerTest.java index 150ad209b2..7f021dd7be 100644 --- a/data-prepper-plugins/rds-source/src/test/java/org/opensearch/dataprepper/plugins/source/rds/export/DataFileSchedulerTest.java +++ b/data-prepper-plugins/rds-source/src/test/java/org/opensearch/dataprepper/plugins/source/rds/export/DataFileSchedulerTest.java @@ -187,12 +187,13 @@ void test_data_file_loader_throws_exception_then_give_up_partition() { } @Test - void test_shutdown() { + void test_shutdown() throws InterruptedException { DataFileScheduler objectUnderTest = createObjectUnderTest(); final ExecutorService executorService = Executors.newSingleThreadExecutor(); executorService.submit(objectUnderTest); objectUnderTest.shutdown(); + Thread.sleep(100); verifyNoMoreInteractions(sourceCoordinator); executorService.shutdownNow(); diff --git a/data-prepper-plugins/rds-source/src/test/java/org/opensearch/dataprepper/plugins/source/rds/export/ExportSchedulerTest.java b/data-prepper-plugins/rds-source/src/test/java/org/opensearch/dataprepper/plugins/source/rds/export/ExportSchedulerTest.java index 43f08ff3fc..780078e490 100644 --- a/data-prepper-plugins/rds-source/src/test/java/org/opensearch/dataprepper/plugins/source/rds/export/ExportSchedulerTest.java +++ b/data-prepper-plugins/rds-source/src/test/java/org/opensearch/dataprepper/plugins/source/rds/export/ExportSchedulerTest.java @@ -262,12 +262,13 @@ void test_given_export_partition_and_null_export_task_id_then_close_partition_wi } @Test - void test_shutDown() { + void test_shutDown() throws InterruptedException { lenient().when(sourceCoordinator.acquireAvailablePartition(ExportPartition.PARTITION_TYPE)).thenReturn(Optional.empty()); final ExecutorService executorService = Executors.newSingleThreadExecutor(); executorService.submit(exportScheduler); exportScheduler.shutdown(); + Thread.sleep(100); verifyNoMoreInteractions(sourceCoordinator, snapshotManager, exportTaskManager, s3Client, exportJobSuccessCounter, exportJobFailureCounter, exportS3ObjectsTotalCounter); executorService.shutdownNow();