-
Notifications
You must be signed in to change notification settings - Fork 25k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not add index event listener if CCR disabled (#37432)
Currently we add the CcrRestoreSourceService as a index event listener. However, if ccr is disabled, this service is null and we attempt to add a null listener throwing an exception. This commit only adds the listener if ccr is enabled.
- Loading branch information
1 parent
cd41289
commit fe753ee
Showing
2 changed files
with
48 additions
and
1 deletion.
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
45 changes: 45 additions & 0 deletions
45
x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CcrDisabledIT.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,45 @@ | ||
/* | ||
* 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.ccr; | ||
|
||
import org.elasticsearch.common.settings.Settings; | ||
import org.elasticsearch.plugins.Plugin; | ||
import org.elasticsearch.test.ESIntegTestCase; | ||
import org.elasticsearch.xpack.core.XPackClientPlugin; | ||
import org.elasticsearch.xpack.core.XPackSettings; | ||
|
||
import java.util.Collection; | ||
import java.util.Collections; | ||
|
||
public class CcrDisabledIT extends ESIntegTestCase { | ||
|
||
public void testClusterCanStartWithCcrInstalledButNotEnabled() throws Exception { | ||
// TODO: Assert that x-pack ccr feature is not enabled once feature functionality has been added | ||
ensureGreen(); | ||
} | ||
|
||
@Override | ||
protected Settings nodeSettings(int nodeOrdinal) { | ||
return Settings.builder().put(super.nodeSettings(nodeOrdinal)).put(XPackSettings.CCR_ENABLED_SETTING.getKey(), true) | ||
.put(XPackSettings.SECURITY_ENABLED.getKey(), false).build(); | ||
} | ||
|
||
@Override | ||
protected Settings transportClientSettings() { | ||
return Settings.builder().put(super.transportClientSettings()).put(XPackSettings.SECURITY_ENABLED.getKey(), false).build(); | ||
} | ||
|
||
@Override | ||
protected Collection<Class<? extends Plugin>> nodePlugins() { | ||
return Collections.singletonList(LocalStateCcr.class); | ||
} | ||
|
||
@Override | ||
protected Collection<Class<? extends Plugin>> transportClientPlugins() { | ||
return Collections.singletonList(XPackClientPlugin.class); | ||
} | ||
} |