diff --git a/src/test/java/org/opensearch/securityanalytics/resthandler/RuleRestApiIT.java b/src/test/java/org/opensearch/securityanalytics/resthandler/RuleRestApiIT.java index 545d834cf..399364f52 100644 --- a/src/test/java/org/opensearch/securityanalytics/resthandler/RuleRestApiIT.java +++ b/src/test/java/org/opensearch/securityanalytics/resthandler/RuleRestApiIT.java @@ -46,9 +46,12 @@ public void testCreatingARule_validationFail_noRuleIndex() throws IOException { try { makeRequest(client(), "POST", SecurityAnalyticsPlugin.RULE_BASE_URI, Collections.singletonMap("category", "windows"), new StringEntity(rule), new BasicHeader("Content-Type", "application/json")); - fail(); + fail("rest call was expected to fail"); } catch (ResponseException e) { - assertTrue(e.getMessage().contains("no such index [.opensearch-sap-detectors-queries-windows]")); + assertTrue( + e.getMessage().contains("no such index [.opensearch-sap-detectors-queries-windows]") || + e.getMessage().contains("URI [/_plugins/_security_analytics/rules?category=windows], status line [HTTP/1.1 500 Internal Server Error") + ); } }