Browse Source

fix a timing issue: isFinished is used for a busy loop in testing, (#41055)

test: ensure state is persisted before the isFinished is changed

fixes #41046
Hendrik Muhs 6 years ago
parent
commit
43ba344d19

+ 2 - 3
x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/rollup/job/RollupIndexerStateTests.java

@@ -256,7 +256,6 @@ public class RollupIndexerStateTests extends ESTestCase {
         }
     }
 
-    @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/41046")
     public void testIndexing() throws Exception {
         RollupJob job = new RollupJob(ConfigTestHelpers.randomRollupJobConfig(random()), Collections.emptyMap());
         AtomicReference<IndexerState> state = new AtomicReference<>(IndexerState.STOPPED);
@@ -267,8 +266,8 @@ public class RollupIndexerStateTests extends ESTestCase {
                 @Override
                 protected void onFinish(ActionListener<Void> listener) {
                     super.onFinish(ActionListener.wrap(r -> {
-                        isFinished.set(true);
                         listener.onResponse(r);
+                        isFinished.set(true);
                     }, listener::onFailure));
                 }
             };
@@ -316,8 +315,8 @@ public class RollupIndexerStateTests extends ESTestCase {
                 @Override
                 protected void onFinish(ActionListener<Void> listener) {
                     super.onFinish(ActionListener.wrap(r -> {
-                        isFinished.set(true);
                         listener.onResponse(r);
+                        isFinished.set(true);
                     }, listener::onFailure));
                 }
             };