more tests

This commit is contained in:
Simon Willnauer 2015-12-16 20:06:43 +01:00
parent c1ff619781
commit 45b7afe14f
4 changed files with 14 additions and 2 deletions

View File

@ -43,7 +43,7 @@ public abstract class AbstractScopedSettings extends AbstractComponent {
if (entry.getScope() != scope) { if (entry.getScope() != scope) {
throw new IllegalArgumentException("Setting must be a cluster setting but was: " + entry.getScope()); throw new IllegalArgumentException("Setting must be a cluster setting but was: " + entry.getScope());
} }
if (entry.isGroupSetting()) { if (entry.hasComplexMatcher()) {
complexMatchers.put(entry.getKey(), entry); complexMatchers.put(entry.getKey(), entry);
} else { } else {
keySettings.put(entry.getKey(), entry); keySettings.put(entry.getKey(), entry);

View File

@ -92,7 +92,7 @@ public class Setting<T> extends ToXContentToBytes {
* rather than a single value. The key, see {@link #getKey()}, in contrast to non-group settings is a prefix like <tt>cluster.store.</tt> * rather than a single value. The key, see {@link #getKey()}, in contrast to non-group settings is a prefix like <tt>cluster.store.</tt>
* that matches all settings with this prefix. * that matches all settings with this prefix.
*/ */
public boolean isGroupSetting() { boolean isGroupSetting() {
return false; return false;
} }

View File

@ -235,6 +235,16 @@ public class ClusterSettingsIT extends ESIntegTestCase {
assertThat(response3.getPersistentSettings().get(key2), notNullValue()); assertThat(response3.getPersistentSettings().get(key2), notNullValue());
} }
public void testCanUpdateTracerSettings() {
ClusterUpdateSettingsResponse clusterUpdateSettingsResponse = client().admin().cluster()
.prepareUpdateSettings()
.setTransientSettings(Settings.builder().putArray("transport.tracer.include", "internal:index/shard/recovery/*",
"internal:gateway/local*"))
.get();
assertArrayEquals(clusterUpdateSettingsResponse.getTransientSettings().getAsArray("transport.tracer.include"), new String[] {"internal:index/shard/recovery/*",
"internal:gateway/local*"});
}
public void testUpdateDiscoveryPublishTimeout() { public void testUpdateDiscoveryPublishTimeout() {
DiscoverySettings discoverySettings = internalCluster().getInstance(DiscoverySettings.class); DiscoverySettings discoverySettings = internalCluster().getInstance(DiscoverySettings.class);

View File

@ -151,5 +151,7 @@ public class ScopedSettingsTests extends ESTestCase {
assertEquals(ref.get().size(), 2); assertEquals(ref.get().size(), 2);
assertTrue(ref.get().contains("internal:index/shard/recovery/*")); assertTrue(ref.get().contains("internal:index/shard/recovery/*"));
assertTrue(ref.get().contains("internal:gateway/local*")); assertTrue(ref.get().contains("internal:gateway/local*"));
assertNotNull(settings.get("transport.tracer.include." + randomIntBetween(1, 100)));
assertSame(TransportService.TRACE_LOG_INCLUDE_SETTING, settings.get("transport.tracer.include." + randomIntBetween(1, 100)));
} }
} }