re-enabled test with added logging to have more info when it fails.

This commit is contained in:
Martijn van Groningen 2018-12-10 13:15:15 +01:00
parent ca916f7186
commit 38a1d4fcdb
No known key found for this signature in database
GPG Key ID: AB236F4FCF2AF12A
1 changed files with 28 additions and 15 deletions

View File

@ -20,6 +20,7 @@
package org.elasticsearch.client;
import org.apache.http.util.EntityUtils;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse;
import org.elasticsearch.action.admin.indices.close.CloseIndexRequest;
@ -36,6 +37,7 @@ import org.elasticsearch.client.ccr.FollowStatsRequest;
import org.elasticsearch.client.ccr.FollowStatsResponse;
import org.elasticsearch.client.ccr.GetAutoFollowPatternRequest;
import org.elasticsearch.client.ccr.GetAutoFollowPatternResponse;
import org.elasticsearch.client.ccr.IndicesFollowStats;
import org.elasticsearch.client.ccr.IndicesFollowStats.ShardFollowStats;
import org.elasticsearch.client.ccr.PauseFollowRequest;
import org.elasticsearch.client.ccr.PutAutoFollowPatternRequest;
@ -85,7 +87,6 @@ public class CCRIT extends ESRestHighLevelClientTestCase {
});
}
@AwaitsFix(bugUrl="https://github.com/elastic/elasticsearch/issues/36339")
public void testIndexFollowing() throws Exception {
CcrClient ccrClient = highLevelClient().ccr();
@ -109,21 +110,33 @@ public class CCRIT extends ESRestHighLevelClientTestCase {
SearchResponse leaderSearchResponse = highLevelClient().search(leaderSearchRequest, RequestOptions.DEFAULT);
assertThat(leaderSearchResponse.getHits().getTotalHits().value, equalTo(1L));
assertBusy(() -> {
FollowStatsRequest followStatsRequest = new FollowStatsRequest("follower");
FollowStatsResponse followStatsResponse =
execute(followStatsRequest, ccrClient::getFollowStats, ccrClient::getFollowStatsAsync);
List<ShardFollowStats> shardFollowStats = followStatsResponse.getIndicesFollowStats().getShardFollowStats("follower");
long followerGlobalCheckpoint = shardFollowStats.stream()
.mapToLong(ShardFollowStats::getFollowerGlobalCheckpoint)
.max()
.getAsLong();
assertThat(followerGlobalCheckpoint, equalTo(0L));
try {
assertBusy(() -> {
FollowStatsRequest followStatsRequest = new FollowStatsRequest("follower");
FollowStatsResponse followStatsResponse =
execute(followStatsRequest, ccrClient::getFollowStats, ccrClient::getFollowStatsAsync);
List<ShardFollowStats> shardFollowStats = followStatsResponse.getIndicesFollowStats().getShardFollowStats("follower");
long followerGlobalCheckpoint = shardFollowStats.stream()
.mapToLong(ShardFollowStats::getFollowerGlobalCheckpoint)
.max()
.getAsLong();
assertThat(followerGlobalCheckpoint, equalTo(0L));
SearchRequest followerSearchRequest = new SearchRequest("follower");
SearchResponse followerSearchResponse = highLevelClient().search(followerSearchRequest, RequestOptions.DEFAULT);
assertThat(followerSearchResponse.getHits().getTotalHits().value, equalTo(1L));
});
SearchRequest followerSearchRequest = new SearchRequest("follower");
SearchResponse followerSearchResponse = highLevelClient().search(followerSearchRequest, RequestOptions.DEFAULT);
assertThat(followerSearchResponse.getHits().getTotalHits().value, equalTo(1L));
});
} catch (Exception e) {
IndicesFollowStats followStats = ccrClient.getCcrStats(new CcrStatsRequest(), RequestOptions.DEFAULT).getIndicesFollowStats();
for (Map.Entry<String, List<ShardFollowStats>> entry : followStats.getShardFollowStats().entrySet()) {
for (ShardFollowStats shardFollowStats : entry.getValue()) {
if (shardFollowStats.getFatalException() != null) {
logger.warn(new ParameterizedMessage("fatal shard follow exception {}", shardFollowStats.getShardId()),
shardFollowStats.getFatalException());
}
}
}
}
PauseFollowRequest pauseFollowRequest = new PauseFollowRequest("follower");
AcknowledgedResponse pauseFollowResponse = execute(pauseFollowRequest, ccrClient::pauseFollow, ccrClient::pauseFollowAsync);