diff --git a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/indexlifecycle/IndexLifecycleRunnerTests.java b/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/indexlifecycle/IndexLifecycleRunnerTests.java index 565a9723c8c6c..511d0e5be1ab9 100644 --- a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/indexlifecycle/IndexLifecycleRunnerTests.java +++ b/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/indexlifecycle/IndexLifecycleRunnerTests.java @@ -385,14 +385,12 @@ public void testRunStateChangePolicyWithAsyncActionNextStep() throws Exception { ClusterState before = clusterService.state(); CountDownLatch latch = new CountDownLatch(1); step.setLatch(latch); + CountDownLatch asyncLatch = new CountDownLatch(1); + nextStep.setLatch(asyncLatch); runner.runPolicyAfterStateChange(policyName, indexMetaData); // Wait for the cluster state action step awaitLatch(latch, 5, TimeUnit.SECONDS); - - CountDownLatch asyncLatch = new CountDownLatch(1); - nextStep.setLatch(asyncLatch); - // Wait for the async action step awaitLatch(asyncLatch, 5, TimeUnit.SECONDS); ClusterState after = clusterService.state();