浏览代码

Fix testTurnOffTranslogRetentionAfterAllShardStarted

We turn off the translog retention policy asynchronously using
 the generic threadpool; hence, we need to assert busily here

Relates #49448
Nhat Nguyen 5 年之前
父节点
当前提交
0de746468a

+ 6 - 3
server/src/test/java/org/elasticsearch/index/replication/RetentionLeasesReplicationTests.java

@@ -163,9 +163,12 @@ public class RetentionLeasesReplicationTests extends ESIndexLevelReplicationTest
             }
             group.syncGlobalCheckpoint();
             group.flush();
-            for (IndexShard shard : group) {
-                assertThat(shard.translogStats().estimatedNumberOfOperations(), equalTo(0));
-            }
+            assertBusy(() -> {
+                // we turn off the translog retention policy using the generic threadPool
+                for (IndexShard shard : group) {
+                    assertThat(shard.translogStats().estimatedNumberOfOperations(), equalTo(0));
+                }
+            });
         }
     }