From f41eccc7a50a3b09e4154513cf17dfb808f4ac90 Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Wed, 13 Feb 2013 14:28:16 +0100 Subject: [PATCH] updating non dynamic settings throws an error now --- .../indices/settings/UpdateSettingsTests.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/elasticsearch/test/integration/indices/settings/UpdateSettingsTests.java b/src/test/java/org/elasticsearch/test/integration/indices/settings/UpdateSettingsTests.java index e43c586d5af..e7de48556b8 100644 --- a/src/test/java/org/elasticsearch/test/integration/indices/settings/UpdateSettingsTests.java +++ b/src/test/java/org/elasticsearch/test/integration/indices/settings/UpdateSettingsTests.java @@ -19,6 +19,7 @@ package org.elasticsearch.test.integration.indices.settings; +import org.elasticsearch.ElasticSearchIllegalArgumentException; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.test.integration.AbstractNodesTests; @@ -52,16 +53,30 @@ public class UpdateSettingsTests extends AbstractNodesTests { client("node1").admin().indices().prepareCreate("test").execute().actionGet(); + try { + client("node1").admin().indices().prepareUpdateSettings("test") + .setSettings(ImmutableSettings.settingsBuilder() + .put("index.refresh_interval", -1) // this one can change + .put("index.cache.filter.type", "none") // this one can't + ) + .execute().actionGet(); + assert false; + } catch (ElasticSearchIllegalArgumentException e) { + // all is well + } + + IndexMetaData indexMetaData = client("node1").admin().cluster().prepareState().execute().actionGet().getState().metaData().index("test"); + assertThat(indexMetaData.settings().get("index.refresh_interval"), nullValue()); + assertThat(indexMetaData.settings().get("index.cache.filter.type"), nullValue()); + client("node1").admin().indices().prepareUpdateSettings("test") .setSettings(ImmutableSettings.settingsBuilder() .put("index.refresh_interval", -1) // this one can change - .put("index.cache.filter.type", "none") // this one can't ) .execute().actionGet(); - IndexMetaData indexMetaData = client("node1").admin().cluster().prepareState().execute().actionGet().getState().metaData().index("test"); + indexMetaData = client("node1").admin().cluster().prepareState().execute().actionGet().getState().metaData().index("test"); assertThat(indexMetaData.settings().get("index.refresh_interval"), equalTo("-1")); - assertThat(indexMetaData.settings().get("index.cache.filter.type"), nullValue()); // now close the index, change the non dynamic setting, and see that it applies