diff --git a/server/src/internalClusterTest/java/org/elasticsearch/cluster/routing/allocation/ShardsAvailabilityHealthIndicatorServiceIT.java b/server/src/internalClusterTest/java/org/elasticsearch/cluster/routing/allocation/ShardsAvailabilityHealthIndicatorServiceIT.java index ba96f77166e95..e85edc5805482 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/cluster/routing/allocation/ShardsAvailabilityHealthIndicatorServiceIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/cluster/routing/allocation/ShardsAvailabilityHealthIndicatorServiceIT.java @@ -103,6 +103,23 @@ public void testIsGreenDuringIndexClone() { }); } + @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/99951") + public void testIsGreenDuringOpeningAndClosingIndex() { + + internalCluster().ensureAtLeastNumDataNodes(2); + + var index = randomIdentifier(); + prepareCreate(index).setSettings(indexSettings(1, 1)).get(); + ensureGreen(index); + + assertHealthDuring(equalTo(GREEN), () -> { + indicesAdmin().prepareClose(index).get(); + ensureGreen(index); + indicesAdmin().prepareClose(index).get(); + ensureGreen(index); + }); + } + private void assertHealthDuring(Matcher statusMatcher, Runnable action) { var clusterService = internalCluster().getCurrentMasterNodeInstance(ClusterService.class); var allocationService = internalCluster().getCurrentMasterNodeInstance(AllocationService.class);