Deprecate disabling basic-license features (#54816) (#55405)

We believe there's no longer a need to be able to disable basic-license
features completely using the "xpack.*.enabled" settings. If users don't
want to use those features, they simply don't need to use them. Having
such features always available lets us build more complex features that
assume basic-license features are present.

This commit deprecates settings of the form "xpack.*.enabled" for
basic-license features, excluding "security", which is a special case.
It also removes deprecated settings from integration tests and unit
tests where they're not directly relevant; e.g. monitoring and ILM are
no longer disabled in many integration tests.
This commit is contained in:
William Brafford 2020-04-17 15:04:17 -04:00 committed by GitHub
parent 4be3663968
commit 49e30b15a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
63 changed files with 179 additions and 175 deletions

View File

@ -443,9 +443,6 @@ testClusters {
throw new IllegalArgumentException("Unsupported self-generated license type: [" + licenseType + "[basic] or [trial].")
}
setting 'xpack.security.enabled', 'true'
setting 'xpack.monitoring.enabled', 'true'
setting 'xpack.sql.enabled', 'true'
setting 'xpack.rollup.enabled', 'true'
keystore 'bootstrap.password', 'password'
user username: 'elastic-admin', password: 'elastic-password', role: 'superuser'
}

View File

@ -157,7 +157,7 @@ following places:
`xpack.security.http.ssl.supported_protocols`::
For incoming HTTP connections to Elasticsearch's HTTP (Rest) interface.
If there are clients that connect to {es} and do not support newer TLS versions,
you must update this setting.
you must update this setting.
`xpack.http.ssl.supported_protocols`::
For outgoing HTTP connections from {watcher}.
@ -193,7 +193,7 @@ If your monitoring data is exported to a remote monitoring cluster and that
cluster is configured to only support TLSv1, you must update this setting.
`reindex.ssl.supported_protocols`::
For reindex from remote.
For reindex from remote.
If you reindex data from a remote {es} cluster which has SSL enabled on the
`http` interface and that cluster is configured to only support TLSv1, you must
update this setting.
@ -288,3 +288,21 @@ still be adjusted as desired using the cluster settings API.
==== HTTP Max content length setting is no longer parsed leniently
Previously, `http.max_content_length` would reset to `100mb` if the setting was
greater than `Integer.MAX_VALUE`. This leniency has been removed.
[float]
==== Option to disable basic license features is deprecated
In Elasticsearch 7.8.0, the following settings have been deprecated:
* `xpack.enrich.enabled`
* `xpack.flattened.enabled`
* `xpack.ilm.enabled`
* `xpack.monitoring.enabled`
* `xpack.rollup.enabled`
* `xpack.slm.enabled`
* `xpack.sql.enabled`
* `xpack.transform.enabled`
* `xpack.vectors.enabled`
In future releases, it will not be possible to disable the APIs for Enrichment,
Flattened mappings, ILM, Monitoring, Rollup, SLM, SQL, Transforms, and Vectors.

View File

@ -52,10 +52,9 @@ fails to start.
<<transform-node,{transform-cap} node>>::
A node that has `xpack.transform.enabled` and `node.transform` set to `true`. If
you want to use {transforms}, there must be at least one {transform} node in
your cluster. For more information, see <<transform-settings>> and
<<transforms>>.
A node that has `node.transform` set to `true`. If you want to use {transforms},
there must be at least one {transform} node in your cluster. For more
information, see <<transform-settings>> and <<transforms>>.
[NOTE]
[[coordinating-node]]
@ -126,8 +125,7 @@ node.ingest: false <4>
node.ml: false <5>
xpack.ml.enabled: true <6>
node.transform: false <7>
xpack.transform.enabled: true <8>
node.remote_client_client: false <9>
node.remote_client_client: false <8>
-------------------
<1> The `node.master` role is enabled by default.
<2> The `node.voting_only` role is disabled by default.
@ -136,8 +134,7 @@ node.remote_client_client: false <9>
<5> Disable the `node.ml` role (enabled by default).
<6> The `xpack.ml.enabled` setting is enabled by default.
<7> Disable the `node.transform` role.
<8> The `xpack.transform.enabled` setting is enabled by default.
<9> Disable remote cluster connections (enabled by default).
<8> Disable remote cluster connections (enabled by default).
To create a dedicated master-eligible node in the {oss-dist}, set:
@ -209,8 +206,7 @@ node.ingest: false <4>
node.ml: false <5>
xpack.ml.enabled: true <6>
node.transform: false <7>
xpack.transform.enabled: true <8>
node.remote_cluster_client: false <9>
node.remote_cluster_client: false <8>
-------------------
<1> The `node.master` role is enabled by default.
<2> Enable the `node.voting_only` role (disabled by default).
@ -219,8 +215,7 @@ node.remote_cluster_client: false <9>
<5> Disable the `node.ml` role (enabled by default).
<6> The `xpack.ml.enabled` setting is enabled by default.
<7> Disable the `node.transform` role.
<8> The `xpack.transform.enabled` setting is enabled by default.
<9> Disable remote cluster connections (enabled by default).
<8> Disable remote cluster connections (enabled by default).
[float]
[[data-node]]
@ -243,8 +238,7 @@ node.data: true <3>
node.ingest: false <4>
node.ml: false <5>
node.transform: false <6>
xpack.transform.enabled: true <7>
node.remote_cluster_client: false <8>
node.remote_cluster_client: false <7>
-------------------
<1> Disable the `node.master` role (enabled by default).
<2> The `node.voting_only` role is disabled by default.
@ -252,8 +246,7 @@ node.remote_cluster_client: false <8>
<4> Disable the `node.ingest` role (enabled by default).
<5> Disable the `node.ml` role (enabled by default).
<6> Disable the `node.transform` role.
<7> The `xpack.transform.enabled` setting is enabled by default.
<8> Disable remote cluster connections (enabled by default).
<7> Disable remote cluster connections (enabled by default).
To create a dedicated data node in the {oss-dist}, set:
[source,yaml]
@ -343,8 +336,7 @@ node.ingest: false <4>
node.ml: false <5>
xpack.ml.enabled: true <6>
node.transform: false <7>
xpack.transform.enabled: true <8>
node.remote_cluster_client: false <9>
node.remote_cluster_client: false <8>
-------------------
<1> Disable the `node.master` role (enabled by default).
<2> The `node.voting_only` role is disabled by default.
@ -353,8 +345,7 @@ node.remote_cluster_client: false <9>
<5> Disable the `node.ml` role (enabled by default).
<6> The `xpack.ml.enabled` setting is enabled by default.
<7> Disable the `node.transform` role.
<8> The `xpack.transform.enabled` setting is enabled by default.
<9> Disable remote cluster connections (enabled by default).
<8> Disable remote cluster connections (enabled by default).
To create a dedicated coordinating node in the {oss-dist}, set:
@ -396,8 +387,7 @@ node.ingest: false <4>
node.ml: true <5>
xpack.ml.enabled: true <6>
node.transform: false <7>
xpack.transform.enabled: true <8>
node.remote_cluster_client: false <9>
node.remote_cluster_client: false <8>
-------------------
<1> Disable the `node.master` role (enabled by default).
<2> The `node.voting_only` role is disabled by default.
@ -406,8 +396,7 @@ node.remote_cluster_client: false <9>
<5> The `node.ml` role is enabled by default.
<6> The `xpack.ml.enabled` setting is enabled by default.
<7> Disable the `node.transform` role.
<8> The `xpack.transform.enabled` setting is enabled by default.
<9> Disable remote cluster connections (enabled by default).
<8> Disable remote cluster connections (enabled by default).
[discrete]
[[transform-node]]
@ -415,13 +404,13 @@ node.remote_cluster_client: false <9>
{transform-cap} nodes run {transforms} and handle {transform} API requests.
If you want to use {transforms} in your cluster, you must have
`xpack.transform.enabled` set to `true` on all master-eligible nodes and all
data nodes. If you want to use {transforms} in clients (including {kib}), it
must also be enabled on all coordinating nodes. You must also have
`node.transform` set to `true` on at least one node. This is the default
behavior. If you have the {oss-dist}, do not use these settings. For more
information, see <<transform-settings>>.
If you want to use {transforms} in your cluster, you must not have
`xpack.transform.enabled` set to `false` on any master-eligible or data
nodes. To use {transforms} in clients (including {kib}), do not disable this
setting on any coordinating nodes. You must also have `node.transform` set to
`true` on at least one node. This is the default behavior. If you have the
{oss-dist}, do not use these settings. For more information, see
<<transform-settings>>.
To create a dedicated {transform} node in the {default-dist}, set:
@ -433,8 +422,7 @@ node.data: false <3>
node.ingest: false <4>
node.ml: false <5>
node.transform: true <6>
xpack.transform.enabled: true <7>
node.remote_cluster_client: false <8>
node.remote_cluster_client: false <7>
-------------------
<1> Disable the `node.master` role.
<2> Disable the `node.voting_only`.
@ -442,8 +430,7 @@ node.remote_cluster_client: false <8>
<4> Disable the `node.ingest` role.
<5> Disable the `node.ml` role.
<6> Enable the `node.transform` role.
<7> Enable the `xpack.tranform.enabled` setting.
<8> Disable remote cluster connections.
<7> Disable remote cluster connections.
[float]
[[change-node-role]]

