Fix testMappingVersionAfterDynamicMappingUpdate (#62352) (#62360)

There is a race in this test where the index request will return
once the dynamic mapping update has been observed by the cluster
state observer internally used by the indexing but not hit all
state appliers and thus isn't showing up as the applied state returned
by `clusterService.state()` yet.
This commit is contained in:
Armin Braun 2020-09-15 11:59:22 +02:00 committed by GitHub
parent a68f7077c7
commit eae6a3b18e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -164,11 +164,11 @@ public class DynamicMappingIT extends ESIntegTestCase {
}
}
public void testMappingVersionAfterDynamicMappingUpdate() {
public void testMappingVersionAfterDynamicMappingUpdate() throws Exception {
createIndex("test");
final ClusterService clusterService = internalCluster().clusterService();
final long previousVersion = clusterService.state().metadata().index("test").getMappingVersion();
client().prepareIndex("test", "_doc").setId("1").setSource("field", "text").get();
assertThat(clusterService.state().metadata().index("test").getMappingVersion(), equalTo(1 + previousVersion));
assertBusy(() -> assertThat(clusterService.state().metadata().index("test").getMappingVersion(), equalTo(1 + previousVersion)));
}
}