|
@@ -12,6 +12,7 @@ import org.elasticsearch.Version;
|
|
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
|
|
import org.elasticsearch.cluster.node.DiscoveryNodeRole;
|
|
|
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
|
|
+import org.elasticsearch.common.ReferenceDocs;
|
|
|
import org.elasticsearch.common.UUIDs;
|
|
|
import org.elasticsearch.common.transport.TransportAddress;
|
|
|
import org.elasticsearch.test.ESTestCase;
|
|
@@ -59,7 +60,7 @@ public class JoinReasonServiceTests extends ESTestCase {
|
|
|
|
|
|
assertThat(
|
|
|
joinReasonService.getJoinReason(discoveryNode, LEADER),
|
|
|
- matches("joining, removed [1.2s/1234ms] ago by [" + master.getName() + "]")
|
|
|
+ matchesNeedingGuidance("joining, removed [1.2s/1234ms] ago by [" + master.getName() + "]")
|
|
|
);
|
|
|
|
|
|
joinReasonService.onNodeRemoved(discoveryNode, "test removal");
|
|
@@ -67,7 +68,7 @@ public class JoinReasonServiceTests extends ESTestCase {
|
|
|
|
|
|
assertThat(
|
|
|
joinReasonService.getJoinReason(discoveryNode, LEADER),
|
|
|
- matches("joining, removed [5.5s/5555ms] ago with reason [test removal]")
|
|
|
+ matchesNeedingGuidance("joining, removed [5.5s/5555ms] ago with reason [test removal]")
|
|
|
);
|
|
|
|
|
|
joinReasonService.onClusterStateApplied(withNode);
|
|
@@ -75,14 +76,14 @@ public class JoinReasonServiceTests extends ESTestCase {
|
|
|
|
|
|
assertThat(
|
|
|
joinReasonService.getJoinReason(discoveryNode, LEADER),
|
|
|
- matches("joining, removed [0ms] ago by [" + master.getName() + "], [2] total removals")
|
|
|
+ matchesNeedingGuidance("joining, removed [0ms] ago by [" + master.getName() + "], [2] total removals")
|
|
|
);
|
|
|
|
|
|
joinReasonService.onNodeRemoved(discoveryNode, "second test removal");
|
|
|
|
|
|
assertThat(
|
|
|
joinReasonService.getJoinReason(discoveryNode, LEADER),
|
|
|
- matches("joining, removed [0ms] ago with reason [second test removal], [2] total removals")
|
|
|
+ matchesNeedingGuidance("joining, removed [0ms] ago with reason [second test removal], [2] total removals")
|
|
|
);
|
|
|
|
|
|
final DiscoveryNode rebootedNode = new DiscoveryNode(
|
|
@@ -109,7 +110,7 @@ public class JoinReasonServiceTests extends ESTestCase {
|
|
|
|
|
|
assertThat(
|
|
|
joinReasonService.getJoinReason(rebootedNode, LEADER),
|
|
|
- matches("joining, removed [0ms] ago with reason [third test removal]")
|
|
|
+ matchesNeedingGuidance("joining, removed [0ms] ago with reason [third test removal]")
|
|
|
);
|
|
|
|
|
|
joinReasonService.onClusterStateApplied(withRebootedNode);
|
|
@@ -118,7 +119,7 @@ public class JoinReasonServiceTests extends ESTestCase {
|
|
|
|
|
|
assertThat(
|
|
|
joinReasonService.getJoinReason(rebootedNode, LEADER),
|
|
|
- matches("joining, removed [0ms] ago with reason [fourth test removal], [2] total removals")
|
|
|
+ matchesNeedingGuidance("joining, removed [0ms] ago with reason [fourth test removal], [2] total removals")
|
|
|
);
|
|
|
|
|
|
joinReasonService.onClusterStateApplied(withRebootedNode);
|
|
@@ -127,7 +128,7 @@ public class JoinReasonServiceTests extends ESTestCase {
|
|
|
|
|
|
assertThat(
|
|
|
joinReasonService.getJoinReason(discoveryNode, LEADER),
|
|
|
- matches("joining, removed [0ms] ago by [" + master.getName() + "]")
|
|
|
+ matchesNeedingGuidance("joining, removed [0ms] ago by [" + master.getName() + "]")
|
|
|
);
|
|
|
|
|
|
assertThat(
|
|
@@ -179,7 +180,10 @@ public class JoinReasonServiceTests extends ESTestCase {
|
|
|
|
|
|
// remove almost enough other nodes and verify that we're still tracking the target node
|
|
|
joinReasonService.onClusterStateApplied(almostCleanupNodes);
|
|
|
- assertThat(joinReasonService.getJoinReason(targetNode, LEADER), matches("joining, removed [1ms] ago with reason [test]"));
|
|
|
+ assertThat(
|
|
|
+ joinReasonService.getJoinReason(targetNode, LEADER),
|
|
|
+ matchesNeedingGuidance("joining, removed [1ms] ago with reason [test]")
|
|
|
+ );
|
|
|
|
|
|
// remove one more node to trigger the cleanup and forget about the target node
|
|
|
joinReasonService.onClusterStateApplied(cleanupNodes);
|
|
@@ -202,7 +206,10 @@ public class JoinReasonServiceTests extends ESTestCase {
|
|
|
}
|
|
|
|
|
|
private static Matcher<JoinReason> matches(String message) {
|
|
|
- return equalTo(new JoinReason(message));
|
|
|
+ return equalTo(new JoinReason(message, null));
|
|
|
}
|
|
|
|
|
|
+ private static Matcher<JoinReason> matchesNeedingGuidance(String message) {
|
|
|
+ return equalTo(new JoinReason(message, ReferenceDocs.UNSTABLE_CLUSTER_TROUBLESHOOTING));
|
|
|
+ }
|
|
|
}
|