View File

@ -30,8 +30,8 @@ To learn about monitoring in general, see <<monitor-elasticsearch-cluster>>.
. Configure your cluster to collect monitoring data:
.. Verify that the `xpack.monitoring.enabled` setting is `true`, which is its
default value, on each node in the cluster. For more information, see
.. Verify that the deprecated `xpack.monitoring.enabled` setting is not set to
`false` on any node in the cluster. For more information, see
<<monitoring-settings>>.
.. Verify that the `xpack.monitoring.elasticsearch.collection.enabled` setting

View File

@ -7,8 +7,9 @@ These are the settings available for configuring Index Lifecycle Management
==== Cluster level settings
`xpack.ilm.enabled`::
Whether ILM is enabled or disabled, setting this to `false` disables any
ILM REST API endpoints and functionality. Defaults to `true`.
deprecated:[7.8.0,Basic License features should always be enabled] +
Whether ILM is enabled or disabled, setting this to `false` disables any ILM
REST API endpoints and functionality. Defaults to `true`.
`indices.lifecycle.poll_interval`::
(<<time-units, time units>>) How often {ilm} checks for indices that meet policy

View File

@ -27,6 +27,7 @@ For more information, see <<monitor-elasticsearch-cluster>>.
==== General Monitoring Settings
`xpack.monitoring.enabled`::
deprecated:[7.8.0,Basic License features should always be enabled] +
Set to `true` (default) to enable {es} {monitoring} for {es} on the node.
+
--

View File

@ -38,13 +38,12 @@ required. For more information, see <<encrypting-data>>.
added:[6.3.0,Default changed to `true`.]
deprecated:[7.0.0,Watcher history indices are now managed by the `watch-history-ilm-policy` ILM policy]
+
Set to `true` (default) to enable the cleaner service. If this setting is
`true`, the `xpack.monitoring.enabled` setting must also be set to `true` with
a local exporter enabled. The cleaner service removes previous versions of
{watcher} indices (for example, `.watcher-history*`) when it determines that
they are old. The duration of {watcher} indices is determined by the
`xpack.monitoring.history.duration` setting, which defaults to 7 days. For
more information about that setting, see <<monitoring-settings>>.
Set to `true` (default) to enable the cleaner service. The cleaner service
removes previous versions of {watcher} indices (for example,
`.watcher-history*`) when it determines that they are old. The duration of
{watcher} indices is determined by the `xpack.monitoring.history.duration`
setting, which defaults to 7 days. For more information about that setting,
see <<monitoring-settings>>.
`xpack.http.proxy.host`::
Specifies the address of the proxy server to use to connect to HTTP services.

View File

@ -12,4 +12,5 @@ these SQL Access settings in the `elasticsearch.yml` file.
[[general-sql-settings]]
==== General SQL Access Settings
`xpack.sql.enabled`::
deprecated:[7.8.0,Basic License features should always be enabled] +
Set to `false` to disable SQL Access on the node.

View File

@ -35,13 +35,14 @@ of transforms to certain nodes instead of using `xpack.transform.enabled`. On de
coordinating nodes or dedicated master nodes, disable the node.transform role.
`xpack.transform.enabled`::
Set to `true` (default) to enable {transforms} on the node. +
deprecated:[7.8.0,Basic License features should always be enabled] +
Set to `true` (default) to enable {transforms} on the node.
+
If set to `false` in `elasticsearch.yml`, the {transform} APIs are disabled on
the node. Therefore the node cannot start or administrate {transforms} or
receive transport (internal) communication requests related to {transform} APIs.
If the node is a coordinating node, {transform} requests from clients (including
{kib}) also fail.
{kib}) also fail.
+
IMPORTANT: If you want to use {transform} features in your cluster, it is
recommended that you set `xpack.transform.enabled` to `true` on all nodes. This

View File

