Skip to content

Commit

Permalink
Merge pull request opensearch-project#2 from sbcd90/test2.5
Browse files Browse the repository at this point in the history
upgrade security-analytics to 2.5.0
  • Loading branch information
petardz authored Jan 6, 2023
2 parents ccbbd10 + 25dacac commit aee46e8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.opensearch.gradle.test.RestIntegTestTask

buildscript {
ext {
opensearch_version = System.getProperty("opensearch.version", "2.4.0-SNAPSHOT")
opensearch_version = System.getProperty("opensearch.version", "2.5.0-SNAPSHOT")
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
buildVersionQualifier = System.getProperty("build.version_qualifier", "")
version_tokens = opensearch_version.tokenize('-')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.opensearch.cluster.metadata.MappingMetadata;
import org.opensearch.common.collect.ImmutableOpenMap;
import org.opensearch.securityanalytics.action.GetMappingsViewResponse;
import org.opensearch.securityanalytics.util.SecurityAnalyticsException;
import org.opensearch.test.OpenSearchTestCase;

import java.io.IOException;
Expand Down Expand Up @@ -59,7 +60,8 @@ public void onResponse(AcknowledgedResponse acknowledgedResponse) {

@Override
public void onFailure(Exception e) {
assertTrue(e.getMessage().equals("Alias mappings are missing path for alias: [srcport]"));
assertTrue(e instanceof SecurityAnalyticsException);
assertTrue(e.getCause().getMessage().equals("Alias mappings are missing path for alias: [srcport]"));
}
});
}
Expand Down Expand Up @@ -99,7 +101,8 @@ public void onResponse(AcknowledgedResponse acknowledgedResponse) {

@Override
public void onFailure(Exception e) {
assertTrue(e.getMessage().contains("Duplicate field 'srcaddr'"));
assertTrue(e instanceof SecurityAnalyticsException);
assertTrue(e.getCause().getMessage().contains("Duplicate field 'srcaddr'"));
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;

public class MapperUtilsTests extends OpenSearchTestCase {
Expand Down Expand Up @@ -45,7 +46,7 @@ public void testValidateIndexMappingsEmptyMappings() throws IOException {
mappings.put("my_index", mappingMetadata);

IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> MapperUtils.validateIndexMappings("my_index", mappingMetadata, MapperTopicStore.aliasMappings("test123")));
assertTrue(e.getMessage().contains("Index mappings are empty"));
assertTrue(e.getMessage().contains(String.format(Locale.getDefault(), "Mappings for index [%s] are empty", "my_index")));
}

public void testValidateIndexMappingsNoMissing() throws IOException {
Expand Down

0 comments on commit aee46e8

Please sign in to comment.