Simplify test out of order commit messages

This commit is contained in:
Jason Tedor 2016-03-28 13:48:28 -04:00
parent 5576526c91
commit 4de57fc5aa
1 changed files with 3 additions and 13 deletions

View File

@ -668,19 +668,9 @@ public class PublishClusterStateActionTests extends ESTestCase {
} }
final ClusterState finalState = states.get(numOfStates - 1); final ClusterState finalState = states.get(numOfStates - 1);
Collections.shuffle(states, random());
List<ClusterState> orderedSubsequence = new ArrayList<>();
long version = 0;
for (ClusterState state : states) {
if (state.version() >= version) {
orderedSubsequence.add(state);
version = state.version();
}
}
logger.info("--> publishing states"); logger.info("--> publishing states");
for (ClusterState state : orderedSubsequence) { for (ClusterState state : states) {
node.action.handleIncomingClusterStateRequest( node.action.handleIncomingClusterStateRequest(
new BytesTransportRequest(PublishClusterStateAction.serializeFullClusterState(state, Version.CURRENT), Version.CURRENT), new BytesTransportRequest(PublishClusterStateAction.serializeFullClusterState(state, Version.CURRENT), Version.CURRENT),
channel); channel);
@ -691,8 +681,8 @@ public class PublishClusterStateActionTests extends ESTestCase {
logger.info("--> committing states"); logger.info("--> committing states");
Randomness.shuffle(orderedSubsequence); Randomness.shuffle(states);
for (ClusterState state : orderedSubsequence) { for (ClusterState state : states) {
node.action.handleCommitRequest(new PublishClusterStateAction.CommitClusterStateRequest(state.stateUUID()), channel); node.action.handleCommitRequest(new PublishClusterStateAction.CommitClusterStateRequest(state.stateUUID()), channel);
assertThat(channel.response.get(), equalTo((TransportResponse) TransportResponse.Empty.INSTANCE)); assertThat(channel.response.get(), equalTo((TransportResponse) TransportResponse.Empty.INSTANCE));
if (channel.error.get() != null) { if (channel.error.get() != null) {