Skip to content

Commit

Permalink
add sleep
Browse files Browse the repository at this point in the history
Signed-off-by: Joanne Wang <[email protected]>
  • Loading branch information
jowg-amazon committed Aug 5, 2024
1 parent bd8f0c4 commit a5680c5
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -147,9 +147,10 @@ public void testCreateIocUploadSourceConfig() throws IOException {

iocHits = (List<Map<String, Object>>) 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";
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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<String, Object>) ((Map<String, Object>) respMap.get("hits")).get("total")).get("value"));
Thread.sleep(10000);
}

}

0 comments on commit a5680c5

Please sign in to comment.