[TEST] Exclude SORANI analyzer if compatibility version is < 1.3.0
This commit is contained in:
parent
2935b751e9
commit
95b6822f46
|
@ -19,6 +19,7 @@
|
||||||
package org.elasticsearch.bwcompat;
|
package org.elasticsearch.bwcompat;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.generators.RandomPicks;
|
import com.carrotsearch.randomizedtesting.generators.RandomPicks;
|
||||||
|
import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse;
|
import org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse;
|
||||||
import org.elasticsearch.indices.analysis.PreBuiltAnalyzers;
|
import org.elasticsearch.indices.analysis.PreBuiltAnalyzers;
|
||||||
import org.elasticsearch.test.ElasticsearchBackwardsCompatIntegrationTest;
|
import org.elasticsearch.test.ElasticsearchBackwardsCompatIntegrationTest;
|
||||||
|
@ -50,7 +51,7 @@ public class BasicAnalysisBackwardCompatibilityTests extends ElasticsearchBackwa
|
||||||
int fieldId = 0;
|
int fieldId = 0;
|
||||||
for (int i = 0; i < fields.length; i++) {
|
for (int i = 0; i < fields.length; i++) {
|
||||||
fields[i++] = "field_" + fieldId++;
|
fields[i++] = "field_" + fieldId++;
|
||||||
String analyzer = RandomPicks.randomFrom(getRandom(), PreBuiltAnalyzers.values()).name().toLowerCase(Locale.ROOT);
|
String analyzer = randomAnalyzer();
|
||||||
fields[i] = "type=string,analyzer=" + analyzer;
|
fields[i] = "type=string,analyzer=" + analyzer;
|
||||||
}
|
}
|
||||||
assertAcked(prepareCreate("test")
|
assertAcked(prepareCreate("test")
|
||||||
|
@ -89,6 +90,17 @@ public class BasicAnalysisBackwardCompatibilityTests extends ElasticsearchBackwa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String randomAnalyzer() {
|
||||||
|
while(true) {
|
||||||
|
PreBuiltAnalyzers preBuiltAnalyzers = RandomPicks.randomFrom(getRandom(), PreBuiltAnalyzers.values());
|
||||||
|
if (preBuiltAnalyzers == PreBuiltAnalyzers.SORANI && compatibilityVersion().before(Version.V_1_3_0)) {
|
||||||
|
continue; // SORANI was added in 1.3.0
|
||||||
|
}
|
||||||
|
return preBuiltAnalyzers.name().toLowerCase(Locale.ROOT);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private static final class InputOutput {
|
private static final class InputOutput {
|
||||||
final AnalyzeResponse response;
|
final AnalyzeResponse response;
|
||||||
final String input;
|
final String input;
|
||||||
|
|
Loading…
Reference in New Issue