From e0c8a6a3eb6ab088f0ba8c3a793c9132c9819914 Mon Sep 17 00:00:00 2001 From: Boaz Leskes Date: Thu, 9 Feb 2017 23:10:23 +0200 Subject: [PATCH] Relax WaitActiveShardCountIT check of exception messages So ti wouldn't depend on BulkShardRequest.toString() --- .../elasticsearch/action/support/WaitActiveShardCountIT.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/test/java/org/elasticsearch/action/support/WaitActiveShardCountIT.java b/core/src/test/java/org/elasticsearch/action/support/WaitActiveShardCountIT.java index d307c957358..6a33b8ae1df 100644 --- a/core/src/test/java/org/elasticsearch/action/support/WaitActiveShardCountIT.java +++ b/core/src/test/java/org/elasticsearch/action/support/WaitActiveShardCountIT.java @@ -33,6 +33,7 @@ import static org.elasticsearch.common.unit.TimeValue.timeValueMillis; import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.startsWith; /** * Tests setting the active shard count for replication operations (e.g. index) operates correctly. @@ -53,7 +54,7 @@ public class WaitActiveShardCountIT extends ESIntegTestCase { fail("can't index, does not enough active shard copies"); } catch (UnavailableShardsException e) { assertThat(e.status(), equalTo(RestStatus.SERVICE_UNAVAILABLE)); - assertThat(e.getMessage(), equalTo("[test][0] Not enough active copies to meet shard count of [2] (have 1, needed 2). Timeout: [100ms], request: [BulkShardRequest to [[test][0]] containing [1] requests]")); + assertThat(e.getMessage(), startsWith("[test][0] Not enough active copies to meet shard count of [2] (have 1, needed 2). Timeout: [100ms], request:")); // but really, all is well } @@ -82,7 +83,7 @@ public class WaitActiveShardCountIT extends ESIntegTestCase { fail("can't index, not enough active shard copies"); } catch (UnavailableShardsException e) { assertThat(e.status(), equalTo(RestStatus.SERVICE_UNAVAILABLE)); - assertThat(e.getMessage(), equalTo("[test][0] Not enough active copies to meet shard count of [" + ActiveShardCount.ALL + "] (have 2, needed 3). Timeout: [100ms], request: [BulkShardRequest to [[test][0]] containing [1] requests]")); + assertThat(e.getMessage(), startsWith("[test][0] Not enough active copies to meet shard count of [" + ActiveShardCount.ALL + "] (have 2, needed 3). Timeout: [100ms], request:")); // but really, all is well }