From b0a8abeb88c9a6a2eeb6995439f5b7892e432be6 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Sat, 2 Nov 2013 09:15:37 +0100 Subject: [PATCH] Add missing .get() call to actually execute the update setting in RecoveryWhileUnderLoadTests --- .../elasticsearch/recovery/RecoveryWhileUnderLoadTests.java | 3 ++- .../test/hamcrest/ElasticsearchAssertions.java | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/elasticsearch/recovery/RecoveryWhileUnderLoadTests.java b/src/test/java/org/elasticsearch/recovery/RecoveryWhileUnderLoadTests.java index fb2bf9cd113..dce69d22a44 100644 --- a/src/test/java/org/elasticsearch/recovery/RecoveryWhileUnderLoadTests.java +++ b/src/test/java/org/elasticsearch/recovery/RecoveryWhileUnderLoadTests.java @@ -22,6 +22,7 @@ package org.elasticsearch.recovery; import com.google.common.base.Predicate; import org.apache.lucene.util.LuceneTestCase.Slow; import org.elasticsearch.action.admin.indices.refresh.RefreshResponse; +import org.elasticsearch.action.admin.indices.settings.UpdateSettingsResponse; import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse; import org.elasticsearch.action.admin.indices.stats.ShardStats; import org.elasticsearch.action.search.SearchResponse; @@ -364,7 +365,7 @@ public class RecoveryWhileUnderLoadTests extends AbstractIntegrationTest { logger.info("--> indexing threads stopped"); logger.info("--> bump up number of replicas to 1 and allow all nodes to hold the index"); allowNodes("test", 3); - client().admin().indices().prepareUpdateSettings("test").setSettings(ImmutableSettings.settingsBuilder().put("number_of_replicas", 1)); + assertAcked(client().admin().indices().prepareUpdateSettings("test").setSettings(ImmutableSettings.settingsBuilder().put("number_of_replicas", 1)).get()); assertThat(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setTimeout("1m").setWaitForGreenStatus().execute().actionGet().isTimedOut(), equalTo(false)); logger.info("--> refreshing the index"); diff --git a/src/test/java/org/elasticsearch/test/hamcrest/ElasticsearchAssertions.java b/src/test/java/org/elasticsearch/test/hamcrest/ElasticsearchAssertions.java index c941076842d..67f5e4a3651 100644 --- a/src/test/java/org/elasticsearch/test/hamcrest/ElasticsearchAssertions.java +++ b/src/test/java/org/elasticsearch/test/hamcrest/ElasticsearchAssertions.java @@ -36,6 +36,7 @@ import org.elasticsearch.action.count.CountResponse; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.ShardSearchFailure; import org.elasticsearch.action.support.broadcast.BroadcastOperationResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.io.stream.BytesStreamInput; import org.elasticsearch.common.io.stream.BytesStreamOutput; @@ -63,6 +64,11 @@ import static org.junit.Assert.fail; */ public class ElasticsearchAssertions { + public static void assertAcked(AcknowledgedResponse response) { + assertThat(response.getClass().getSimpleName() + " failed - not acked", response.isAcknowledged(), equalTo(true)); + assertVersionSerializable(response); + } + public static void assertAcked(PutMappingRequestBuilder builder) { assertAcked(builder.get()); }