@ -3,33 +3,32 @@
[[snapshot-lifecycle-management]]
== Manage the snapshot lifecycle
You can set up snapshot lifecycle policies to automate the timing, frequency, and retention of snapshots.
Snapshot policies can apply to multiple indices.
You can set up snapshot lifecycle policies to automate the timing, frequency, and retention of snapshots.
Snapshot policies can apply to multiple indices.
The snapshot lifecycle management (SLM) <<snapshot-lifecycle-management-api, CRUD APIs>> provide
the building blocks for the snapshot policy features that are part of the Management application in {kib}.
The Snapshot and Restore UI makes it easy to set up policies, register snapshot repositories,
the building blocks for the snapshot policy features that are part of the Management application in {kib}.
The Snapshot and Restore UI makes it easy to set up policies, register snapshot repositories,
view and manage snapshots, and restore indices.
You can stop and restart SLM to temporarily pause automatic backups while performing
upgrades or other maintenance.
To disable SLM entirely, set `xpack.slm.enabled` to `false` in `elasticsearch.yml`.
[float]
[[slm-and-security]]
=== Security and SLM
Two built-in cluster privileges control access to the SLM actions when
Two built-in cluster privileges control access to the SLM actions when
{es} {security-features} are enabled:
`manage_slm`:: Allows a user to perform all SLM actions, including creating and updating policies
and starting and stopping SLM.
`manage_slm`:: Allows a user to perform all SLM actions, including creating and updating policies
and starting and stopping SLM.
`read_slm`:: Allows a user to perform all read-only SLM actions,
`read_slm`:: Allows a user to perform all read-only SLM actions,
such as getting policies and checking the SLM status.
`cluster:admin/snapshot/*`:: Allows a user to take and delete snapshots of any
index, whether or not they have access to that index.
index, whether or not they have access to that index.
For example, the following request configures an `slm-admin` role that grants the privileges
necessary for administering SLM.
@ -69,4 +68,4 @@ POST /_security/role/slm-read-only
include::getting-started-slm.asciidoc[]
include::slm-retention.asciidoc[]
include::slm-retention.asciidoc[]

View File

@ -3,33 +3,32 @@
[[snapshot-lifecycle-management]]
== Manage the snapshot lifecycle
You can set up snapshot lifecycle policies to automate the timing, frequency, and retention of snapshots.
Snapshot policies can apply to multiple indices.
You can set up snapshot lifecycle policies to automate the timing, frequency, and retention of snapshots.
Snapshot policies can apply to multiple indices.
The snapshot lifecycle management (SLM) <<snapshot-lifecycle-management-api, CRUD APIs>> provide
the building blocks for the snapshot policy features that are part of the Management application in {kib}.
The Snapshot and Restore UI makes it easy to set up policies, register snapshot repositories,
the building blocks for the snapshot policy features that are part of the Management application in {kib}.
The Snapshot and Restore UI makes it easy to set up policies, register snapshot repositories,
view and manage snapshots, and restore indices.
You can stop and restart SLM to temporarily pause automatic backups while performing
upgrades or other maintenance.
To disable SLM entirely, set `xpack.slm.enabled` to `false` in `elasticsearch.yml`.
[float]
[[slm-and-security]]
=== Security and SLM
Two built-in cluster privileges control access to the SLM actions when
Two built-in cluster privileges control access to the SLM actions when
{es} {security-features} are enabled:
`manage_slm`:: Allows a user to perform all SLM actions, including creating and updating policies
and starting and stopping SLM.
`manage_slm`:: Allows a user to perform all SLM actions, including creating and updating policies
and starting and stopping SLM.
`read_slm`:: Allows a user to perform all read-only SLM actions,
`read_slm`:: Allows a user to perform all read-only SLM actions,
such as getting policies and checking the SLM status.
`cluster:admin/snapshot/*`:: Allows a user to take and delete snapshots of any
index, whether or not they have access to that index.
index, whether or not they have access to that index.
For example, the following request configures an `slm-admin` role that grants the privileges
necessary for administering SLM.
@ -69,4 +68,4 @@ POST /_security/role/slm-read-only
include::getting-started-slm.asciidoc[]
include::slm-retention.asciidoc[]
include::slm-retention.asciidoc[]

View File

