mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-02 00:49:11 +00:00
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:
parent
679fb698d0
commit
f886eebd99
@ -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)");
|
||||
|
@ -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();
|
||||
|
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user