Skip to content

Commit

Permalink
make security-analytics integTest stable
Browse files Browse the repository at this point in the history
  • Loading branch information
sbcd90 committed May 1, 2024
1 parent 26e5cea commit ec1470a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public void getFindingsByMonitorIds(
ActionListener<GetFindingsResponse> listener
) {
BoolQueryBuilder queryBuilder = getBoolQueryBuilder(detectionType, severity, findingIds, startTime, endTime);
log.info("hit here-" + queryBuilder.toString());
org.opensearch.commons.alerting.action.GetFindingsRequest req =
new org.opensearch.commons.alerting.action.GetFindingsRequest(
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.util.HashSet;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.function.Consumer;
import java.util.stream.Collectors;

import org.apache.hc.core5.http.HttpHost;
Expand Down Expand Up @@ -840,6 +841,15 @@ public void testGetFindings_byStartTimeAndEndTime_success() throws IOException {
noOfSigmaRuleMatches = ((List<Map<String, Object>>) ((Map<String, Object>) executeResults.get("input_results")).get("results")).get(0).size();
Assert.assertEquals(1, noOfSigmaRuleMatches);

request = "{\n" +
" \"query\" : {\n" +
" \"match_all\":{\n" +
" }\n" +
" }\n" +
"}";
SearchResponse response1 = executeSearchAndGetResponse(DetectorMonitorConfig.getFindingsIndex(randomDetectorType()), request, true);

Arrays.stream(response1.getHits().getHits()).forEach(documentFields -> logger.info("hit here-" + documentFields.getSourceAsString()));
// Call GetFindings API for second detector by startTime and endTime
params.clear();
params.put("startTime", String.valueOf(startTime2.toEpochMilli()));
Expand Down

0 comments on commit ec1470a

Please sign in to comment.