Skip to content

Commit

Permalink
fixed ITs
Browse files Browse the repository at this point in the history
Signed-off-by: Petar Dzepina <[email protected]>
  • Loading branch information
petardz committed Nov 11, 2022
1 parent ddd849f commit 8abf65a
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,18 @@ public void testCreateMappingSuccess() throws IOException {
" \"partial\":true" +
"}"
);
// request.addParameter("indexName", testIndexName);
// request.addParameter("ruleTopic", "netflow");
Response response = client().performRequest(request);
assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());

// Verify mappings
GetMappingsResponse getMappingsResponse = SecurityAnalyticsClientUtils.executeGetMappingsRequest(testIndexName);
MappingsTraverser mappingsTraverser = new MappingsTraverser(getMappingsResponse.getMappings().iterator().next().value);
// After applying netflow aliases, our index will have 4 alias mappings
List<String> flatProperties = mappingsTraverser.extractFlatNonAliasFields();
assertTrue(flatProperties.contains("source.ip"));
assertTrue(flatProperties.contains("destination.ip"));
assertTrue(flatProperties.contains("source.port"));
assertTrue(flatProperties.contains("destination.port"));
assertFalse(flatProperties.contains("source.ip"));
assertFalse(flatProperties.contains("destination.ip"));
assertFalse(flatProperties.contains("source.port"));
assertFalse(flatProperties.contains("destination.port"));
// Try searching by alias field
String query = "{" +
" \"query\": {" +
Expand Down Expand Up @@ -110,8 +109,8 @@ public void testCreateMappingWithAliasesSuccess() throws IOException {
GetMappingsResponse getMappingsResponse = SecurityAnalyticsClientUtils.executeGetMappingsRequest(testIndexName);
MappingsTraverser mappingsTraverser = new MappingsTraverser(getMappingsResponse.getMappings().iterator().next().value);
List<String> flatProperties = mappingsTraverser.extractFlatNonAliasFields();
assertTrue(flatProperties.contains("source.ip"));
assertTrue(flatProperties.contains("source.port"));
assertFalse(flatProperties.contains("source.ip"));
assertFalse(flatProperties.contains("source.port"));
// Try searching by alias field
String query = "{" +
" \"query\": {" +
Expand Down

0 comments on commit 8abf65a

Please sign in to comment.