Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ public class ClientYamlTestClient implements Closeable {
this.clientBuilderWithSniffedNodes = clientBuilderWithSniffedNodes;
}

/**
* @return the version of the oldest node in the cluster
*/
public Version getEsVersion() {
return esVersion;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public Stash stash() {
}

/**
* Returns the current es version as a string
* @return the version of the oldest node in the cluster
*/
public Version esVersion() {
return clientYamlTestClient.getEsVersion();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,13 @@ public void execute(ClientYamlTestExecutionContext executionContext) throws IOEx
final String testPath = executionContext.getClientYamlTestCandidate() != null
? executionContext.getClientYamlTestCandidate().getTestPath()
: null;
checkElasticProductHeader(response.getHeaders("X-elastic-product"));
if (executionContext.esVersion().after(Version.V_8_0_1)
|| (executionContext.esVersion().major == Version.V_7_17_0.major && executionContext.esVersion().after(Version.V_7_17_1))) {
// #84038 and #84089 mean that this assertion fails when running against a small number of released versions, but at time of
// writing it's unclear exactly which released versions will contain the fix.
// TODO once a fixed version has been released, adjust the condition above to match.
checkElasticProductHeader(response.getHeaders("X-elastic-product"));
}
checkWarningHeaders(response.getWarningHeaders(), testPath);
} catch (ClientYamlTestResponseException e) {
ClientYamlTestResponse restTestResponse = e.getRestTestResponse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.elasticsearch.client.NodeSelector;
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.logging.HeaderWarning;
import org.elasticsearch.test.VersionUtils;
import org.elasticsearch.test.rest.yaml.ClientYamlTestExecutionContext;
import org.elasticsearch.test.rest.yaml.ClientYamlTestResponse;
import org.elasticsearch.xcontent.XContentLocation;
Expand Down Expand Up @@ -605,6 +606,7 @@ public void testNodeSelectorByVersion() throws IOException {
doSection.getApiCallSection().getNodeSelector()
)
).thenReturn(mockResponse);
when(context.esVersion()).thenReturn(VersionUtils.randomVersion(random()));
when(mockResponse.getHeaders("X-elastic-product")).thenReturn(List.of("Elasticsearch"));
doSection.execute(context);
verify(context).callApi(
Expand Down