check position before and after latch (#42623)

check position before and after latch

#fixes 42084
This commit is contained in:
Hendrik Muhs 2019-05-28 20:37:30 +02:00
parent e54e74852a
commit ace96a2b6e
1 changed files with 3 additions and 3 deletions

View File

@ -225,7 +225,6 @@ public class AsyncTwoPhaseIndexerTests extends ESTestCase {
}
}
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/42084")
public void testStateMachine() throws Exception {
AtomicReference<IndexerState> state = new AtomicReference<>(IndexerState.STOPPED);
final ExecutorService executor = Executors.newFixedThreadPool(1);
@ -236,10 +235,11 @@ public class AsyncTwoPhaseIndexerTests extends ESTestCase {
assertThat(indexer.getState(), equalTo(IndexerState.STARTED));
assertTrue(indexer.maybeTriggerAsyncJob(System.currentTimeMillis()));
assertThat(indexer.getState(), equalTo(IndexerState.INDEXING));
assertTrue(awaitBusy(() -> indexer.getPosition() == 2));
countDownLatch.countDown();
assertThat(indexer.getPosition(), equalTo(2));
assertTrue(awaitBusy(() -> isFinished.get()));
assertThat(indexer.getPosition(), equalTo(3));
assertFalse(isStopped.get());
assertThat(indexer.getStep(), equalTo(6));
assertThat(indexer.getStats().getNumInvocations(), equalTo(1L));