From a5680c51db33da9ac49ba8d8823ed2805151a9cf Mon Sep 17 00:00:00 2001 From: Joanne Wang Date: Mon, 5 Aug 2024 11:32:59 -0700 Subject: [PATCH] add sleep Signed-off-by: Joanne Wang --- .../SourceConfigWithoutS3RestApiIT.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/opensearch/securityanalytics/resthandler/SourceConfigWithoutS3RestApiIT.java b/src/test/java/org/opensearch/securityanalytics/resthandler/SourceConfigWithoutS3RestApiIT.java index f00c8e9a8..888bb1ec3 100644 --- a/src/test/java/org/opensearch/securityanalytics/resthandler/SourceConfigWithoutS3RestApiIT.java +++ b/src/test/java/org/opensearch/securityanalytics/resthandler/SourceConfigWithoutS3RestApiIT.java @@ -41,7 +41,7 @@ public class SourceConfigWithoutS3RestApiIT extends SecurityAnalyticsRestTestCase { private static final Logger log = LogManager.getLogger(SourceConfigWithoutS3RestApiIT.class); - public void testCreateIocUploadSourceConfig() throws IOException { + public void testCreateIocUploadSourceConfig() throws IOException, InterruptedException { String feedName = "test_ioc_upload"; String feedFormat = "STIX"; SourceConfigType sourceConfigType = SourceConfigType.IOC_UPLOAD; @@ -147,9 +147,10 @@ public void testCreateIocUploadSourceConfig() throws IOException { iocHits = (List>) respMap.get(ListIOCsActionResponse.HITS_FIELD); assertTrue(iocs.size() < iocHits.size()); + Thread.sleep(10000); } - public void testCreateIocUploadSourceConfigIncorrectIocTypes() throws IOException { + public void testCreateIocUploadSourceConfigIncorrectIocTypes() throws IOException, InterruptedException { // Attempt to create ioc upload source config with no correct ioc types String feedName = "test_ioc_upload"; String feedFormat = "STIX"; @@ -199,6 +200,7 @@ public void testCreateIocUploadSourceConfigIncorrectIocTypes() throws IOExceptio } catch (ResponseException ex) { Assert.assertEquals(RestStatus.BAD_REQUEST, restStatus(ex.getResponse())); } + Thread.sleep(10000); } public void testUpdateIocUploadSourceConfig() throws IOException, InterruptedException { @@ -359,7 +361,7 @@ public void testUpdateIocUploadSourceConfig() throws IOException, InterruptedExc Thread.sleep(10000); } - public void testDeleteIocUploadSourceConfigAndAllIocs() throws IOException { + public void testDeleteIocUploadSourceConfigAndAllIocs() throws IOException, InterruptedException { String feedName = "test_ioc_upload"; String feedFormat = "STIX"; SourceConfigType sourceConfigType = SourceConfigType.IOC_UPLOAD; @@ -438,9 +440,10 @@ public void testDeleteIocUploadSourceConfigAndAllIocs() throws IOException { // ensure all iocs are deleted hits = executeSearch(IOC_ALL_INDEX_PATTERN, request); Assert.assertEquals(0, hits.size()); + Thread.sleep(10000); } - public void testRefreshIocUploadSourceConfigFailure() throws IOException { + public void testRefreshIocUploadSourceConfigFailure() throws IOException, InterruptedException { String feedName = "test_ioc_upload"; String feedFormat = "STIX"; SourceConfigType sourceConfigType = SourceConfigType.IOC_UPLOAD; @@ -511,9 +514,10 @@ public void testRefreshIocUploadSourceConfigFailure() throws IOException { } catch (ResponseException ex) { Assert.assertEquals(RestStatus.BAD_REQUEST, restStatus(ex.getResponse())); } + Thread.sleep(10000); } - public void testSearchIocUploadSourceConfig() throws IOException { + public void testSearchIocUploadSourceConfig() throws IOException, InterruptedException { String feedName = "test_ioc_upload"; String feedFormat = "STIX"; SourceConfigType sourceConfigType = SourceConfigType.IOC_UPLOAD; @@ -584,6 +588,7 @@ public void testSearchIocUploadSourceConfig() throws IOException { // Expected value is 2 - one ioc upload source config and one default source config Assert.assertEquals(2, ((Map) ((Map) respMap.get("hits")).get("total")).get("value")); + Thread.sleep(10000); } }