From e7bf71e57396cbfbf0e46233259987f3c61765ff Mon Sep 17 00:00:00 2001 From: Ganesh Bombatkar Date: Mon, 3 Feb 2025 19:22:27 +0530 Subject: [PATCH] Added a test request in integration test for ensuring auditlog creation before actual test Signed-off-by: Ganesh Bombatkar --- .../java/org/opensearch/security/InternalAuditLogTest.java | 1 + .../security/auditlog/sink/AbstractInternalOpenSearchSink.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/integrationTest/java/org/opensearch/security/InternalAuditLogTest.java b/src/integrationTest/java/org/opensearch/security/InternalAuditLogTest.java index 617cb5abf0..cfe70222b5 100644 --- a/src/integrationTest/java/org/opensearch/security/InternalAuditLogTest.java +++ b/src/integrationTest/java/org/opensearch/security/InternalAuditLogTest.java @@ -50,6 +50,7 @@ public class InternalAuditLogTest { @Test public void testAuditLogShouldBeGreenInSingleNodeCluster() throws IOException { try (TestRestClient client = cluster.getRestClient(USER_ADMIN)) { + client.get(""); // demo request for insuring audit-log index is created beforehand TestRestClient.HttpResponse indicesResponse = client.get("_cat/indices"); assertThat(indicesResponse.getBody(), containsString("security-auditlog")); diff --git a/src/main/java/org/opensearch/security/auditlog/sink/AbstractInternalOpenSearchSink.java b/src/main/java/org/opensearch/security/auditlog/sink/AbstractInternalOpenSearchSink.java index e410b6b31f..4782486871 100644 --- a/src/main/java/org/opensearch/security/auditlog/sink/AbstractInternalOpenSearchSink.java +++ b/src/main/java/org/opensearch/security/auditlog/sink/AbstractInternalOpenSearchSink.java @@ -76,7 +76,7 @@ public boolean doStore(final AuditMessage msg, String indexName) { try { boolean ok = createIndexIfAbsent(indexName); if (!ok) { - log.error("Server not acknowledge for creation of index {}", indexName); + log.error("Failed to create index {}", indexName); return false; }