-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only activate x-pack if all nodes ready for it
- Loading branch information
Showing
16 changed files
with
263 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/XPackPluginTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
package org.elasticsearch.xpack.core; | ||
|
||
import org.elasticsearch.client.Client; | ||
import org.elasticsearch.common.settings.Settings; | ||
import org.elasticsearch.license.XPackLicenseState; | ||
import org.elasticsearch.test.ESTestCase; | ||
import org.elasticsearch.xpack.core.ssl.SSLService; | ||
|
||
import static org.hamcrest.Matchers.containsString; | ||
|
||
public class XPackPluginTests extends ESTestCase { | ||
|
||
public void testXPackInstalledAttrClashOnTransport() throws Exception { | ||
Settings.Builder builder = Settings.builder(); | ||
builder.put("node.attr." + XPackPlugin.XPACK_INSTALLED_NODE_ATTR, "true"); | ||
builder.put(Client.CLIENT_TYPE_SETTING_S.getKey(), "transport"); | ||
XPackPlugin xpackPlugin = createXPackPlugin(builder.put("path.home", createTempDir()).build()); | ||
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, xpackPlugin::additionalSettings); | ||
assertThat(e.getMessage(), | ||
containsString("Directly setting [node.attr." + XPackPlugin.XPACK_INSTALLED_NODE_ATTR + "] is not permitted")); | ||
} | ||
|
||
public void testXPackInstalledAttrClashOnNode() throws Exception { | ||
Settings.Builder builder = Settings.builder(); | ||
builder.put("node.attr." + XPackPlugin.XPACK_INSTALLED_NODE_ATTR, "false"); | ||
XPackPlugin xpackPlugin = createXPackPlugin(builder.put("path.home", createTempDir()).build()); | ||
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, xpackPlugin::additionalSettings); | ||
assertThat(e.getMessage(), | ||
containsString("Conflicting setting [node.attr." + XPackPlugin.XPACK_INSTALLED_NODE_ATTR + "]")); | ||
} | ||
|
||
public void testXPackInstalledAttrExists() throws Exception { | ||
XPackPlugin xpackPlugin = createXPackPlugin(Settings.builder().put("path.home", createTempDir()).build()); | ||
assertEquals("true", xpackPlugin.additionalSettings().get("node.attr." + XPackPlugin.XPACK_INSTALLED_NODE_ATTR)); | ||
} | ||
|
||
private XPackPlugin createXPackPlugin(Settings settings) throws Exception { | ||
return new XPackPlugin(settings, null){ | ||
|
||
@Override | ||
protected void setSslService(SSLService sslService) { | ||
// disable | ||
} | ||
|
||
@Override | ||
protected void setLicenseState(XPackLicenseState licenseState) { | ||
// disable | ||
} | ||
}; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.