Skip to content

Commit

Permalink
TEST: Index diff num docs in rolling upgrade tests (#34191)
Browse files Browse the repository at this point in the history
Today we index the same number of documents (50 documents) in each round
of the rolling upgrade tests. If the actual count does not match, we can
not guess the problematic round.

Relates #27650
  • Loading branch information
dnhatn committed Oct 2, 2018
1 parent d9ba207 commit f2a2766
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ public void testRecoveryWithConcurrentIndexing() throws Exception {
break;
case UPGRADED:
updateIndexSettings(index, Settings.builder().put(INDEX_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), (String)null));
asyncIndexDocs(index, 60, 50).get();
asyncIndexDocs(index, 60, 45).get();
ensureGreen(index);
client().performRequest(new Request("POST", index + "/_refresh"));
assertCount(index, "_only_nodes:" + nodes.get(0), 110);
assertCount(index, "_only_nodes:" + nodes.get(1), 110);
assertCount(index, "_only_nodes:" + nodes.get(2), 110);
assertCount(index, "_only_nodes:" + nodes.get(0), 105);
assertCount(index, "_only_nodes:" + nodes.get(1), 105);
assertCount(index, "_only_nodes:" + nodes.get(2), 105);
break;
default:
throw new IllegalStateException("unknown type " + CLUSTER_TYPE);
Expand All @@ -166,7 +166,7 @@ private void assertCount(final String index, final String preference, final int
request.addParameter("preference", preference);
final Response response = client().performRequest(request);
final int actualCount = Integer.parseInt(ObjectPath.createFromResponse(response).evaluate("count").toString());
assertThat(actualCount, equalTo(expectedCount));
assertThat("preference [" + preference + "]", actualCount, equalTo(expectedCount));
}


Expand Down Expand Up @@ -226,17 +226,17 @@ public void testRelocationWithConcurrentIndexing() throws Exception {
.put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 2)
.put("index.routing.allocation.include._id", (String)null)
);
asyncIndexDocs(index, 60, 50).get();
asyncIndexDocs(index, 60, 45).get();
ensureGreen(index);
client().performRequest(new Request("POST", index + "/_refresh"));
Response response = client().performRequest(new Request("GET", "_nodes"));
ObjectPath objectPath = ObjectPath.createFromResponse(response);
final Map<String, Object> nodeMap = objectPath.evaluate("nodes");
List<String> nodes = new ArrayList<>(nodeMap.keySet());

assertCount(index, "_only_nodes:" + nodes.get(0), 110);
assertCount(index, "_only_nodes:" + nodes.get(1), 110);
assertCount(index, "_only_nodes:" + nodes.get(2), 110);
assertCount(index, "_only_nodes:" + nodes.get(0), 105);
assertCount(index, "_only_nodes:" + nodes.get(1), 105);
assertCount(index, "_only_nodes:" + nodes.get(2), 105);
break;
default:
throw new IllegalStateException("unknown type " + CLUSTER_TYPE);
Expand Down

0 comments on commit f2a2766

Please sign in to comment.