mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
test: avoid generating duplicate multiple fields (#27080)
Multifields parser does not allow duplicate values, however the MultiFieldTests may produce duplicate field values. See https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+master+release-tests/132/console.
This commit is contained in:
parent
d0104c22a5
commit
bf557fd886
@ -35,7 +35,9 @@ import org.elasticsearch.test.ESSingleNodeTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.test.StreamsUtils.copyToBytesFromClasspath;
|
||||
@ -155,8 +157,9 @@ public class MultiFieldTests extends ESSingleNodeTestCase {
|
||||
// can to unnecessary re-syncing of the mappings between the local instance and cluster state
|
||||
public void testMultiFieldsInConsistentOrder() throws Exception {
|
||||
String[] multiFieldNames = new String[randomIntBetween(2, 10)];
|
||||
Set<String> seenFields = new HashSet<>();
|
||||
for (int i = 0; i < multiFieldNames.length; i++) {
|
||||
multiFieldNames[i] = randomAlphaOfLength(4);
|
||||
multiFieldNames[i] = randomValueOtherThanMany(s -> !seenFields.add(s), () -> randomAlphaOfLength(4));
|
||||
}
|
||||
|
||||
XContentBuilder builder = jsonBuilder().startObject().startObject("type").startObject("properties")
|
||||
|
Loading…
x
Reference in New Issue
Block a user