Simplify cluster state task execution ordering test

This commit is contained in:
Jason Tedor 2015-12-29 20:45:54 -05:00
parent 270b08b302
commit 18b42ce798
1 changed files with 3 additions and 3 deletions

View File

@ -806,13 +806,13 @@ public class ClusterServiceIT extends ESIntegTestCase {
ClusterService clusterService = internalCluster().getInstance(ClusterService.class); ClusterService clusterService = internalCluster().getInstance(ClusterService.class);
class TaskExecutor implements ClusterStateTaskExecutor<Integer> { class TaskExecutor implements ClusterStateTaskExecutor<Integer> {
int tracking = -1; int tracking = 0;
@Override @Override
public BatchResult<Integer> execute(ClusterState currentState, List<Integer> tasks) throws Exception { public BatchResult<Integer> execute(ClusterState currentState, List<Integer> tasks) throws Exception {
for (Integer task : tasks) { for (Integer task : tasks) {
try { try {
assertEquals("task was executed out of order", tracking + 1, (int)task); assertEquals("task was executed out of order", tracking, (int)task);
tracking++; tracking++;
} catch (AssertionError e) { } catch (AssertionError e) {
return BatchResult.<Integer>builder().failures(tasks, e).build(currentState); return BatchResult.<Integer>builder().failures(tasks, e).build(currentState);
@ -886,7 +886,7 @@ public class ClusterServiceIT extends ESIntegTestCase {
assertFalse(failure.get()); assertFalse(failure.get());
for (int i = 0; i < numberOfThreads; i++) { for (int i = 0; i < numberOfThreads; i++) {
assertEquals(tasksSubmittedPerThread - 1, executors[i].tracking); assertEquals(tasksSubmittedPerThread, executors[i].tracking);
} }
} }