File tree Expand file tree Collapse file tree 4 files changed +13
-2
lines changed
main/java/org/elasticsearch/test/rest/yaml
test/java/org/elasticsearch/test/rest/yaml/section Expand file tree Collapse file tree 4 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,9 @@ public class ClientYamlTestClient implements Closeable {
84
84
this .clientBuilderWithSniffedNodes = clientBuilderWithSniffedNodes ;
85
85
}
86
86
87
+ /**
88
+ * @return the version of the oldest node in the cluster
89
+ */
87
90
public Version getEsVersion () {
88
91
return esVersion ;
89
92
}
Original file line number Diff line number Diff line change @@ -206,7 +206,7 @@ public Stash stash() {
206
206
}
207
207
208
208
/**
209
- * Returns the current es version as a string
209
+ * @return the version of the oldest node in the cluster
210
210
*/
211
211
public Version esVersion () {
212
212
return clientYamlTestClient .getEsVersion ();
Original file line number Diff line number Diff line change @@ -367,7 +367,13 @@ public void execute(ClientYamlTestExecutionContext executionContext) throws IOEx
367
367
final String testPath = executionContext .getClientYamlTestCandidate () != null
368
368
? executionContext .getClientYamlTestCandidate ().getTestPath ()
369
369
: null ;
370
- checkElasticProductHeader (response .getHeaders ("X-elastic-product" ));
370
+ if (executionContext .esVersion ().after (Version .V_8_1_0 )
371
+ || (executionContext .esVersion ().major == Version .V_7_17_0 .major && executionContext .esVersion ().after (Version .V_7_17_1 ))) {
372
+ // #84038 and #84089 mean that this assertion fails when running against a small number of released versions, but at time of
373
+ // writing it's unclear exactly which released versions will contain the fix.
374
+ // TODO once a fixed version has been released, adjust the condition above to match.
375
+ checkElasticProductHeader (response .getHeaders ("X-elastic-product" ));
376
+ }
371
377
checkWarningHeaders (response .getWarningHeaders (), testPath );
372
378
} catch (ClientYamlTestResponseException e ) {
373
379
ClientYamlTestResponse restTestResponse = e .getRestTestResponse ();
Original file line number Diff line number Diff line change 14
14
import org .elasticsearch .client .NodeSelector ;
15
15
import org .elasticsearch .common .ParsingException ;
16
16
import org .elasticsearch .common .logging .HeaderWarning ;
17
+ import org .elasticsearch .test .VersionUtils ;
17
18
import org .elasticsearch .test .rest .yaml .ClientYamlTestExecutionContext ;
18
19
import org .elasticsearch .test .rest .yaml .ClientYamlTestResponse ;
19
20
import org .elasticsearch .xcontent .XContentLocation ;
@@ -605,6 +606,7 @@ public void testNodeSelectorByVersion() throws IOException {
605
606
doSection .getApiCallSection ().getNodeSelector ()
606
607
)
607
608
).thenReturn (mockResponse );
609
+ when (context .esVersion ()).thenReturn (VersionUtils .randomVersion (random ()));
608
610
when (mockResponse .getHeaders ("X-elastic-product" )).thenReturn (List .of ("Elasticsearch" ));
609
611
doSection .execute (context );
610
612
verify (context ).callApi (
You can’t perform that action at this time.
0 commit comments