Skip to content

Commit c8af2c6

Browse files
committed
Merge branch 'feature/shard_ref_count' of github.com:GalLalouche/elasticsearch into feature/shard_ref_count
2 parents c71ae9d + 69acdfd commit c8af2c6

File tree

1 file changed

+85
-36
lines changed

1 file changed

+85
-36
lines changed

x-pack/plugin/esql/qa/server/mixed-cluster/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/mixed/MixedClusterEsqlSpecIT.java

Lines changed: 85 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import org.elasticsearch.test.cluster.ElasticsearchCluster;
1212
import org.elasticsearch.test.rest.TestFeatureService;
1313
import org.elasticsearch.xpack.esql.CsvSpecReader.CsvTestCase;
14+
import org.elasticsearch.xpack.esql.qa.rest.EsqlSpecTestCase;
1415
import org.junit.AfterClass;
1516
import org.junit.Before;
1617
import org.junit.ClassRule;
@@ -21,39 +22,87 @@
2122
import static org.elasticsearch.xpack.esql.CsvTestUtils.isEnabled;
2223
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.JOIN_LOOKUP_V12;
2324

24-
public class @ClassRule public static ElasticsearchCluster cluster=Clusters.mixedVersionCluster();
25-
26-
@Override protected String getTestRestCluster(){return cluster.getHttpAddresses();}
27-
28-
static final Version bwcVersion=Version.fromString(System.getProperty("tests.old_cluster_version"));
29-
30-
private static TestFeatureService oldClusterTestFeatureService=null;
31-
32-
@Before public void extractOldClusterFeatures(){if(oldClusterTestFeatureService==null){oldClusterTestFeatureService=testFeatureService;}}
33-
34-
protected static boolean oldClusterHasFeature(String featureId){assert oldClusterTestFeatureService!=null;return oldClusterTestFeatureService.clusterHasFeature(featureId);}
35-
36-
@AfterClass public static void cleanUp(){oldClusterTestFeatureService=null;}
37-
38-
public MixedClusterEsqlSpecIT(String fileName,String groupName,String testName,Integer lineNumber,CsvTestCase testCase,String instructions,Mode mode){super(fileName,groupName,testName,lineNumber,testCase,instructions,mode);}
39-
40-
@Override protected void shouldSkipTest(String testName)throws IOException{super.shouldSkipTest(testName);assumeTrue("Test "+testName+" is skipped on "+bwcVersion,isEnabled(testName,instructions,bwcVersion));}
41-
42-
@Override protected boolean supportTimeSeriesCommand(){return false;}
43-
44-
@Override protected boolean enableRoundingDoubleValuesOnAsserting(){return true;}
45-
46-
@Override protected boolean supportsInferenceTestService(){return false;}
47-
48-
@Override protected boolean supportsIndexModeLookup()throws IOException{return hasCapabilities(List.of(JOIN_LOOKUP_V12.capabilityName()));}
49-
50-
@Override protected boolean supportsSourceFieldMapping()throws IOException{return false;}
51-
52-
@Override protected boolean deduplicateExactWarnings(){
53-
/*
54-
* In ESQL's main tests we shouldn't have to deduplicate but in
55-
* serverless, where we reuse this test case exactly with *slightly*
56-
* different configuration, we must deduplicate. So we do it here.
57-
* It's a bit of a loss of precision, but that's ok.
58-
*/
59-
return true;}}
25+
public class MixedClusterEsqlSpecIT extends EsqlSpecTestCase {
26+
@ClassRule
27+
public static ElasticsearchCluster cluster = Clusters.mixedVersionCluster();
28+
29+
@Override
30+
protected String getTestRestCluster() {
31+
return cluster.getHttpAddresses();
32+
}
33+
34+
static final Version bwcVersion = Version.fromString(System.getProperty("tests.old_cluster_version"));
35+
36+
private static TestFeatureService oldClusterTestFeatureService = null;
37+
38+
@Before
39+
public void extractOldClusterFeatures() {
40+
if (oldClusterTestFeatureService == null) {
41+
oldClusterTestFeatureService = testFeatureService;
42+
}
43+
}
44+
45+
protected static boolean oldClusterHasFeature(String featureId) {
46+
assert oldClusterTestFeatureService != null;
47+
return oldClusterTestFeatureService.clusterHasFeature(featureId);
48+
}
49+
50+
@AfterClass
51+
public static void cleanUp() {
52+
oldClusterTestFeatureService = null;
53+
}
54+
55+
public MixedClusterEsqlSpecIT(
56+
String fileName,
57+
String groupName,
58+
String testName,
59+
Integer lineNumber,
60+
CsvTestCase testCase,
61+
String instructions,
62+
Mode mode
63+
) {
64+
super(fileName, groupName, testName, lineNumber, testCase, instructions, mode);
65+
}
66+
67+
@Override
68+
protected void shouldSkipTest(String testName) throws IOException {
69+
super.shouldSkipTest(testName);
70+
assumeTrue("Test " + testName + " is skipped on " + bwcVersion, isEnabled(testName, instructions, bwcVersion));
71+
}
72+
73+
@Override
74+
protected boolean supportTimeSeriesCommand() {
75+
return false;
76+
}
77+
78+
@Override
79+
protected boolean enableRoundingDoubleValuesOnAsserting() {
80+
return true;
81+
}
82+
83+
@Override
84+
protected boolean supportsInferenceTestService() {
85+
return false;
86+
}
87+
88+
@Override
89+
protected boolean supportsIndexModeLookup() throws IOException {
90+
return hasCapabilities(List.of(JOIN_LOOKUP_V12.capabilityName()));
91+
}
92+
93+
@Override
94+
protected boolean supportsSourceFieldMapping() throws IOException {
95+
return false;
96+
}
97+
98+
@Override
99+
protected boolean deduplicateExactWarnings() {
100+
/*
101+
* In ESQL's main tests we shouldn't have to deduplicate but in
102+
* serverless, where we reuse this test case exactly with *slightly*
103+
* different configuration, we must deduplicate. So we do it here.
104+
* It's a bit of a loss of precision, but that's ok.
105+
*/
106+
return true;
107+
}
108+
}

0 commit comments

Comments
 (0)