diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexing/AsyncTwoPhaseIndexerTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexing/AsyncTwoPhaseIndexerTests.java index 39a8807c2d59c..f7f97288b2381 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexing/AsyncTwoPhaseIndexerTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexing/AsyncTwoPhaseIndexerTests.java @@ -39,7 +39,7 @@ private class MockIndexer extends AsyncTwoPhaseIndexer { private final CountDownLatch latch; // test the execution order - private int step; + private volatile int step; protected MockIndexer(Executor executor, AtomicReference initialState, Integer initialPosition, CountDownLatch latch) { @@ -113,8 +113,8 @@ protected void onFailure(Exception exc) { protected void onFinish(ActionListener listener) { assertThat(step, equalTo(4)); ++step; - isFinished.set(true); listener.onResponse(null); + isFinished.set(true); } @Override @@ -206,8 +206,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws } } - @AwaitsFix( bugUrl = "https://github.com/elastic/elasticsearch/issues/40946") - public void testStateMachine() throws InterruptedException { + public void testStateMachine() throws Exception { AtomicReference state = new AtomicReference<>(IndexerState.STOPPED); final ExecutorService executor = Executors.newFixedThreadPool(1); isFinished.set(false);