Skip to content

Commit f925690

Browse files
committed
AssertBusy to check mapping in LegacyDynamicMappingIT
Dynamic mapping update of an index request no longer requires acks from all nodes. We need busily to check the mapping update. Relates #31140. Closes #37817
1 parent d124692 commit f925690

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

server/src/test/java/org/elasticsearch/index/mapper/LegacyDynamicMappingIT.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
import org.elasticsearch.common.settings.Settings;
2525
import org.elasticsearch.test.ESIntegTestCase;
2626

27-
import java.io.IOException;
28-
2927
import static org.elasticsearch.index.mapper.DynamicMappingIT.assertMappingsHaveField;
3028
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
3129

@@ -36,25 +34,32 @@ protected boolean forbidPrivateIndexSettings() {
3634
return false;
3735
}
3836

39-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/37817")
40-
public void testMappingsPropagatedToMasterNodeImmediatelyMultiType() throws IOException {
37+
public void testMappingsPropagatedToMasterNodeImmediatelyMultiType() throws Exception {
4138
assertAcked(prepareCreate("index").setSettings(Settings.builder().put("index.version.created", Version.V_5_6_0.id)));
4239
// allows for multiple types
4340

4441
// works when the type has been dynamically created
4542
client().prepareIndex("index", "type", "1").setSource("foo", 3).get();
46-
GetMappingsResponse mappings = client().admin().indices().prepareGetMappings("index").setTypes("type").get();
47-
assertMappingsHaveField(mappings, "index", "type", "foo");
43+
assertBusy(() -> {
44+
GetMappingsResponse mappings = client().admin().indices().prepareGetMappings("index").setTypes("type").get();
45+
assertMappingsHaveField(mappings, "index", "type", "foo");
46+
});
47+
4848

4949
// works if the type already existed
5050
client().prepareIndex("index", "type", "1").setSource("bar", "baz").get();
51-
mappings = client().admin().indices().prepareGetMappings("index").setTypes("type").get();
52-
assertMappingsHaveField(mappings, "index", "type", "bar");
51+
assertBusy(() -> {
52+
GetMappingsResponse mappings = client().admin().indices().prepareGetMappings("index").setTypes("type").get();
53+
assertMappingsHaveField(mappings, "index", "type", "bar");
54+
});
5355

5456
// works if we indexed an empty document
5557
client().prepareIndex("index", "type2", "1").setSource().get();
56-
mappings = client().admin().indices().prepareGetMappings("index").setTypes("type2").get();
57-
assertTrue(mappings.getMappings().get("index").toString(), mappings.getMappings().get("index").containsKey("type2"));
58+
assertBusy(() -> {
59+
GetMappingsResponse mappings = client().admin().indices().prepareGetMappings("index").setTypes("type2").get();
60+
assertNotNull(mappings.getMappings().get("index"));
61+
assertTrue(mappings.getMappings().get("index").toString(), mappings.getMappings().get("index").containsKey("type2"));
62+
});
5863
}
5964

6065
}

0 commit comments

Comments
 (0)