Skip to content

Commit c1e2d48

Browse files
authored
Merge branch 'main' into tvclean0
2 parents 3250008 + e4f0b13 commit c1e2d48

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

test/framework/src/main/java/org/elasticsearch/datageneration/datasource/DefaultMappingParametersHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public static HashMap<String, Object> commonMappingParameters() {
280280
return map;
281281
}
282282

283-
public static Object extendedDocValuesParams() {
283+
protected Object extendedDocValuesParams() {
284284
// TODO: Remove this case when FieldMapper.DocValuesParameter.EXTENDED_DOC_VALUES_PARAMS_FF is removed.
285285
if (Build.current().isSnapshot() == false) {
286286
return ESTestCase.randomBoolean();

x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/xpack/logsdb/AbstractLogsdbRollingUpgradeTestCase.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import org.elasticsearch.test.cluster.ElasticsearchCluster;
1414
import org.elasticsearch.test.cluster.util.Version;
1515
import org.elasticsearch.test.rest.ESRestTestCase;
16+
import org.elasticsearch.test.rest.TestFeatureService;
17+
import org.junit.Before;
1618
import org.junit.ClassRule;
1719

1820
import java.io.IOException;
@@ -21,6 +23,22 @@ public abstract class AbstractLogsdbRollingUpgradeTestCase extends ESRestTestCas
2123
private static final String USER = "admin-user";
2224
private static final String PASS = "x-pack-test-password";
2325

26+
private static TestFeatureService oldClusterTestFeatureService;
27+
28+
@Before
29+
public void retainOldClusterTestFeatureService() {
30+
if (oldClusterTestFeatureService == null) {
31+
assert testFeatureServiceInitialized() : "testFeatureService must be initialized, see ESRestTestCase#initClient";
32+
oldClusterTestFeatureService = testFeatureService;
33+
}
34+
}
35+
36+
protected static boolean oldClusterHasFeature(String featureId) {
37+
assert oldClusterTestFeatureService != null
38+
: "testFeatureService of old cluster cannot be accessed before initialization is complete";
39+
return oldClusterTestFeatureService.clusterHasFeature(featureId);
40+
}
41+
2442
@ClassRule
2543
public static final ElasticsearchCluster cluster = Clusters.oldVersionCluster(USER, PASS);
2644

x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/xpack/logsdb/RandomizedRollingUpgradeIT.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.elasticsearch.datageneration.datasource.DataSourceHandler;
2424
import org.elasticsearch.datageneration.datasource.DataSourceRequest;
2525
import org.elasticsearch.datageneration.datasource.DataSourceResponse;
26+
import org.elasticsearch.datageneration.datasource.DefaultMappingParametersHandler;
2627
import org.elasticsearch.datageneration.datasource.MultifieldAddonHandler;
2728
import org.elasticsearch.datageneration.matchers.MatchResult;
2829
import org.elasticsearch.datageneration.matchers.Matcher;
@@ -82,6 +83,15 @@ public DataSourceResponse.FieldTypeGenerator handle(DataSourceRequest.FieldTypeG
8283
return new DataSourceResponse.FieldTypeGenerator.FieldTypeInfo(ESTestCase.randomFrom(options));
8384
});
8485
}
86+
}, new DefaultMappingParametersHandler() {
87+
@Override
88+
protected Object extendedDocValuesParams() {
89+
if (oldClusterHasFeature("mapper.keyword.store_high_cardinality_in_binary_doc_values")) {
90+
return super.extendedDocValuesParams();
91+
}
92+
93+
return ESTestCase.randomBoolean();
94+
}
8595
}))
8696
.withDataSourceHandlers(List.of(MultifieldAddonHandler.STRING_TYPE_HANDLER))
8797
// TODO: Remove ASCIIStringHandlers once the test has stabilized

0 commit comments

Comments
 (0)