@ -24,9 +24,7 @@ integTest {
testClusters.integTest {
setting 'xpack.security.enabled', 'true'
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
// This is important, so that all the modules are available too.

View File

@ -5,9 +5,9 @@ apply plugin: 'elasticsearch.standalone-test'
restResources {
restApi {
includeCore '_common', 'cluster', 'nodes', 'indices', 'index', 'info'
includeCore '_common', 'cluster', 'nodes', 'indices', 'index', 'info'
includeXpack 'ccr'
}
}
}
dependencies {
@ -26,7 +26,6 @@ testClusters.restTest {
// that is thrown in production when indexing a document directly in a follower index.
jvmArgs '-da:org.elasticsearch.xpack.ccr.index.engine.FollowingEngineAssertions'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.security.enabled', 'true'
setting 'xpack.license.self_generated.type', 'trial'
// TODO: reduce the need for superuser here

View File

@ -20,7 +20,6 @@ testClusters.'leader-cluster' {
testDistribution = 'DEFAULT'
setting 'xpack.license.self_generated.type', 'trial'
setting 'xpack.security.enabled', 'true'
setting 'xpack.monitoring.enabled', 'false'
extraConfigFile 'roles.yml', file('leader-roles.yml')
user username: "test_admin", role: "superuser"
user username: "test_ccr", role: "ccruser"

View File

@ -222,7 +222,6 @@ public abstract class CcrIntegTestCase extends ESTestCase {
builder.putList(DISCOVERY_SEED_PROVIDERS_SETTING.getKey(), "file");
builder.put(NetworkModule.TRANSPORT_TYPE_KEY, getTestTransportType());
builder.put(XPackSettings.SECURITY_ENABLED.getKey(), false);
builder.put(XPackSettings.MONITORING_ENABLED.getKey(), false);
builder.put(XPackSettings.WATCHER_ENABLED.getKey(), false);
builder.put(XPackSettings.MACHINE_LEARNING_ENABLED.getKey(), false);
builder.put(LicenseService.SELF_GENERATED_LICENSE_TYPE.getKey(), "trial");

View File

@ -43,7 +43,8 @@ public class XPackSettings {
/**
* Setting for controlling whether or not enrich is enabled.
*/
public static final Setting<Boolean> ENRICH_ENABLED_SETTING = Setting.boolSetting("xpack.enrich.enabled", true, Property.NodeScope);
public static final Setting<Boolean> ENRICH_ENABLED_SETTING = Setting.boolSetting("xpack.enrich.enabled", true,
Property.NodeScope, Property.Deprecated);
/**
* Setting for controlling whether or not CCR is enabled.
@ -55,14 +56,14 @@ public class XPackSettings {
private static final Setting<Boolean> DATA_FRAME_ENABLED = Setting.boolSetting("xpack.data_frame.enabled", true,
Setting.Property.NodeScope, Setting.Property.Deprecated);
public static final Setting<Boolean> TRANSFORM_ENABLED = Setting.boolSetting("xpack.transform.enabled", DATA_FRAME_ENABLED,
Setting.Property.NodeScope);
Property.NodeScope, Property.Deprecated);
/** Setting for enabling or disabling security. Defaults to true. */
public static final Setting<Boolean> SECURITY_ENABLED = Setting.boolSetting("xpack.security.enabled", true, Setting.Property.NodeScope);
/** Setting for enabling or disabling monitoring. */
public static final Setting<Boolean> MONITORING_ENABLED = Setting.boolSetting("xpack.monitoring.enabled", true,
Setting.Property.NodeScope);
Property.NodeScope, Property.Deprecated);
/** Setting for enabling or disabling watcher. Defaults to true. */
public static final Setting<Boolean> WATCHER_ENABLED = Setting.boolSetting("xpack.watcher.enabled", true, Setting.Property.NodeScope);
@ -76,7 +77,7 @@ public class XPackSettings {
/** Setting for enabling or disabling rollup. Defaults to true. */
public static final Setting<Boolean> ROLLUP_ENABLED = Setting.boolSetting("xpack.rollup.enabled", true,
Setting.Property.NodeScope);
Property.NodeScope, Property.Deprecated);
/** Setting for enabling or disabling auditing. Defaults to false. */
public static final Setting<Boolean> AUDIT_ENABLED = Setting.boolSetting("xpack.security.audit.enabled", false,
@ -94,13 +95,13 @@ public class XPackSettings {
* Setting for enabling or disabling the index lifecycle extension. Defaults to true.
*/
public static final Setting<Boolean> INDEX_LIFECYCLE_ENABLED = Setting.boolSetting("xpack.ilm.enabled", true,
Setting.Property.NodeScope);
Property.NodeScope, Property.Deprecated);
/**
* Setting for enabling or disabling the snapshot lifecycle extension. Defaults to true.
*/
public static final Setting<Boolean> SNAPSHOT_LIFECYCLE_ENABLED = Setting.boolSetting("xpack.slm.enabled", true,
Setting.Property.NodeScope);
Property.NodeScope, Property.Deprecated);
/** Setting for enabling or disabling TLS. Defaults to false. */
public static final Setting<Boolean> TRANSPORT_SSL_ENABLED = Setting.boolSetting("xpack.security.transport.ssl.enabled", false,
@ -127,14 +128,16 @@ public class XPackSettings {
Setting.boolSetting("xpack.security.fips_mode.enabled", false, Property.NodeScope);
/** Setting for enabling or disabling sql. Defaults to true. */
public static final Setting<Boolean> SQL_ENABLED = Setting.boolSetting("xpack.sql.enabled", true, Setting.Property.NodeScope);
public static final Setting<Boolean> SQL_ENABLED = Setting.boolSetting("xpack.sql.enabled", true,
Property.NodeScope, Property.Deprecated);
/** Setting for enabling or disabling flattened fields. Defaults to true. */
public static final Setting<Boolean> FLATTENED_ENABLED = Setting.boolSetting("xpack.flattened.enabled",
true, Setting.Property.NodeScope);
public static final Setting<Boolean> FLATTENED_ENABLED = Setting.boolSetting("xpack.flattened.enabled", true,
Property.NodeScope, Property.Deprecated);
/** Setting for enabling or disabling vectors. Defaults to true. */
public static final Setting<Boolean> VECTORS_ENABLED = Setting.boolSetting("xpack.vectors.enabled", true, Setting.Property.NodeScope);
public static final Setting<Boolean> VECTORS_ENABLED = Setting.boolSetting("xpack.vectors.enabled", true,
Property.NodeScope, Property.Deprecated);
public static final Setting<Boolean> DIAGNOSE_TRUST_EXCEPTIONS_SETTING = Setting.boolSetting(
"xpack.security.ssl.diagnose.trust", true, Setting.Property.NodeScope);

View File

@ -8,6 +8,7 @@ package org.elasticsearch.xpack.monitoring.collector.enrich;
import org.elasticsearch.action.ActionFuture;
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.util.concurrent.ThreadContext;
@ -74,7 +75,8 @@ public class EnrichStatsCollectorTests extends BaseCollectorTestCase {
// this is controls the blockage
final Settings settings = enrichDisabledSettings();
when(licenseState.isMonitoringAllowed()).thenReturn(randomBoolean());
boolean isMonitoringAllowed = randomBoolean();
when(licenseState.isMonitoringAllowed()).thenReturn(isMonitoringAllowed);
when(licenseState.isEnrichAllowed()).thenReturn(randomBoolean());
final boolean isElectedMaster = randomBoolean();
@ -87,12 +89,18 @@ public class EnrichStatsCollectorTests extends BaseCollectorTestCase {
if (isElectedMaster) {
verify(licenseState).isMonitoringAllowed();
}
if (isElectedMaster && isMonitoringAllowed) {
// The enrich setting is only checked if the node is master and monitoring is allowed,
// so in other cases we won't have a deprecation warning.
assertSettingDeprecationsAndWarnings(new Setting<?>[] { XPackSettings.ENRICH_ENABLED_SETTING });
}
}
public void testShouldCollectReturnsFalseIfEnrichIsNotAllowed() {
final Settings settings = randomFrom(enrichEnabledSettings(), enrichDisabledSettings());
when(licenseState.isMonitoringAllowed()).thenReturn(randomBoolean());
boolean isMonitoringAllowed = randomBoolean();
when(licenseState.isMonitoringAllowed()).thenReturn(isMonitoringAllowed);
// this is controls the blockage
when(licenseState.isEnrichAllowed()).thenReturn(false);
final boolean isElectedMaster = randomBoolean();
@ -105,6 +113,9 @@ public class EnrichStatsCollectorTests extends BaseCollectorTestCase {
if (isElectedMaster) {
verify(licenseState).isMonitoringAllowed();
}
if (isElectedMaster && isMonitoringAllowed && settings.get(XPackSettings.ENRICH_ENABLED_SETTING.getKey()) != null) {
assertSettingDeprecationsAndWarnings(new Setting<?>[] { XPackSettings.ENRICH_ENABLED_SETTING });
}
}
public void testShouldCollectReturnsTrue() {
@ -119,6 +130,9 @@ public class EnrichStatsCollectorTests extends BaseCollectorTestCase {
assertThat(collector.shouldCollect(isElectedMaster), is(true));
verify(licenseState).isMonitoringAllowed();
if (settings.get(XPackSettings.ENRICH_ENABLED_SETTING.getKey()) != null) {
assertSettingDeprecationsAndWarnings(new Setting<?>[] { XPackSettings.ENRICH_ENABLED_SETTING });
}
}
public void testDoCollect() throws Exception {

View File

@ -23,11 +23,9 @@ task 'leader-cluster'(type: RestIntegTestTask) {
testClusters.'leader-cluster' {
testDistribution = 'DEFAULT'
setting 'path.repo', repoDir.absolutePath
setting 'xpack.ilm.enabled', 'true'
setting 'xpack.ccr.enabled', 'true'
setting 'xpack.security.enabled', 'false'
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
setting 'indices.lifecycle.poll_interval', '1000ms'
@ -50,11 +48,9 @@ task 'follow-cluster'(type: RestIntegTestTask) {
testClusters.'follow-cluster' {
testDistribution = 'DEFAULT'
setting 'path.repo', repoDir.absolutePath
setting 'xpack.ilm.enabled', 'true'
setting 'xpack.ccr.enabled', 'true'
setting 'xpack.security.enabled', 'false'
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
setting 'indices.lifecycle.poll_interval', '1000ms'

View File

@ -24,10 +24,8 @@ testClusters.integTest {
numberOfNodes = 4
setting 'path.repo', repoDir.absolutePath
setting 'xpack.ilm.enabled', 'true'
setting 'xpack.security.enabled', 'false'
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
setting 'indices.lifecycle.poll_interval', '1000ms'

View File

@ -28,9 +28,7 @@ task restTest(type: RestIntegTestTask) {
testClusters.restTest {
testDistribution = 'DEFAULT'
setting 'xpack.ilm.enabled', 'true'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.security.enabled', 'true'
setting 'xpack.license.self_generated.type', 'trial'
user clusterCredentials

View File

@ -19,10 +19,8 @@ integTest {
testClusters.integTest {
testDistribution = 'DEFAULT'
setting 'xpack.ilm.enabled', 'true'
setting 'xpack.security.enabled', 'true'
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
extraConfigFile 'roles.yml', file('roles.yml')

View File

@ -13,9 +13,11 @@ import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.license.XPackLicenseState;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.core.ilm.IndexLifecycleFeatureSetUsage;
import org.elasticsearch.xpack.core.ilm.IndexLifecycleFeatureSetUsage.PolicyStats;
import org.elasticsearch.xpack.core.ilm.IndexLifecycleMetadata;
@ -71,6 +73,7 @@ public class IndexLifecycleFeatureSetTests extends ESTestCase {
settings = Settings.builder().put("xpack.ilm.enabled", true);
featureSet = new IndexLifecycleFeatureSet(settings.build(), licenseState, clusterService);
assertThat(featureSet.enabled(), equalTo(true));
assertSettingDeprecationsAndWarnings(new Setting<?>[] { XPackSettings.INDEX_LIFECYCLE_ENABLED } );
}
public void testName() {

View File

@ -95,7 +95,6 @@ public class IndexLifecycleInitialisationTests extends ESIntegTestCase {
@Override
protected Settings nodeSettings(int nodeOrdinal) {
Settings.Builder settings = Settings.builder().put(super.nodeSettings(nodeOrdinal));
settings.put(XPackSettings.INDEX_LIFECYCLE_ENABLED.getKey(), true);
settings.put(XPackSettings.MACHINE_LEARNING_ENABLED.getKey(), false);
settings.put(XPackSettings.SECURITY_ENABLED.getKey(), false);
settings.put(XPackSettings.WATCHER_ENABLED.getKey(), false);

View File

@ -10,9 +10,7 @@ dependencies {
testClusters.integTest {
testDistribution = 'DEFAULT'
numberOfNodes = 3
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.security.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.ml.enabled', 'true'
setting 'xpack.license.self_generated.type', 'trial'

View File

@ -9,7 +9,6 @@ dependencies {
testClusters.integTest {
testDistribution = 'DEFAULT'
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.security.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
}

View File

@ -42,8 +42,6 @@ testClusters.integTest {
setting 'xpack.security.enabled', 'true'
setting 'xpack.ml.enabled', 'true'
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.security.authc.token.enabled', 'true'
setting 'xpack.security.transport.ssl.enabled', 'true'
setting 'xpack.security.transport.ssl.key', nodeKey.name

View File

@ -28,7 +28,13 @@ import org.elasticsearch.transport.Netty4Plugin;
import org.elasticsearch.xpack.core.LocalStateCompositeXPackPlugin;
import org.elasticsearch.xpack.core.XPackClientPlugin;
import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.core.ilm.DeleteAction;
import org.elasticsearch.xpack.core.ilm.IndexLifecycleMetadata;
import org.elasticsearch.xpack.core.ilm.LifecycleAction;
import org.elasticsearch.xpack.core.ilm.LifecycleSettings;
import org.elasticsearch.xpack.core.ilm.LifecycleType;
import org.elasticsearch.xpack.core.ilm.RolloverAction;
import org.elasticsearch.xpack.core.ilm.TimeseriesLifecycleType;
import org.elasticsearch.xpack.core.ml.MlMetadata;
import org.elasticsearch.xpack.core.ml.MlTasks;
import org.elasticsearch.xpack.core.ml.action.DeleteExpiredDataAction;
@ -170,6 +176,11 @@ abstract class MlNativeIntegTestCase extends ESIntegTestCase {
List<NamedWriteableRegistry.Entry> entries = new ArrayList<>(ClusterModule.getNamedWriteables());
entries.addAll(new SearchModule(Settings.EMPTY, true, Collections.emptyList()).getNamedWriteables());
entries.add(new NamedWriteableRegistry.Entry(Metadata.Custom.class, "ml", MlMetadata::new));
entries.add(new NamedWriteableRegistry.Entry(Metadata.Custom.class, IndexLifecycleMetadata.TYPE, IndexLifecycleMetadata::new));
entries.add(new NamedWriteableRegistry.Entry(LifecycleType.class, TimeseriesLifecycleType.TYPE,
(in) -> TimeseriesLifecycleType.INSTANCE));
entries.add(new NamedWriteableRegistry.Entry(LifecycleAction.class, DeleteAction.NAME, DeleteAction::new));
entries.add(new NamedWriteableRegistry.Entry(LifecycleAction.class, RolloverAction.NAME, RolloverAction::new));
entries.add(new NamedWriteableRegistry.Entry(PersistentTaskParams.class, MlTasks.DATAFEED_TASK_NAME,
StartDatafeedAction.DatafeedParams::new));
entries.add(new NamedWriteableRegistry.Entry(PersistentTaskParams.class, MlTasks.DATA_FRAME_ANALYTICS_TASK_NAME,

View File

@ -9,7 +9,6 @@ dependencies {
testClusters.integTest {
testDistribution = 'DEFAULT'
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.security.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
}

View File

@ -20,6 +20,7 @@ import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.common.util.concurrent.ThreadContext;
@ -85,11 +86,7 @@ public class MlIndexTemplateRegistryTests extends ESTestCase {
public void testStateTemplateWithIlm() {
MlIndexTemplateRegistry registry =
new MlIndexTemplateRegistry(
Settings.builder()
.put(XPackSettings.INDEX_LIFECYCLE_ENABLED.getKey(), true)
.build(),
clusterService, threadPool, client, xContentRegistry);
new MlIndexTemplateRegistry(Settings.EMPTY, clusterService, threadPool, client, xContentRegistry);
registry.clusterChanged(createClusterChangedEvent(nodes));
@ -121,15 +118,13 @@ public class MlIndexTemplateRegistryTests extends ESTestCase {
.orElseThrow(() -> new AssertionError("expected the ml state index template to be put"));
assertThat(req.settings().get("index.lifecycle.name"), is(nullValue()));
assertThat(req.settings().get("index.lifecycle.rollover_alias"), is(nullValue()));
assertSettingDeprecationsAndWarnings(new Setting<?>[] { XPackSettings.INDEX_LIFECYCLE_ENABLED } );
}
public void testStatsTemplateWithIlm() {
MlIndexTemplateRegistry registry =
new MlIndexTemplateRegistry(
Settings.builder()
.put(XPackSettings.INDEX_LIFECYCLE_ENABLED.getKey(), true)
.build(),
clusterService, threadPool, client, xContentRegistry);
new MlIndexTemplateRegistry(Settings.EMPTY, clusterService, threadPool, client, xContentRegistry);
registry.clusterChanged(createClusterChangedEvent(nodes));
@ -161,6 +156,8 @@ public class MlIndexTemplateRegistryTests extends ESTestCase {
.orElseThrow(() -> new AssertionError("expected the ml stats index template to be put"));
assertThat(req.settings().get("index.lifecycle.name"), is(nullValue()));
assertThat(req.settings().get("index.lifecycle.rollover_alias"), is(nullValue()));
assertSettingDeprecationsAndWarnings(new Setting<?>[] { XPackSettings.INDEX_LIFECYCLE_ENABLED } );
}
@SuppressWarnings("unchecked")

View File

@ -10,6 +10,7 @@ import org.elasticsearch.action.support.PlainActionFuture;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
@ -17,6 +18,7 @@ import org.elasticsearch.license.XPackLicenseState;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.rest.yaml.ObjectPath;
import org.elasticsearch.xpack.core.XPackFeatureSet;
import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.core.XPackFeatureSet.Usage;
import org.elasticsearch.xpack.core.monitoring.MonitoringFeatureSetUsage;
import org.elasticsearch.xpack.monitoring.exporter.Exporter;
@ -54,6 +56,7 @@ public class MonitoringFeatureSetTests extends ESTestCase {
settings.put("xpack.monitoring.enabled", enabled);
MonitoringFeatureSet featureSet = new MonitoringFeatureSet(settings.build(), monitoring, licenseState, exporters);
assertThat(featureSet.enabled(), is(enabled));
assertSettingDeprecationsAndWarnings(new Setting<?>[] { XPackSettings.MONITORING_ENABLED } );
}
public void testEnabledDefault() {

View File

@ -7,10 +7,12 @@ package org.elasticsearch.xpack.rollup;
import org.elasticsearch.action.support.PlainActionFuture;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.license.XPackLicenseState;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.core.XPackFeatureSet;
import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.core.rollup.RollupFeatureSetUsage;
import org.junit.Before;
@ -43,6 +45,7 @@ public class RollupFeatureSetTests extends ESTestCase {
settings.put("xpack.rollup.enabled", enabled);
RollupFeatureSet featureSet = new RollupFeatureSet(settings.build(), licenseState);
assertThat(featureSet.enabled(), is(enabled));
assertSettingDeprecationsAndWarnings(new Setting<?>[] { XPackSettings.ROLLUP_ENABLED } );
}
public void testEnabledDefault() {

View File

@ -20,7 +20,6 @@ integTest {
testClusters.integTest {
testDistribution = 'DEFAULT'
numberOfNodes = 2
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'basic'
setting 'xpack.security.enabled', 'false'

View File

@ -12,7 +12,6 @@ testClusters.integTest {
testDistribution = 'DEFAULT'
numberOfNodes = 2
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'basic'
setting 'xpack.security.enabled', 'true'

View File

@ -1,11 +1,11 @@
/*
* This QA project tests the security plugin when security is explicitlt disabled.
* It is intended to cover security functionality which is supposed to
* It is intended to cover security functionality which is supposed to
* function in a specific way even if security is disabled on the cluster
* For example: If a cluster has a pipeline with the set_security_user processor
* defined, it should be not fail
*/
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
@ -20,7 +20,6 @@ testClusters.integTest {
testDistribution = 'DEFAULT'
numberOfNodes = 2
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
// We run with a trial license, but explicitly disable security.
// This means the security plugin is loaded and all feature are permitted, but they are not enabled

View File

@ -1,11 +1,11 @@
/*
* This QA project tests the security plugin when security is not enabled.
* It is intended to cover security functionality which is supposed to
* It is intended to cover security functionality which is supposed to
* function in a specific way even if security is not enabled on the cluster
* For example: If a cluster has a pipeline with the set_security_user processor
* defined, it should be not fail
*/
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
@ -20,7 +20,6 @@ testClusters.integTest {
testDistribution = 'DEFAULT'
numberOfNodes = 2
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
// We run with a trial license, but do not enable security.
// This means the security plugin is loaded and all feature are permitted, but they are not enabled

View File

@ -12,7 +12,6 @@ testClusters.integTest {
testDistribution = 'DEFAULT'
numberOfNodes = 2
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
setting 'xpack.security.enabled', 'true'

View File

@ -24,7 +24,6 @@ testClusters.integTest {
extraConfigFile 'transport.crt', file('src/test/resources/ssl/transport.crt')
extraConfigFile 'ca.crt', file('src/test/resources/ssl/ca.crt')
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'basic'
setting 'xpack.security.http.ssl.enabled', 'true'

View File

@ -113,7 +113,6 @@ subprojects {
testClusters.integTest {
testDistribution = 'DEFAULT'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.watcher.enabled', 'false'
}

View File

@ -11,12 +11,14 @@ import org.elasticsearch.action.support.PlainActionFuture;
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.common.xcontent.ObjectPath;
import org.elasticsearch.license.XPackLicenseState;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.core.sql.SqlFeatureSetUsage;
import org.elasticsearch.xpack.core.watcher.common.stats.Counters;
import org.elasticsearch.xpack.sql.plugin.SqlStatsAction;
@ -60,15 +62,21 @@ public class SqlFeatureSetTests extends ESTestCase {
public void testEnabled() {
boolean enabled = randomBoolean();
Settings.Builder settings = Settings.builder();
boolean isExplicitlySet = false;
if (enabled) {
if (randomBoolean()) {
settings.put("xpack.sql.enabled", enabled);
isExplicitlySet = true;
}
} else {
settings.put("xpack.sql.enabled", enabled);
isExplicitlySet = true;
}
SqlFeatureSet featureSet = new SqlFeatureSet(settings.build(), licenseState, client);
assertThat(featureSet.enabled(), is(enabled));
if (isExplicitlySet) {
assertSettingDeprecationsAndWarnings(new Setting<?>[] { XPackSettings.SQL_ENABLED } );
}
}
@SuppressWarnings("unchecked")
@ -101,11 +109,11 @@ public class SqlFeatureSetTests extends ESTestCase {
PlainActionFuture<SqlFeatureSet.Usage> future = new PlainActionFuture<>();
new SqlFeatureSet(Settings.EMPTY, licenseState, client).usage(future);
SqlFeatureSetUsage sqlUsage = (SqlFeatureSetUsage) future.get();
long fooBarBaz = ObjectPath.eval("foo.bar.baz", sqlUsage.stats());
long fooFoo = ObjectPath.eval("foo.foo", sqlUsage.stats());
long spam = ObjectPath.eval("spam", sqlUsage.stats());
assertThat(sqlUsage.stats().keySet(), containsInAnyOrder("foo", "spam"));
assertThat(fooBarBaz, is(5L));
assertThat(fooFoo, is(1L));

View File

@ -11,10 +11,12 @@ import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.settings.ClusterSettings;
import org.elasticsearch.common.settings.IndexScopedSettings;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.settings.SettingsFilter;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.sql.session.Cursors;
import java.util.Collections;
@ -34,5 +36,6 @@ public class SqlPluginTests extends ESTestCase {
new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS),
IndexScopedSettings.DEFAULT_SCOPED_SETTINGS, new SettingsFilter(Collections.emptyList()),
mock(IndexNameExpressionResolver.class), () -> mock(DiscoveryNodes.class)), empty());
assertSettingDeprecationsAndWarnings(new Setting<?>[] { XPackSettings.SQL_ENABLED } );
}
}

View File

@ -30,7 +30,6 @@ testClusters.integTest {
testDistribution = 'DEFAULT'
setting 'xpack.security.enabled', 'true'
setting 'xpack.license.self_generated.type', 'trial'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.security.authc.token.enabled', 'true'
setting 'xpack.security.transport.ssl.enabled', 'true'
setting 'xpack.security.transport.ssl.key', nodeKey.name

View File

@ -10,6 +10,7 @@ import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.support.PlainActionFuture;
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
@ -23,6 +24,7 @@ import org.elasticsearch.search.aggregations.metrics.NumericMetricsAggregation;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.core.XPackFeatureSet;
import org.elasticsearch.xpack.core.XPackFeatureSet.Usage;
import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.core.transform.transforms.TransformIndexerStats;
import org.junit.Before;
@ -70,6 +72,7 @@ public class TransformFeatureSetTests extends ESTestCase {
licenseState
);
assertThat(featureSet.enabled(), is(enabled));
assertSettingDeprecationsAndWarnings(new Setting<?>[] { XPackSettings.TRANSFORM_ENABLED } );
}
public void testEnabledSettingFallback() {
@ -92,8 +95,9 @@ public class TransformFeatureSetTests extends ESTestCase {
public void testEnabledSettingFallbackMix() {
Settings.Builder settings = Settings.builder();
// use the deprecated setting
// use the older deprecated setting
settings.put("xpack.data_frame.enabled", false);
// ...and also the more recently deprecated setting
settings.put("xpack.transform.enabled", true);
TransformFeatureSet featureSet = new TransformFeatureSet(
settings.build(),
@ -104,6 +108,8 @@ public class TransformFeatureSetTests extends ESTestCase {
assertThat(featureSet.enabled(), is(true));
assertWarnings(
"[xpack.data_frame.enabled] setting was deprecated in Elasticsearch and will be removed in a future release! "
+ "See the breaking changes documentation for the next major version.",
"[xpack.transform.enabled] setting was deprecated in Elasticsearch and will be removed in a future release! "
+ "See the breaking changes documentation for the next major version."
);
}
@ -188,5 +194,6 @@ public class TransformFeatureSetTests extends ESTestCase {
assertEquals(null, XContentMapValues.extractValue("transforms", usageAsMap));
assertEquals(null, XContentMapValues.extractValue("stats", usageAsMap));
}
assertSettingDeprecationsAndWarnings(new Setting<?>[] { XPackSettings.TRANSFORM_ENABLED } );
}
}

View File

@ -6,9 +6,11 @@
package org.elasticsearch.xpack.transform;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.license.XPackLicenseState;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.core.XPackSettings;
import static org.hamcrest.Matchers.equalTo;
import static org.mockito.Mockito.mock;
@ -36,6 +38,9 @@ public class TransformTests extends ESTestCase {
transformPluginEnabled && transformEnabled,
Boolean.parseBoolean(transform.additionalSettings().get("node.attr.transform.node"))
);
if (transformPluginEnabled == false) {
assertSettingDeprecationsAndWarnings(new Setting<?>[]{XPackSettings.TRANSFORM_ENABLED});
}
}
public void testNodeAttributesDirectlyGiven() {

View File

@ -13,10 +13,12 @@ import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.license.XPackLicenseState;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.core.XPackFeatureSet;
import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.core.vectors.VectorsFeatureSetUsage;
import org.junit.Before;
import org.mockito.Mockito;
@ -55,12 +57,15 @@ public class VectorsFeatureSetTests extends ESTestCase {
public void testEnabled() throws Exception {
boolean enabled = randomBoolean();
Settings.Builder settings = Settings.builder();
boolean isExplicitlySet = false;
if (enabled) {
if (randomBoolean()) {
settings.put("xpack.vectors.enabled", enabled);
isExplicitlySet = true;
}
} else {
settings.put("xpack.vectors.enabled", enabled);
isExplicitlySet = true;
}
VectorsFeatureSet featureSet = new VectorsFeatureSet(settings.build(), licenseState, clusterService);
assertEquals(enabled, featureSet.enabled());
@ -73,6 +78,9 @@ public class VectorsFeatureSetTests extends ESTestCase {
usage.writeTo(out);
XPackFeatureSet.Usage serializedUsage = new VectorsFeatureSetUsage(out.bytes().streamInput());
assertEquals(enabled, serializedUsage.enabled());
if (isExplicitlySet) {
assertSettingDeprecationsAndWarnings(new Setting<?>[] { XPackSettings.VECTORS_ENABLED } );
}
}
public void testUsageStats() throws Exception {
@ -93,11 +101,9 @@ public class VectorsFeatureSetTests extends ESTestCase {
Mockito.when(clusterService.state()).thenReturn(clusterState);
when(licenseState.isVectorsAllowed()).thenReturn(true);
Settings.Builder settings = Settings.builder();
settings.put("xpack.vectors.enabled", true);
PlainActionFuture<XPackFeatureSet.Usage> future = new PlainActionFuture<>();
VectorsFeatureSet vectorsFeatureSet = new VectorsFeatureSet(settings.build(), licenseState, clusterService);
VectorsFeatureSet vectorsFeatureSet = new VectorsFeatureSet(Settings.EMPTY, licenseState, clusterService);
vectorsFeatureSet.usage(future);
VectorsFeatureSetUsage vectorUsage = (VectorsFeatureSetUsage) future.get();
assertEquals(true, vectorUsage.enabled());

View File

@ -22,7 +22,7 @@ artifacts {
restResources {
restApi {
includeCore '_common', 'cluster', 'nodes', 'search', 'get', 'indices',
includeCore '_common', 'cluster', 'nodes', 'search', 'get', 'indices',
'index', 'put_script', 'ingest', 'count'
includeXpack 'watcher', 'xpack'
}
@ -30,10 +30,7 @@ restResources {
testClusters.integTest {
testDistribution = 'DEFAULT'
setting 'xpack.slm.enabled', 'false'
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.security.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
setting 'logger.org.elasticsearch.xpack.watcher', 'DEBUG'

View File

@ -2,9 +2,6 @@
# See https://github.com/elastic/x-plugins/issues/4237
---
"Test transform scripts are updated on execution":
- skip:
features: warnings
- do:
cluster.health:
wait_for_status: yellow
@ -77,9 +74,6 @@
---
"Test condition scripts are updated on execution":
- skip:
features: warnings
- do:
cluster.health:
wait_for_status: yellow

View File

@ -8,9 +8,6 @@ dependencies {
testClusters.integTest {
testDistribution = 'DEFAULT'
setting 'xpack.slm.enabled', 'false'
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.monitoring.enabled', 'true'
setting 'xpack.monitoring.collection.enabled', 'true'
setting 'xpack.monitoring.collection.interval', '1s'
setting 'xpack.watcher.enabled', 'true'

View File

@ -19,8 +19,6 @@ restResources {
testClusters.integTest {
testDistribution = 'DEFAULT'
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.security.enabled', 'true'
// settings to test settings filtering on

View File

@ -24,6 +24,7 @@ import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.collect.ImmutableOpenMap;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.common.util.concurrent.ThreadContext;
@ -154,6 +155,7 @@ public class WatcherIndexTemplateRegistryTests extends ESTestCase {
verify(client.admin().indices(), times(5)).putTemplate(captor.capture(), anyObject());
captor.getAllValues().forEach(req -> assertNull(req.settings().get("index.lifecycle.name")));
verify(client, times(0)).execute(eq(PutLifecycleAction.INSTANCE), anyObject(), anyObject());
assertSettingDeprecationsAndWarnings(new Setting[]{XPackSettings.INDEX_LIFECYCLE_ENABLED});
}
public void testThatNonExistingPoliciesAreAddedImmediately() {
@ -191,6 +193,7 @@ public class WatcherIndexTemplateRegistryTests extends ESTestCase {
ClusterChangedEvent event = createClusterChangedEvent(Settings.EMPTY, Collections.emptyMap(), Collections.emptyMap(), nodes);
registry.clusterChanged(event);
verify(client, times(0)).execute(eq(PutLifecycleAction.INSTANCE), anyObject(), anyObject());
assertSettingDeprecationsAndWarnings(new Setting<?>[]{XPackSettings.INDEX_LIFECYCLE_ENABLED});
}
public void testPolicyAlreadyExistsButDiffers() throws IOException {

View File

@ -27,10 +27,8 @@ integTest {
testClusters.integTest {
testDistribution = 'DEFAULT'
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.security.enabled', 'true'
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'

View File

@ -24,10 +24,8 @@ testClusters.'remote-cluster' {
testDistribution = 'DEFAULT'
numberOfNodes = 2
setting 'node.remote_cluster_client', "false"
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.security.enabled', 'true'
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
@ -46,7 +44,6 @@ testClusters.'mixed-cluster' {
testDistribution = 'DEFAULT'
setting 'xpack.security.enabled', 'true'
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
setting 'cluster.remote.my_remote_cluster.seeds', {

View File

@ -25,10 +25,8 @@ testClusters.'remote-cluster' {
testDistribution = 'DEFAULT'
numberOfNodes = 2
setting 'node.remote_cluster_client', "false"
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.security.enabled', 'true'
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
user username: "test_user", password: "x-pack-test-password"
@ -46,7 +44,6 @@ testClusters.'mixed-cluster' {
testDistribution = 'DEFAULT'
setting 'xpack.security.enabled', 'true'
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
setting 'cluster.remote.my_remote_cluster.seeds', {
testClusters.'remote-cluster'.getAllTransportPortURI().collect { "\"$it\"" }.toString()

View File

@ -9,10 +9,8 @@ dependencies {
testClusters.integTest {
testDistribution = 'DEFAULT'
numberOfNodes = 2
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.security.enabled', 'true'
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
extraConfigFile 'roles.yml', file('roles.yml')

View File

@ -27,7 +27,6 @@ testClusters.integTest {
extraConfigFile 'http.crt', file('src/test/resources/ssl/http.crt')
extraConfigFile 'ca.p12', caFile
setting 'reindex.remote.whitelist', '127.0.0.1:*'
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.security.enabled', 'true'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'

View File

@ -20,7 +20,6 @@ for (Version bwcVersion : bwcVersions.wireCompatible) {
setting 'repositories.url.allowed_urls', 'http://snapshot.test*'
setting 'xpack.security.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.license.self_generated.type', 'basic'

View File

@ -26,7 +26,6 @@ for (Version bwcVersion : bwcVersions.wireCompatible) {
setting 'repositories.url.allowed_urls', 'http://snapshot.test*'
setting 'xpack.security.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'

View File

@ -20,7 +20,6 @@ integTest.runner {
testClusters.integTest {
testDistribution = "default"
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.security.enabled', 'true'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'

View File

@ -31,9 +31,7 @@ testClusters.integTest {
setting 'xpack.security.authc.realms.native.native.order', '2'
setting 'xpack.security.authc.realms.custom_role_mapping.role_map.order', '3'
setting 'xpack.security.enabled', 'true'
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
user username: "test_user", password: "x-pack-test-password"

View File

@ -53,7 +53,6 @@ testClusters.integTest {
setting 'xpack.security.http.ssl.certificate_authorities', 'testnode.crt'
keystore 'xpack.security.http.ssl.secure_key_passphrase', 'testnode'
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
// copy keystores, keys and certificates into config/
extraConfigFile nodeKeystore.name, nodeKeystore

View File

@ -15,7 +15,6 @@ restResources {
testClusters.integTest {
testDistribution = 'DEFAULT'
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.security.enabled', 'true'
setting 'xpack.license.self_generated.type', 'trial'
user username: "test_admin", password: "x-pack-test-password"

View File

@ -43,7 +43,6 @@ if (!jiraUrl && !jiraUser && !jiraPassword && !jiraProject) {
testClusters.integTest {
testDistribution = 'DEFAULT'
setting 'xpack.security.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
setting 'logger.org.elasticsearch.xpack.watcher', 'DEBUG'

View File

@ -22,7 +22,6 @@ if (!pagerDutyServiceKey) {
testClusters.integTest {
testDistribution = 'DEFAULT'
setting 'xpack.security.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
setting 'logger.org.elasticsearch.xpack.watcher', 'DEBUG'

View File

@ -22,7 +22,6 @@ if (!slackUrl) {
testClusters.integTest {
testDistribution = 'DEFAULT'
setting 'xpack.security.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
setting 'logger.org.elasticsearch.xpack.watcher', 'DEBUG'