From 55448b2630d8ba680cc698e62b6e2de3f799d1c3 Mon Sep 17 00:00:00 2001 From: Ke Li Date: Mon, 12 Feb 2018 18:33:19 +0800 Subject: [PATCH] [Tests] Remove unnecessary condition check (#28559) The condition value in question is true, regardless of the randomBoolean() value. This change simplifies this removing the condition blocks. --- .../elasticsearch/index/shard/IndexShardTests.java | 12 ++++++------ .../search/aggregations/bucket/GeoDistanceIT.java | 4 +--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/server/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java b/server/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java index 1370dad06d7..1f5c4b0ec7b 100644 --- a/server/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java +++ b/server/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java @@ -1146,12 +1146,12 @@ public class IndexShardTests extends IndexShardTestCase { assertEquals(shard.shardPath().getRootStatePath().toString(), stats.getStatePath()); assertEquals(shard.shardPath().isCustomDataPath(), stats.isCustomDataPath()); - if (randomBoolean() || true) { // try to serialize it to ensure values survive the serialization - BytesStreamOutput out = new BytesStreamOutput(); - stats.writeTo(out); - StreamInput in = out.bytes().streamInput(); - stats = ShardStats.readShardStats(in); - } + // try to serialize it to ensure values survive the serialization + BytesStreamOutput out = new BytesStreamOutput(); + stats.writeTo(out); + StreamInput in = out.bytes().streamInput(); + stats = ShardStats.readShardStats(in); + XContentBuilder builder = jsonBuilder(); builder.startObject(); stats.toXContent(builder, EMPTY_PARAMS); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GeoDistanceIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GeoDistanceIT.java index 032bb8d5914..c50fb89f334 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GeoDistanceIT.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GeoDistanceIT.java @@ -121,9 +121,7 @@ public class GeoDistanceIT extends ESIntegTestCase { // random cities with no location for (String cityName : Arrays.asList("london", "singapour", "tokyo", "milan")) { - if (randomBoolean() || true) { - cities.add(indexCity("idx-multi", cityName)); - } + cities.add(indexCity("idx-multi", cityName)); } indexRandom(true, cities); prepareCreate("empty_bucket_idx")