Skip to content

Commit

Permalink
also check ccr stats api return empty response in ensureNoCcrTasks()
Browse files Browse the repository at this point in the history
If this fails then it returns more detailed information, for example
fatal error.
  • Loading branch information
martijnvg committed Feb 18, 2019
1 parent b6a7e99 commit 31163f0
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.core.ccr.AutoFollowMetadata;
import org.elasticsearch.xpack.core.ccr.ShardFollowNodeTaskStatus;
import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction;
import org.elasticsearch.xpack.core.ccr.action.FollowStatsAction;
import org.elasticsearch.xpack.core.ccr.action.PauseFollowAction;
import org.elasticsearch.xpack.core.ccr.action.PutFollowAction;
Expand Down Expand Up @@ -375,13 +376,18 @@ protected void ensureEmptyWriteBuffers() throws Exception {
protected void pauseFollow(String... indices) throws Exception {
for (String index : indices) {
final PauseFollowAction.Request unfollowRequest = new PauseFollowAction.Request(index);
followerClient().execute(PauseFollowAction.INSTANCE, unfollowRequest).get();
assertAcked(followerClient().execute(PauseFollowAction.INSTANCE, unfollowRequest).actionGet());
}
ensureNoCcrTasks();
}

protected void ensureNoCcrTasks() throws Exception {
assertBusy(() -> {
CcrStatsAction.Response statsResponse =
followerClient().execute(CcrStatsAction.INSTANCE, new CcrStatsAction.Request()).actionGet();
assertThat("Follow stats not empty: " + Strings.toString(statsResponse.getFollowStats()),
statsResponse.getFollowStats().getStatsResponses(), empty());

final ClusterState clusterState = followerClient().admin().cluster().prepareState().get().getState();
final PersistentTasksCustomMetaData tasks = clusterState.getMetaData().custom(PersistentTasksCustomMetaData.TYPE);
assertThat(tasks.tasks(), empty());
Expand Down

0 comments on commit 31163f0

Please sign in to comment.