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 39a8807c2d5..f7f97288b23 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 @@ public class AsyncTwoPhaseIndexerTests extends ESTestCase { 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 @@ public class AsyncTwoPhaseIndexerTests extends ESTestCase { 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 class AsyncTwoPhaseIndexerTests extends ESTestCase { } } - @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);