Skip to content

Commit c3918cd

Browse files
authored
Fix path to compatible x-pack tests (#90925)
Compatible REST tests (like normal REST tests) allow copying the tests from either `rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test` (includeCore) or `x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test` (includeXpack). Both are currently broken. #90851 fixes the former , and this commit fixes the later. The fix here is to ensure the correct path to the x-pack rest tests when pulling from the elder branch for compatible testing. This only impacts modules that have the compatibility plugin enabled and are configured to pull from the main x-pack set of tests. Currently, this should only impact `:x-pack:plugin:enrich:qa:rest` but will fix it for future projects with that configuration.
1 parent 32439f4 commit c3918cd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/rest/compat/YamlRestCompatTestPlugin.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public class YamlRestCompatTestPlugin implements Plugin<Project> {
5959
private static final Path RELATIVE_TEST_PATH = Path.of("rest-api-spec/test");
6060
private static final Path RELATIVE_REST_API_RESOURCES = Path.of("rest-api-spec/src/main/resources");
6161
private static final Path RELATIVE_REST_CORE = Path.of("rest-api-spec");
62-
private static final Path RELATIVE_REST_XPACK_RESOURCES = Path.of("x-pack/plugin/src/test/resources");
62+
private static final Path RELATIVE_REST_XPACK = Path.of("x-pack/plugin");
6363
private static final Path RELATIVE_REST_PROJECT_RESOURCES = Path.of("src/yamlRestTest/resources");
6464
private static final int COMPATIBLE_VERSION = Version.fromString(VersionProperties.getVersions().get("elasticsearch")).getMajor() - 1;
6565
private static final String SOURCE_SET_NAME = "yamlRestTestV" + COMPATIBLE_VERSION + "Compat";
@@ -152,7 +152,11 @@ public void apply(Project project) {
152152
);
153153
task.setXpackConfigToFileTree(
154154
config -> fileOperations.fileTree(
155-
config.getSingleFile().toPath().resolve(RELATIVE_REST_XPACK_RESOURCES).resolve(RELATIVE_TEST_PATH)
155+
config.getSingleFile()
156+
.toPath()
157+
.resolve(RELATIVE_REST_XPACK)
158+
.resolve(RELATIVE_REST_PROJECT_RESOURCES)
159+
.resolve(RELATIVE_TEST_PATH)
156160
)
157161
);
158162
task.setAdditionalConfigToFileTree(

0 commit comments

Comments
 (0)