From 34d0aeac5eebfdfb80b6fdc3b713b2a55970fc7d Mon Sep 17 00:00:00 2001
From: Lantao Jin <ltjin@amazon.com>
Date: Mon, 2 Feb 2026 11:29:01 +0800
Subject: [PATCH 1/9] Fix the filter of integTestWithSecurity

Signed-off-by: Lantao Jin <ltjin@amazon.com>
---
 integ-test/build.gradle | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/integ-test/build.gradle b/integ-test/build.gradle
index 21a28f2faf8..b5e0d90802b 100644
--- a/integ-test/build.gradle
+++ b/integ-test/build.gradle
@@ -450,8 +450,7 @@ task integTestWithSecurity(type: RestIntegTestTask) {
     // NOTE: this IT config discovers only junit5 (jupiter) tests.
     // https://github.com/opensearch-project/sql/issues/1974
     filter {
-        includeTestsMatching 'org.opensearch.sql.security.CrossClusterSearchIT'
-        includeTestsMatching 'org.opensearch.sql.security.PPLPermissionsIT'
+        includeTestsMatching 'org.opensearch.sql.security.*'
     }
 }
 

From a0be2412dba72cfe4195f40ba75ba662dc9c5119 Mon Sep 17 00:00:00 2001
From: Lantao Jin <ltjin@amazon.com>
Date: Mon, 2 Feb 2026 14:11:46 +0800
Subject: [PATCH 2/9] Fix IT

Signed-off-by: Lantao Jin <ltjin@amazon.com>
---
 .../security/CalciteCrossClusterSearchIT.java    | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java b/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java
index 4ce012b11c0..416ef0e81d3 100644
--- a/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java
+++ b/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java
@@ -88,7 +88,7 @@ public void testCrossClusterFieldsWildcardSuffix() throws IOException {
     JSONObject result =
         executeQuery(String.format("search source=%s | fields *Name", TEST_INDEX_DOG_REMOTE));
     verifyColumn(result, columnName("dog_name"), columnName("holdersName"));
-    verifySchema(result, schema("dog_name", "string"), schema("holdersName", "string"));
+    verifySchema(result, schema("holdersName", "string"));
   }
 
   @Test
@@ -165,7 +165,7 @@ public void testDefaultBinCrossCluster() throws IOException {
                 TEST_INDEX_ACCOUNT_REMOTE));
     verifySchema(result, schema("count()", null, "bigint"), schema("age", null, "string"));
 
-    verifyDataRows(result, rows(451L, "20-30"), rows(504L, "30-40"), rows(45L, "40-50"));
+    verifyDataRows(result, rows(451, "20.0-30.0"), rows(504L, "30.0-40.0"), rows(45L, "40.0-50.0"));
   }
 
   @Test
@@ -218,7 +218,7 @@ public void testRangeBinCrossCluster() throws IOException {
                 TEST_INDEX_ACCOUNT_REMOTE));
     verifySchema(result, schema("count()", null, "bigint"), schema("age", null, "string"));
 
-    verifyDataRows(result, rows(1000L, "0-100"));
+    verifyDataRows(result, rows(451, "20-30"), rows(504L, "30-40"), rows(45L, "40-50"));
   }
 
   @Test
@@ -227,7 +227,7 @@ public void testTimeBinCrossCluster() throws IOException {
     JSONObject result =
         executeQuery(
             REMOTE_CLUSTER
-                + ":opensearch-sql_test_index_time_data"
+                + "source=opensearch-sql_test_index_time_data"
                 + " | bin @timestamp span=1h"
                 + " | fields `@timestamp`, value | sort `@timestamp` | head 3");
     verifySchema(result, schema("@timestamp", null, "timestamp"), schema("value", null, "int"));
@@ -290,7 +290,13 @@ public void testCrossClusterRenameFullWildcard() throws IOException {
         result,
         schema("old_dog_name", "string"),
         schema("old_holdersName", "string"),
-        schema("old_age", "bigint"));
+        schema("old_age", "bigint"),
+        schema("old__id", "bigint"),
+        schema("old__index", "bigint"),
+        schema("old__score", "bigint"),
+        schema("old__maxscore", "bigint"),
+        schema("old__sort", "bigint"),
+        schema("old__routing", "bigint"));
   }
 
   @Test

