|
@@ -19,6 +19,7 @@
|
|
|
|
|
|
package org.elasticsearch.tribe;
|
|
|
|
|
|
+import org.elasticsearch.cluster.ClusterName;
|
|
|
import org.elasticsearch.cluster.NamedDiff;
|
|
|
import org.elasticsearch.cluster.metadata.MetaData;
|
|
|
import org.elasticsearch.common.io.stream.StreamInput;
|
|
@@ -27,11 +28,14 @@ import org.elasticsearch.common.settings.Setting;
|
|
|
import org.elasticsearch.common.settings.Settings;
|
|
|
import org.elasticsearch.common.util.set.Sets;
|
|
|
import org.elasticsearch.env.Environment;
|
|
|
-import org.elasticsearch.script.ScriptService;
|
|
|
+import org.elasticsearch.node.MockNode;
|
|
|
+import org.elasticsearch.node.Node;
|
|
|
import org.elasticsearch.test.ESTestCase;
|
|
|
import org.elasticsearch.test.TestCustomMetaData;
|
|
|
+import org.elasticsearch.transport.MockTcpTransportPlugin;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
+import java.nio.file.Path;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Collections;
|
|
@@ -180,6 +184,28 @@ public class TribeServiceTests extends ESTestCase {
|
|
|
assertEquals(mergedCustom.getData(), "data2"+String.valueOf(n));
|
|
|
}
|
|
|
|
|
|
+ public void testTribeNodeDeprecation() throws IOException {
|
|
|
+ final Path tempDir = createTempDir();
|
|
|
+ Settings.Builder settings = Settings.builder()
|
|
|
+ .put("node.name", "test-node")
|
|
|
+ .put("path.home", tempDir)
|
|
|
+ .put(NetworkModule.HTTP_ENABLED.getKey(), false)
|
|
|
+ .put(NetworkModule.TRANSPORT_TYPE_SETTING.getKey(), "mock-socket-network");
|
|
|
+
|
|
|
+ final boolean tribeServiceEnable = randomBoolean();
|
|
|
+ if (tribeServiceEnable) {
|
|
|
+ String clusterName = "single-node-cluster";
|
|
|
+ String tribeSetting = "tribe." + clusterName + ".";
|
|
|
+ settings.put(tribeSetting + ClusterName.CLUSTER_NAME_SETTING.getKey(), clusterName)
|
|
|
+ .put(tribeSetting + NetworkModule.TRANSPORT_TYPE_SETTING.getKey(), "mock-socket-network");
|
|
|
+ }
|
|
|
+ try (Node node = new MockNode(settings.build(),Collections.singleton(MockTcpTransportPlugin.class) )) {
|
|
|
+ if (tribeServiceEnable) {
|
|
|
+ assertWarnings("tribe nodes are deprecated in favor of cross-cluster search and will be removed in Elasticsearch 7.0.0");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
static class MergableCustomMetaData1 extends TestCustomMetaData
|
|
|
implements TribeService.MergableCustomMetaData<MergableCustomMetaData1> {
|
|
|
public static final String TYPE = "custom_md_1";
|