diff --git a/modules/arrow-flight-rpc/src/internalClusterTest/java/org/opensearch/arrow/flight/ArrowFlightServerIT.java b/modules/arrow-flight-rpc/src/internalClusterTest/java/org/opensearch/arrow/flight/ArrowFlightServerIT.java index 6f0f47ad85af7..28a3374fc6ae6 100644 --- a/modules/arrow-flight-rpc/src/internalClusterTest/java/org/opensearch/arrow/flight/ArrowFlightServerIT.java +++ b/modules/arrow-flight-rpc/src/internalClusterTest/java/org/opensearch/arrow/flight/ArrowFlightServerIT.java @@ -14,8 +14,11 @@ import org.opensearch.arrow.flight.bootstrap.FlightService; import org.opensearch.cluster.node.DiscoveryNode; import org.opensearch.cluster.node.DiscoveryNodeRole; +import org.opensearch.common.util.FeatureFlags; import org.opensearch.plugins.Plugin; +import org.opensearch.test.FeatureFlagSetter; import org.opensearch.test.OpenSearchIntegTestCase; +import org.junit.BeforeClass; import java.util.Collection; import java.util.Collections; @@ -27,6 +30,11 @@ public class ArrowFlightServerIT extends OpenSearchIntegTestCase { private FlightClientManager flightClientManager; + @BeforeClass + public static void setupFeatureFlags() { + FeatureFlagSetter.set(FeatureFlags.ARROW_STREAMS_SETTING.getKey()); + } + @Override protected Collection> nodePlugins() { return Collections.singleton(FlightStreamPlugin.class); diff --git a/modules/arrow-flight-rpc/src/test/java/org/opensearch/arrow/flight/FlightStreamPluginTests.java b/modules/arrow-flight-rpc/src/test/java/org/opensearch/arrow/flight/FlightStreamPluginTests.java index fd525c14181d1..3aad78c8ab39c 100644 --- a/modules/arrow-flight-rpc/src/test/java/org/opensearch/arrow/flight/FlightStreamPluginTests.java +++ b/modules/arrow-flight-rpc/src/test/java/org/opensearch/arrow/flight/FlightStreamPluginTests.java @@ -17,6 +17,7 @@ import org.opensearch.common.settings.Settings; import org.opensearch.common.util.FeatureFlags; import org.opensearch.plugins.SecureTransportSettingsProvider; +import org.opensearch.test.FeatureFlagSetter; import org.opensearch.test.OpenSearchTestCase; import org.opensearch.threadpool.ExecutorBuilder; import org.opensearch.threadpool.ThreadPool; @@ -32,7 +33,6 @@ public class FlightStreamPluginTests extends OpenSearchTestCase { private Settings settings; - private FlightStreamPlugin plugin; private ClusterService clusterService; @Override @@ -45,12 +45,44 @@ public void setUp() throws Exception { when(clusterService.state()).thenReturn(clusterState); when(clusterState.nodes()).thenReturn(nodes); when(nodes.getLocalNodeId()).thenReturn("test-node"); - plugin = new FlightStreamPlugin(settings); } public void testPluginEnableAndDisable() throws IOException { - FeatureFlags.initializeFeatureFlags(settings); + Settings disabledSettings = Settings.builder() + .put("node.attr.transport.stream.port", "9880") + .put(ARROW_STREAMS_SETTING.getKey(), false) + .build(); + FeatureFlags.initializeFeatureFlags(disabledSettings); + FlightStreamPlugin disabledPlugin = new FlightStreamPlugin(disabledSettings); + + Collection disabledPluginComponents = disabledPlugin.createComponents( + null, + clusterService, + mock(ThreadPool.class), + null, + null, + null, + null, + null, + null, + null, + null + ); + + assertTrue(disabledPluginComponents.isEmpty()); + assertNull(disabledPlugin.getStreamManager().get()); + assertTrue(disabledPlugin.getExecutorBuilders(disabledSettings).isEmpty()); + assertNotNull(disabledPlugin.getSettings()); + assertTrue(disabledPlugin.getSettings().isEmpty()); + + assertNotNull(disabledPlugin.getSecureTransports(null, null, null, null, null, null, null, null)); + + disabledPlugin.close(); + + FeatureFlags.initializeFeatureFlags(settings); + FeatureFlagSetter.set(ARROW_STREAMS_SETTING.getKey()); + FlightStreamPlugin plugin = new FlightStreamPlugin(settings); Collection components = plugin.createComponents( null, clusterService, @@ -83,38 +115,6 @@ public void testPluginEnableAndDisable() throws IOException { assertFalse(settings.isEmpty()); assertNotNull(plugin.getSecureTransports(null, null, null, null, null, null, mock(SecureTransportSettingsProvider.class), null)); - plugin.close(); - - Settings disabledSettings = Settings.builder() - .put("node.attr.transport.stream.port", "9880") - .put(ARROW_STREAMS_SETTING.getKey(), false) - .build(); - FeatureFlags.initializeFeatureFlags(disabledSettings); - FlightStreamPlugin disabledPlugin = new FlightStreamPlugin(disabledSettings); - - Collection disabledPluginComponents = disabledPlugin.createComponents( - null, - clusterService, - mock(ThreadPool.class), - null, - null, - null, - null, - null, - null, - null, - null - ); - - assertTrue(disabledPluginComponents.isEmpty()); - assertNull(disabledPlugin.getStreamManager().get()); - assertTrue(disabledPlugin.getExecutorBuilders(disabledSettings).isEmpty()); - assertNotNull(disabledPlugin.getSettings()); - assertTrue(disabledPlugin.getSettings().isEmpty()); - - assertNotNull(disabledPlugin.getSecureTransports(null, null, null, null, null, null, null, null)); - - disabledPlugin.close(); } } diff --git a/server/src/main/java/org/opensearch/common/util/FeatureFlags.java b/server/src/main/java/org/opensearch/common/util/FeatureFlags.java index 4f0462f0b5cdd..4be45aed70023 100644 --- a/server/src/main/java/org/opensearch/common/util/FeatureFlags.java +++ b/server/src/main/java/org/opensearch/common/util/FeatureFlags.java @@ -129,7 +129,7 @@ public class FeatureFlags { ); public static final String ARROW_STREAMS = "opensearch.experimental.feature.arrow.streams.enabled"; - public static final Setting ARROW_STREAMS_SETTING = Setting.boolSetting(ARROW_STREAMS, true, Property.NodeScope); + public static final Setting ARROW_STREAMS_SETTING = Setting.boolSetting(ARROW_STREAMS, false, Property.NodeScope); private static final List> ALL_FEATURE_FLAG_SETTINGS = List.of( REMOTE_STORE_MIGRATION_EXPERIMENTAL_SETTING,