From 3c52fcfaf9a7f70dda806b0c9f81de206dfa9f39 Mon Sep 17 00:00:00 2001
From: Lantao Jin <ltjin@amazon.com>
Date: Mon, 2 Feb 2026 14:35:47 +0800
Subject: [PATCH 3/9] Fix IT

Signed-off-by: Lantao Jin <ltjin@amazon.com>
---
 .../security/CalciteCrossClusterSearchIT.java | 24 ++++++++++++++-----
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java b/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java
index 416ef0e81d3..e5beb691a33 100644
--- a/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java
+++ b/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java
@@ -8,6 +8,7 @@
 import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_ACCOUNT;
 import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_BANK;
 import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_DOG;
+import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_TIME_DATA;
 import static org.opensearch.sql.util.MatcherUtils.columnName;
 import static org.opensearch.sql.util.MatcherUtils.rows;
 import static org.opensearch.sql.util.MatcherUtils.schema;
@@ -41,6 +42,8 @@ public class CalciteCrossClusterSearchIT extends PPLIntegTestCase {
   private static final String TEST_INDEX_ACCOUNT_REMOTE = REMOTE_CLUSTER + ":" + TEST_INDEX_ACCOUNT;
   private static final String TEST_INDEX_DOG_REMOTE = REMOTE_CLUSTER + ":" + TEST_INDEX_DOG;
   private static final String TEST_INDEX_BANK_REMOTE = REMOTE_CLUSTER + ":" + TEST_INDEX_BANK;
+  private static final String TEST_INDEX_TIME_DATA_REMOTE =
+      REMOTE_CLUSTER + ":" + TEST_INDEX_TIME_DATA;
   private static boolean initialized = false;
 
   @SneakyThrows
@@ -87,7 +90,7 @@ public void testCrossClusterFieldsWildcardPrefix() throws IOException {
   public void testCrossClusterFieldsWildcardSuffix() throws IOException {
     JSONObject result =
         executeQuery(String.format("search source=%s | fields *Name", TEST_INDEX_DOG_REMOTE));
-    verifyColumn(result, columnName("dog_name"), columnName("holdersName"));
+    verifyColumn(result, columnName("holdersName"));
     verifySchema(result, schema("holdersName", "string"));
   }
 
@@ -226,10 +229,10 @@ public void testTimeBinCrossCluster() throws IOException {
     // Time-based binning with span
     JSONObject result =
         executeQuery(
-            REMOTE_CLUSTER
-                + "source=opensearch-sql_test_index_time_data"
-                + " | bin @timestamp span=1h"
-                + " | fields `@timestamp`, value | sort `@timestamp` | head 3");
+            String.format(
+                "source=%s | bin @timestamp span=1h | fields `@timestamp`, value | sort"
+                    + " `@timestamp` | head 3",
+                TEST_INDEX_TIME_DATA_REMOTE));
     verifySchema(result, schema("@timestamp", null, "timestamp"), schema("value", null, "int"));
 
     // With 1-hour spans
@@ -285,7 +288,16 @@ public void testCrossClusterRenameFullWildcard() throws IOException {
     JSONObject result =
         executeQuery(String.format("search source=%s | rename * as old_*", TEST_INDEX_DOG_REMOTE));
     verifyColumn(
-        result, columnName("old_dog_name"), columnName("old_holdersName"), columnName("old_age"));
+        result,
+        columnName("old_dog_name"),
+        columnName("old_holdersName"),
+        columnName("old_age"),
+        columnName("old__id"),
+        columnName("old__index"),
+        columnName("old__score"),
+        columnName("old__maxscore"),
+        columnName("old__sort"),
+        columnName("old__routing"));
     verifySchema(
         result,
         schema("old_dog_name", "string"),

From 31ef1bb1311a7bf9eb7c205973e6edf7d97fb353 Mon Sep 17 00:00:00 2001
From: Lantao Jin <ltjin@amazon.com>
Date: Mon, 2 Feb 2026 15:01:13 +0800
Subject: [PATCH 4/9] refactor

Signed-off-by: Lantao Jin <ltjin@amazon.com>
---
 .../security/CalciteCrossClusterSearchIT.java | 52 +++----------------
 .../sql/security/CrossClusterCoalesceIT.java  | 34 ++----------
 .../sql/security/CrossClusterSearchIT.java    | 40 +-------------
 .../sql/security/CrossClusterTestBase.java    | 52 +++++++++++++++++++
 4 files changed, 65 insertions(+), 113 deletions(-)
 create mode 100644 integ-test/src/test/java/org/opensearch/sql/security/CrossClusterTestBase.java

diff --git a/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java b/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java
index e5beb691a33..9fec0f7c931 100644
--- a/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java
+++ b/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java
@@ -5,10 +5,6 @@
 
 package org.opensearch.sql.security;
 
-import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_ACCOUNT;
-import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_BANK;
-import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_DOG;
-import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_TIME_DATA;
 import static org.opensearch.sql.util.MatcherUtils.columnName;
 import static org.opensearch.sql.util.MatcherUtils.rows;
 import static org.opensearch.sql.util.MatcherUtils.schema;
@@ -17,53 +13,21 @@
 import static org.opensearch.sql.util.MatcherUtils.verifySchema;
 
 import java.io.IOException;
-import lombok.SneakyThrows;
 import org.json.JSONObject;
-import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.opensearch.sql.ppl.PPLIntegTestCase;
 
 /** Cross Cluster Search tests with Calcite enabled for enhanced fields features. */
-public class CalciteCrossClusterSearchIT extends PPLIntegTestCase {
-
-  static {
-    String[] clusterNames = System.getProperty("cluster.names").split(",");
-    var remote = "remoteCluster";
-    for (var cluster : clusterNames) {
-      if (cluster.startsWith("remote")) {
-        remote = cluster;
-        break;
-      }
-    }
-    REMOTE_CLUSTER = remote;
-  }
-
-  public static final String REMOTE_CLUSTER;
-  private static final String TEST_INDEX_ACCOUNT_REMOTE = REMOTE_CLUSTER + ":" + TEST_INDEX_ACCOUNT;
-  private static final String TEST_INDEX_DOG_REMOTE = REMOTE_CLUSTER + ":" + TEST_INDEX_DOG;
-  private static final String TEST_INDEX_BANK_REMOTE = REMOTE_CLUSTER + ":" + TEST_INDEX_BANK;
-  private static final String TEST_INDEX_TIME_DATA_REMOTE =
-      REMOTE_CLUSTER + ":" + TEST_INDEX_TIME_DATA;
-  private static boolean initialized = false;
-
-  @SneakyThrows
-  @BeforeEach
-  public void initialize() {
-    if (!initialized) {
-      setUpIndices();
-      initialized = true;
-    }
-  }
+public class CalciteCrossClusterSearchIT extends CrossClusterSearchIT {
 
   @Override
   protected void init() throws Exception {
+    super.init();
     configureMultiClusters(REMOTE_CLUSTER);
     loadIndex(Index.BANK);
     loadIndex(Index.BANK, remoteClient());
-    loadIndex(Index.ACCOUNT);
-    loadIndex(Index.ACCOUNT, remoteClient());
     loadIndex(Index.DOG);
     loadIndex(Index.DOG, remoteClient());
+    loadIndex(Index.ACCOUNT);
     loadIndex(Index.TIME_TEST_DATA);
     loadIndex(Index.TIME_TEST_DATA, remoteClient());
     enableCalcite();
@@ -303,12 +267,12 @@ public void testCrossClusterRenameFullWildcard() throws IOException {
         schema("old_dog_name", "string"),
         schema("old_holdersName", "string"),
         schema("old_age", "bigint"),
-        schema("old__id", "bigint"),
-        schema("old__index", "bigint"),
-        schema("old__score", "bigint"),
-        schema("old__maxscore", "bigint"),
+        schema("old__id", "string"),
+        schema("old__index", "string"),
+        schema("old__score", "float"),
+        schema("old__maxscore", "float"),
         schema("old__sort", "bigint"),
-        schema("old__routing", "bigint"));
+        schema("old__routing", "string"));
   }
 
   @Test
diff --git a/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterCoalesceIT.java b/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterCoalesceIT.java
index 530dccd5287..dfe62bd3d55 100644
--- a/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterCoalesceIT.java
+++ b/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterCoalesceIT.java
@@ -5,50 +5,22 @@
 
 package org.opensearch.sql.security;
 
-import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_DOG;
 import static org.opensearch.sql.util.MatcherUtils.columnName;
 import static org.opensearch.sql.util.MatcherUtils.verifyColumn;
 
 import java.io.IOException;
-import lombok.SneakyThrows;
 import org.json.JSONObject;
-import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.opensearch.sql.ppl.PPLIntegTestCase;
 
-public class CrossClusterCoalesceIT extends PPLIntegTestCase {
-
-  static {
-    String[] clusterNames = System.getProperty("cluster.names").split(",");
-    var remote = "remoteCluster";
-    for (var cluster : clusterNames) {
-      if (cluster.startsWith("remote")) {
-        remote = cluster;
-        break;
-      }
-    }
-    REMOTE_CLUSTER = remote;
-  }
-
-  public static final String REMOTE_CLUSTER;
-  private static final String TEST_INDEX_DOG_REMOTE = REMOTE_CLUSTER + ":" + TEST_INDEX_DOG;
-  private static boolean initialized = false;
-
-  @SneakyThrows
-  @BeforeEach
-  public void initialize() {
-    if (!initialized) {
-      setUpIndices();
-      initialized = true;
-    }
-  }
+public class CrossClusterCoalesceIT extends CrossClusterTestBase {
 
   @Override
   protected void init() throws Exception {
-    enableCalcite();
+    super.init();
     configureMultiClusters(REMOTE_CLUSTER);
     loadIndex(Index.DOG);
     loadIndex(Index.DOG, remoteClient());
+    enableCalcite();
   }
 
   @Test
diff --git a/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterSearchIT.java b/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterSearchIT.java
index af1c08e8611..ac88b8194f0 100644
--- a/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterSearchIT.java
+++ b/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterSearchIT.java
@@ -5,59 +5,23 @@
 
 package org.opensearch.sql.security;
 
-import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_ACCOUNT;
 import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_BANK;
-import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_DOG;
 import static org.opensearch.sql.util.MatcherUtils.columnName;
 import static org.opensearch.sql.util.MatcherUtils.rows;
 import static org.opensearch.sql.util.MatcherUtils.verifyColumn;
 import static org.opensearch.sql.util.MatcherUtils.verifyDataRows;
 
 import java.io.IOException;
-import lombok.SneakyThrows;
 import org.json.JSONObject;
-import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.opensearch.client.ResponseException;
-import org.opensearch.sql.ppl.PPLIntegTestCase;
 
 /** Cross Cluster Search tests to be executed with security plugin. */
-public class CrossClusterSearchIT extends PPLIntegTestCase {
-
-  static {
-    // find a remote cluster
-    String[] clusterNames = System.getProperty("cluster.names").split(",");
-    var remote = "remoteCluster";
-    for (var cluster : clusterNames) {
-      if (cluster.startsWith("remote")) {
-        remote = cluster;
-        break;
-      }
-    }
-    REMOTE_CLUSTER = remote;
-  }
-
-  public static final String REMOTE_CLUSTER;
-
-  private static final String TEST_INDEX_BANK_REMOTE = REMOTE_CLUSTER + ":" + TEST_INDEX_BANK;
-  private static final String TEST_INDEX_DOG_REMOTE = REMOTE_CLUSTER + ":" + TEST_INDEX_DOG;
-  private static final String TEST_INDEX_DOG_MATCH_ALL_REMOTE =
-      MATCH_ALL_REMOTE_CLUSTER + ":" + TEST_INDEX_DOG;
-  private static final String TEST_INDEX_ACCOUNT_REMOTE = REMOTE_CLUSTER + ":" + TEST_INDEX_ACCOUNT;
-
-  private static boolean initialized = false;
-
-  @SneakyThrows
-  @BeforeEach
-  public void initialize() {
-    if (!initialized) {
-      setUpIndices();
-      initialized = true;
-    }
-  }
+public class CrossClusterSearchIT extends CrossClusterTestBase {
 
   @Override
   protected void init() throws Exception {
+    super.init();
     configureMultiClusters(REMOTE_CLUSTER);
     loadIndex(Index.BANK);
     loadIndex(Index.BANK, remoteClient());
diff --git a/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterTestBase.java b/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterTestBase.java
new file mode 100644
index 00000000000..c8d00d85d2b
--- /dev/null
+++ b/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterTestBase.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright OpenSearch Contributors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+package org.opensearch.sql.security;
+
+import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_ACCOUNT;
+import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_BANK;
+import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_DOG;
+import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_TIME_DATA;
+
+import lombok.SneakyThrows;
+import org.junit.jupiter.api.BeforeEach;
+import org.opensearch.sql.ppl.PPLIntegTestCase;
+
+public class CrossClusterTestBase extends PPLIntegTestCase {
+  static {
+    // find a remote cluster
+    String[] clusterNames = System.getProperty("cluster.names").split(",");
+    var remote = "remoteCluster";
+    for (var cluster : clusterNames) {
+      if (cluster.startsWith("remote")) {
+        remote = cluster;
+        break;
+      }
+    }
+    REMOTE_CLUSTER = remote;
+  }
+
+  public static final String REMOTE_CLUSTER;
+
+  protected static final String TEST_INDEX_BANK_REMOTE = REMOTE_CLUSTER + ":" + TEST_INDEX_BANK;
+  protected static final String TEST_INDEX_DOG_REMOTE = REMOTE_CLUSTER + ":" + TEST_INDEX_DOG;
+  protected static final String TEST_INDEX_DOG_MATCH_ALL_REMOTE =
+      MATCH_ALL_REMOTE_CLUSTER + ":" + TEST_INDEX_DOG;
+  protected static final String TEST_INDEX_ACCOUNT_REMOTE =
+      REMOTE_CLUSTER + ":" + TEST_INDEX_ACCOUNT;
+  protected static final String TEST_INDEX_TIME_DATA_REMOTE =
+      REMOTE_CLUSTER + ":" + TEST_INDEX_TIME_DATA;
+
+  protected static boolean initialized = false;
+
+  @SneakyThrows
+  @BeforeEach
+  public void initialize() {
+    if (!initialized) {
+      setUpIndices();
+      initialized = true;
+    }
+  }
+}

From 152f0397f63fd32c2ecb25ee12ad6d496102a75d Mon Sep 17 00:00:00 2001
From: Lantao Jin <ltjin@amazon.com>
Date: Mon, 2 Feb 2026 15:15:58 +0800
Subject: [PATCH 5/9] fix IT

Signed-off-by: Lantao Jin <ltjin@amazon.com>
---
 .../sql/security/CalciteCrossClusterSearchIT.java   |  3 ++-
 .../sql/security/CrossClusterTestBase.java          | 13 -------------
 2 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java b/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java
index 9fec0f7c931..c3002a75eab 100644
--- a/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java
+++ b/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java
@@ -17,7 +17,7 @@
 import org.junit.jupiter.api.Test;
 
 /** Cross Cluster Search tests with Calcite enabled for enhanced fields features. */
-public class CalciteCrossClusterSearchIT extends CrossClusterSearchIT {
+public class CalciteCrossClusterSearchIT extends CrossClusterTestBase {
 
   @Override
   protected void init() throws Exception {
@@ -28,6 +28,7 @@ protected void init() throws Exception {
     loadIndex(Index.DOG);
     loadIndex(Index.DOG, remoteClient());
     loadIndex(Index.ACCOUNT);
+    loadIndex(Index.ACCOUNT, remoteClient());
     loadIndex(Index.TIME_TEST_DATA);
     loadIndex(Index.TIME_TEST_DATA, remoteClient());
     enableCalcite();
diff --git a/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterTestBase.java b/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterTestBase.java
index c8d00d85d2b..0bef5225874 100644
--- a/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterTestBase.java
+++ b/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterTestBase.java
@@ -10,8 +10,6 @@
 import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_DOG;
 import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_TIME_DATA;
 
-import lombok.SneakyThrows;
-import org.junit.jupiter.api.BeforeEach;
 import org.opensearch.sql.ppl.PPLIntegTestCase;
 
 public class CrossClusterTestBase extends PPLIntegTestCase {
@@ -38,15 +36,4 @@ public class CrossClusterTestBase extends PPLIntegTestCase {
       REMOTE_CLUSTER + ":" + TEST_INDEX_ACCOUNT;
   protected static final String TEST_INDEX_TIME_DATA_REMOTE =
       REMOTE_CLUSTER + ":" + TEST_INDEX_TIME_DATA;
-
-  protected static boolean initialized = false;
-
-  @SneakyThrows
-  @BeforeEach
-  public void initialize() {
-    if (!initialized) {
-      setUpIndices();
-      initialized = true;
-    }
-  }
 }

From b14e150ab1188f35ed5b4675a85ae19b5cb0e20c Mon Sep 17 00:00:00 2001
From: Lantao Jin <ltjin@amazon.com>
Date: Mon, 2 Feb 2026 15:44:41 +0800
Subject: [PATCH 6/9] Use Junit4

Signed-off-by: Lantao Jin <ltjin@amazon.com>
---
 .../sql/security/CalciteCrossClusterSearchIT.java           | 1 -
 .../org/opensearch/sql/security/CrossClusterCoalesceIT.java | 3 +--
 .../org/opensearch/sql/security/CrossClusterSearchIT.java   | 1 -
 .../org/opensearch/sql/security/CrossClusterTestBase.java   | 6 ++++++
 4 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java b/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java
index c3002a75eab..757df97cb6f 100644
--- a/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java
+++ b/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java
@@ -22,7 +22,6 @@ public class CalciteCrossClusterSearchIT extends CrossClusterTestBase {
   @Override
   protected void init() throws Exception {
     super.init();
-    configureMultiClusters(REMOTE_CLUSTER);
     loadIndex(Index.BANK);
     loadIndex(Index.BANK, remoteClient());
     loadIndex(Index.DOG);
diff --git a/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterCoalesceIT.java b/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterCoalesceIT.java
index dfe62bd3d55..74d6be236dc 100644
--- a/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterCoalesceIT.java
+++ b/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterCoalesceIT.java
@@ -10,14 +10,13 @@
 
 import java.io.IOException;
 import org.json.JSONObject;
-import org.junit.jupiter.api.Test;
+import org.junit.Test;
 
 public class CrossClusterCoalesceIT extends CrossClusterTestBase {
 
   @Override
   protected void init() throws Exception {
     super.init();
-    configureMultiClusters(REMOTE_CLUSTER);
     loadIndex(Index.DOG);
     loadIndex(Index.DOG, remoteClient());
     enableCalcite();
diff --git a/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterSearchIT.java b/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterSearchIT.java
index ac88b8194f0..1b4c2d6cbce 100644
--- a/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterSearchIT.java
+++ b/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterSearchIT.java
@@ -22,7 +22,6 @@ public class CrossClusterSearchIT extends CrossClusterTestBase {
   @Override
   protected void init() throws Exception {
     super.init();
-    configureMultiClusters(REMOTE_CLUSTER);
     loadIndex(Index.BANK);
     loadIndex(Index.BANK, remoteClient());
     loadIndex(Index.DOG);
diff --git a/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterTestBase.java b/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterTestBase.java
index 0bef5225874..d9de95c663b 100644
--- a/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterTestBase.java
+++ b/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterTestBase.java
@@ -36,4 +36,10 @@ public class CrossClusterTestBase extends PPLIntegTestCase {
       REMOTE_CLUSTER + ":" + TEST_INDEX_ACCOUNT;
   protected static final String TEST_INDEX_TIME_DATA_REMOTE =
       REMOTE_CLUSTER + ":" + TEST_INDEX_TIME_DATA;
+
+  @Override
+  protected void init() throws Exception {
+    super.init();
+    configureMultiClusters(REMOTE_CLUSTER);
+  }
 }

From e3c0440cf6d14dc9d4fea412996da0d08467cdef Mon Sep 17 00:00:00 2001
From: Lantao Jin <ltjin@amazon.com>
Date: Mon, 2 Feb 2026 17:11:31 +0800
Subject: [PATCH 7/9] fix

Signed-off-by: Lantao Jin <ltjin@amazon.com>
---
 integ-test/build.gradle                                        | 3 ---
 .../opensearch/sql/security/CalciteCrossClusterSearchIT.java   | 2 +-
 .../java/org/opensearch/sql/security/CrossClusterSearchIT.java | 2 +-
 3 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/integ-test/build.gradle b/integ-test/build.gradle
index b5e0d90802b..b914cb0cbe0 100644
--- a/integ-test/build.gradle
+++ b/integ-test/build.gradle
@@ -406,7 +406,6 @@ task integTestWithSecurity(type: RestIntegTestTask) {
         configureSecurityPlugin(cluster)
     }
 
-    useJUnitPlatform()
     dependsOn ':opensearch-sql-plugin:bundlePlugin'
     testLogging {
         events "passed", "skipped", "failed"
@@ -447,8 +446,6 @@ task integTestWithSecurity(type: RestIntegTestTask) {
         jvmArgs '-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005'
     }
 
-    // NOTE: this IT config discovers only junit5 (jupiter) tests.
-    // https://github.com/opensearch-project/sql/issues/1974
     filter {
         includeTestsMatching 'org.opensearch.sql.security.*'
     }
diff --git a/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java b/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java
index 757df97cb6f..b89574a4fd8 100644
--- a/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java
+++ b/integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java
@@ -14,7 +14,7 @@
 
 import java.io.IOException;
 import org.json.JSONObject;
-import org.junit.jupiter.api.Test;
+import org.junit.Test;
 
 /** Cross Cluster Search tests with Calcite enabled for enhanced fields features. */
 public class CalciteCrossClusterSearchIT extends CrossClusterTestBase {
diff --git a/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterSearchIT.java b/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterSearchIT.java
index 1b4c2d6cbce..abdbb616e2c 100644
--- a/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterSearchIT.java
+++ b/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterSearchIT.java
@@ -13,7 +13,7 @@
 
 import java.io.IOException;
 import org.json.JSONObject;
-import org.junit.jupiter.api.Test;
+import org.junit.Test;
 import org.opensearch.client.ResponseException;
 
 /** Cross Cluster Search tests to be executed with security plugin. */

From eb49a1a90ec99d1e3fe4ca6c3e001b236336638a Mon Sep 17 00:00:00 2001
From: Lantao Jin <ltjin@amazon.com>
Date: Mon, 2 Feb 2026 17:48:32 +0800
Subject: [PATCH 8/9] fix httpclient leaking

Signed-off-by: Lantao Jin <ltjin@amazon.com>
---
 .../org/opensearch/sql/legacy/OpenSearchSQLRestTestCase.java  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/integ-test/src/test/java/org/opensearch/sql/legacy/OpenSearchSQLRestTestCase.java b/integ-test/src/test/java/org/opensearch/sql/legacy/OpenSearchSQLRestTestCase.java
index 91cf5dc943c..91584fb45cf 100644
--- a/integ-test/src/test/java/org/opensearch/sql/legacy/OpenSearchSQLRestTestCase.java
+++ b/integ-test/src/test/java/org/opensearch/sql/legacy/OpenSearchSQLRestTestCase.java
@@ -311,7 +311,9 @@ protected static void configureHttpsClient(
    * cluster.
    */
   public void configureMultiClusters(String remote) throws IOException {
-    initRemoteClient(remote);
+    if (remoteClient == null) {
+      initRemoteClient(remote);
+    }
 
     Request connectionRequest = new Request("PUT", "_cluster/settings");
     String connectionSetting =

From 145ae5dc5d7c54670f2cefc87ced9ffa692eb2ad Mon Sep 17 00:00:00 2001
From: Lantao Jin <ltjin@amazon.com>
Date: Mon, 2 Feb 2026 18:06:47 +0800
Subject: [PATCH 9/9] Fix permission IT in Junit4

Signed-off-by: Lantao Jin <ltjin@amazon.com>
---
 .../sql/security/PPLPermissionsIT.java        | 46 ++++++++-----------
 1 file changed, 19 insertions(+), 27 deletions(-)

diff --git a/integ-test/src/test/java/org/opensearch/sql/security/PPLPermissionsIT.java b/integ-test/src/test/java/org/opensearch/sql/security/PPLPermissionsIT.java
index 4664491b686..d84ca2af1b3 100644
--- a/integ-test/src/test/java/org/opensearch/sql/security/PPLPermissionsIT.java
+++ b/integ-test/src/test/java/org/opensearch/sql/security/PPLPermissionsIT.java
@@ -14,10 +14,8 @@
 
 import java.io.IOException;
 import java.util.Locale;
-import lombok.SneakyThrows;
 import org.json.JSONObject;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
+import org.junit.Test;
 import org.opensearch.client.Request;
 import org.opensearch.client.RequestOptions;
 import org.opensearch.client.Response;
@@ -59,21 +57,12 @@ public class PPLPermissionsIT extends PPLIntegTestCase {
   private static final String NO_PIT_USER = "no_pit_user";
   private static final String NO_PIT_ROLE = "no_pit_role";
 
-  private static boolean initialized = false;
-
-  @SneakyThrows
-  @BeforeEach
-  public void initialize() {
-    if (!initialized) {
-      setUpIndices();
-      createSecurityRolesAndUsers();
-      initialized = true;
-    }
-  }
+  private boolean initialized = false;
 
   @Override
   protected void init() throws Exception {
     super.init();
+    createSecurityRolesAndUsers();
     loadIndex(Index.BANK);
     loadIndex(Index.DOG);
     // Enable Calcite engine to test PIT behavior with Calcite
@@ -87,24 +76,27 @@ protected void init() throws Exception {
    * access to their specific index.
    */
   private void createSecurityRolesAndUsers() throws IOException {
-    // Create role for bank index access
-    createRole(BANK_ROLE, TEST_INDEX_BANK);
+    if (!initialized) {
+      // Create role for bank index access
+      createRole(BANK_ROLE, TEST_INDEX_BANK);
 
-    // Create role for dog index access
-    createRole(DOG_ROLE, TEST_INDEX_DOG);
+      // Create role for dog index access
+      createRole(DOG_ROLE, TEST_INDEX_DOG);
 
-    // Create users and map them to roles
-    createUser(BANK_USER, BANK_ROLE);
-    createUser(DOG_USER, DOG_ROLE);
+      // Create users and map them to roles
+      createUser(BANK_USER, BANK_ROLE);
+      createUser(DOG_USER, DOG_ROLE);
 
-    // Create roles for testing missing permissions
-    createRoleWithMissingPermissions();
+      // Create roles for testing missing permissions
+      createRoleWithMissingPermissions();
 
-    // Create user with minimal permissions for plugin-based PIT testing
-    createMinimalUserForPitTesting();
+      // Create user with minimal permissions for plugin-based PIT testing
+      createMinimalUserForPitTesting();
 
-    // Create user without PIT permissions to test PIT requirement
-    createNoPitUserForTesting();
+      // Create user without PIT permissions to test PIT requirement
+      createNoPitUserForTesting();
+      initialized = true;
+    }
   }
 
   private void createRole(String roleName, String indexPattern) throws IOException {
