From 44c7ed1f1a748d0506e68b147aa95c0541c482cc Mon Sep 17 00:00:00 2001 From: Kai Huang Date: Wed, 3 Jun 2026 22:41:00 -0700 Subject: [PATCH] Skip AnalyticsEngineCompatIT when analytics-engine is absent AnalyticsEngineCompatIT is a coexistence smoke test meant to run only in the dedicated :integ-test:analyticsEngineCompatIT task, which bundles the analytics-engine plugin stack. The distribution integ-test pipeline, however, scans every *IT class against the built distribution and runs it with the security plugin enabled and without analytics-engine. There it fails during REST client init with "ConnectionClosedException: Connection closed by peer", because the test extends a bare OpenSearchRestTestCase that speaks plain HTTP to the TLS-secured port. A build.gradle exclude does not cover that pipeline. Make the test self-inert regardless of how it is discovered: - Extend OpenSearchSQLRestTestCase so the REST client honours the https/user/ password system properties of a secured cluster. - Skip via an assumption when the analytics-engine plugin is not installed, so a build without the plugin reports the test as skipped rather than failed. Signed-off-by: Kai Huang --- .../sql/plugin/AnalyticsEngineCompatIT.java | 44 +++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/integ-test/src/test/java/org/opensearch/sql/plugin/AnalyticsEngineCompatIT.java b/integ-test/src/test/java/org/opensearch/sql/plugin/AnalyticsEngineCompatIT.java index 5cd89fa7cd9..f6ec903c395 100644 --- a/integ-test/src/test/java/org/opensearch/sql/plugin/AnalyticsEngineCompatIT.java +++ b/integ-test/src/test/java/org/opensearch/sql/plugin/AnalyticsEngineCompatIT.java @@ -5,17 +5,55 @@ package org.opensearch.sql.plugin; +import static org.junit.Assume.assumeTrue; + +import java.io.IOException; +import org.junit.Before; import org.junit.Test; -import org.opensearch.test.rest.OpenSearchRestTestCase; +import org.opensearch.client.Request; +import org.opensearch.client.Response; +import org.opensearch.sql.legacy.OpenSearchSQLRestTestCase; +import org.opensearch.sql.legacy.TestUtils; /** * Smoke test: verifies that opensearch-sql loads cleanly alongside arrow-flight-rpc and * analytics-engine. A successful cluster start is the only assertion — no sql-specific logic runs. + * + *

This test is only meaningful when the analytics-engine plugin is installed; the dedicated + * {@code :integ-test:analyticsEngineCompatIT} Gradle task bundles the plugin stack for exactly that + * purpose. Other lanes can still discover this class — notably the distribution integ-test + * pipeline, which scans every {@code *IT} class against the built distribution and may run with the + * security plugin enabled and without analytics-engine. A {@code build.gradle} exclude does not + * protect against that pipeline, so the test guards itself instead: + * + *

*/ -public class AnalyticsEngineCompatIT extends OpenSearchRestTestCase { +public class AnalyticsEngineCompatIT extends OpenSearchSQLRestTestCase { + + /** + * Skips the suite unless the analytics-engine plugin is installed. Runs after the framework has + * established the (security-aware) REST client, so the lookup itself succeeds on both plain and + * secured clusters. + */ + @Before + public void requireAnalyticsEngine() throws IOException { + Response response = client().performRequest(new Request("GET", "/_cat/plugins?h=component")); + String installedPlugins = TestUtils.getResponseBody(response, true); + assumeTrue( + "analytics-engine plugin not installed — skipping coexistence smoke test", + installedPlugins.contains("analytics-engine")); + } @Test public void testClusterStarted() { - // If the cluster booted, all three plugins loaded without classloader errors. + // If the cluster booted with analytics-engine present, all plugins loaded without classloader + // errors. The assumption above guarantees we only assert this where it is meaningful. } }