Fix CoordinatorTests some more (#34039)

Today the `CoordinatorTests` are not completely reliable. These changes make
them more so, by removing a couple of assertions that we do not expect to pass
(yet).
This commit is contained in:
David Turner 2018-09-25 14:04:22 +01:00 committed by GitHub
parent 679fb698d0
commit f886eebd99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 13 deletions

View File

@ -502,6 +502,7 @@ public class Coordinator extends AbstractLifecycleComponent implements Discovery
: "onPossibleCompletion: term or version mismatch when publishing [" + this
+ "]: current version is now [" + coordinationState.get().getLastAcceptedVersion()
+ "] in term [" + coordinationState.get().getLastAcceptedTerm() + "]";
assert committed;
// TODO: send to applier
ackListener.onNodeAck(getLocalNode(), null);
@ -511,7 +512,6 @@ public class Coordinator extends AbstractLifecycleComponent implements Discovery
@Override
public void onFailure(Exception e) {
assert Thread.holdsLock(mutex) : "Coordinator mutex not held";
assert committed == false;
if (publishRequest.getAcceptedState().term() == coordinationState.get().getCurrentTerm() &&
publishRequest.getAcceptedState().version() == coordinationState.get().getLastPublishedVersion()) {
becomeCandidate("Publication.onCompletion(false)");

View File

@ -307,11 +307,7 @@ public abstract class Publication extends AbstractComponent {
public void onFailure(Exception e) {
assert e instanceof TransportException;
final TransportException exp = (TransportException) e;
if (exp.getRootCause() instanceof CoordinationStateRejectedException) {
logger.debug("PublishResponseHandler: [{}] failed: {}", discoveryNode, exp.getRootCause().getMessage());
} else {
logger.debug(() -> new ParameterizedMessage("PublishResponseHandler: [{}] failed", discoveryNode), exp);
}
logger.debug(() -> new ParameterizedMessage("PublishResponseHandler: [{}] failed", discoveryNode), exp);
assert ((TransportException) e).getRootCause() instanceof Exception;
setFailed((Exception) exp.getRootCause());
onPossibleCommitFailure();
@ -338,11 +334,7 @@ public abstract class Publication extends AbstractComponent {
public void onFailure(Exception e) {
assert e instanceof TransportException;
final TransportException exp = (TransportException) e;
if (exp.getRootCause() instanceof CoordinationStateRejectedException) {
logger.debug("ApplyCommitResponseHandler: [{}] failed: {}", discoveryNode, exp.getRootCause().getMessage());
} else {
logger.debug(() -> new ParameterizedMessage("ApplyCommitResponseHandler: [{}] failed", discoveryNode), exp);
}
logger.debug(() -> new ParameterizedMessage("ApplyCommitResponseHandler: [{}] failed", discoveryNode), exp);
assert ((TransportException) e).getRootCause() instanceof Exception;
setFailed((Exception) exp.getRootCause());
onPossibleCompletion();

View File

@ -183,8 +183,7 @@ public class CoordinatorTests extends ESTestCase {
final String nodeId = clusterNode.getId();
assertThat(nodeId + " has the same term as the leader", clusterNode.coordinator.getCurrentTerm(), is(leaderTerm));
assertTrue("leader " + leader.getId() + " should have received a vote from " + nodeId,
leader.coordinator.hasJoinVoteFrom(clusterNode.getLocalNode()));
// TODO assert that all nodes have actually voted for the leader in this term
assertThat(nodeId + " is a follower", clusterNode.coordinator.getMode(), is(FOLLOWER));
assertThat(nodeId + " is at the same accepted version as the leader",