Skip to content

Commit

Permalink
Merge branch 'segment_replication_API' of https://github.com/Rishikes…
Browse files Browse the repository at this point in the history
…h1159/OpenSearch into segment_replication_API
  • Loading branch information
Rishikesh1159 committed Feb 3, 2023
2 parents b8f7b71 + 9cf580e commit 08bc3d6
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -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());
}
}
14 changes: 6 additions & 8 deletions server/src/main/java/org/opensearch/node/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<DiscoveryNodeRole> additionalRoles = pluginsService.filterPlugins(Plugin.class)
.stream()
.map(Plugin::getRoles)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 08bc3d6

Please sign in to comment.