diff --git a/server/src/internalClusterTest/java/org/opensearch/extensions/ExtensionsManagerIT.java b/server/src/internalClusterTest/java/org/opensearch/extensions/ExtensionsManagerIT.java new file mode 100644 index 0000000000000..3c72edc98c764 --- /dev/null +++ b/server/src/internalClusterTest/java/org/opensearch/extensions/ExtensionsManagerIT.java @@ -0,0 +1,32 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.extensions; + +import org.opensearch.common.settings.Settings; +import org.opensearch.common.util.FeatureFlags; +import org.opensearch.test.OpenSearchIntegTestCase; + +@OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0) +public class ExtensionsManagerIT extends OpenSearchIntegTestCase { + + @Override + protected Settings featureFlagSettings() { + return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.EXTENSIONS, "true").build(); + } + + public void testExtensionsManagerCreation() { + String nodeName = internalCluster().startNode(); + + ensureGreen(); + + ExtensionsManager extManager = internalCluster().getInstance(ExtensionsManager.class, nodeName); + + assertEquals(ExtensionsManager.class.getName(), extManager.getClass().getName()); + } +} diff --git a/server/src/main/java/org/opensearch/node/Node.java b/server/src/main/java/org/opensearch/node/Node.java index 662a44a81ef85..ca27c639bec09 100644 --- a/server/src/main/java/org/opensearch/node/Node.java +++ b/server/src/main/java/org/opensearch/node/Node.java @@ -428,17 +428,17 @@ protected Node( classpathPlugins ); + final Settings settings = pluginsService.updatedSettings(); + + // Ensure to initialize Feature Flags via the settings from opensearch.yml + FeatureFlags.initializeFeatureFlags(settings); + if (FeatureFlags.isEnabled(FeatureFlags.EXTENSIONS)) { this.extensionsManager = new ExtensionsManager(tmpSettings, initialEnvironment.extensionDir()); } else { this.extensionsManager = new NoopExtensionsManager(); } - final Settings settings = pluginsService.updatedSettings(); - - // Ensure to initialize Feature Flags via the settings from opensearch.yml - FeatureFlags.initializeFeatureFlags(settings); - final Set additionalRoles = pluginsService.filterPlugins(Plugin.class) .stream() .map(Plugin::getRoles) @@ -1006,9 +1006,7 @@ protected Node( b.bind(Client.class).toInstance(client); b.bind(NodeClient.class).toInstance(client); b.bind(Environment.class).toInstance(this.environment); - if (FeatureFlags.isEnabled(FeatureFlags.EXTENSIONS)) { - b.bind(ExtensionsManager.class).toInstance(this.extensionsManager); - } + b.bind(ExtensionsManager.class).toInstance(this.extensionsManager); b.bind(ThreadPool.class).toInstance(threadPool); b.bind(NodeEnvironment.class).toInstance(nodeEnvironment); b.bind(ResourceWatcherService.class).toInstance(resourceWatcherService);