Skip to content

Commit 62d5aa9

Browse files
authored
Port gradle docs test plugin to use internal yaml rest test plugin (#86598)
Remove usage of deprecated elasticsearch.rest-test in DocsTestPlugin we keep some files in src/test in docs projects as moving them would require more changes in build-docs project outside this repository
1 parent 5f2dfb0 commit 62d5aa9

File tree

10 files changed

+16
-16
lines changed

10 files changed

+16
-16
lines changed

build-tools-internal/src/main/groovy/org/elasticsearch/gradle/internal/doc/DocsTestPlugin.groovy

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ package org.elasticsearch.gradle.internal.doc
1010
import org.elasticsearch.gradle.OS
1111
import org.elasticsearch.gradle.Version
1212
import org.elasticsearch.gradle.VersionProperties
13+
import org.elasticsearch.gradle.internal.test.rest.CopyRestApiTask
14+
import org.elasticsearch.gradle.internal.test.rest.CopyRestTestsTask
1315
import org.gradle.api.Plugin
1416
import org.gradle.api.Project
1517
import org.gradle.api.file.Directory
@@ -23,14 +25,12 @@ class DocsTestPlugin implements Plugin<Project> {
2325

2426
@Override
2527
void apply(Project project) {
26-
project.pluginManager.apply('elasticsearch.internal-testclusters')
27-
project.pluginManager.apply('elasticsearch.standalone-rest-test')
28-
project.pluginManager.apply('elasticsearch.rest-test')
28+
project.pluginManager.apply('elasticsearch.internal-yaml-rest-test')
2929

3030
String distribution = System.getProperty('tests.distribution', 'default')
3131
// The distribution can be configured with -Dtests.distribution on the command line
32-
project.testClusters.matching { it.name.equals("integTest") }.configureEach { testDistribution = distribution.toUpperCase() }
33-
project.testClusters.matching { it.name.equals("integTest") }.configureEach { nameCustomization = { it.replace("integTest", "node") } }
32+
project.testClusters.matching { it.name.equals("yamlRestTest") }.configureEach { testDistribution = distribution.toUpperCase() }
33+
project.testClusters.matching { it.name.equals("yamlRestTest") }.configureEach { nameCustomization = { it.replace("yamlRestTest", "node") } }
3434
// Docs are published separately so no need to assemble
3535
project.tasks.named("assemble").configure {enabled = false }
3636
Map<String, String> commonDefaultSubstitutions = [
@@ -72,6 +72,6 @@ class DocsTestPlugin implements Plugin<Project> {
7272
}
7373

7474
// TODO: This effectively makes testRoot not customizable, which we don't do anyway atm
75-
project.sourceSets.test.output.dir(restRootDir, builtBy: buildRestTests)
75+
project.sourceSets.yamlRestTest.output.dir(restRootDir, builtBy: buildRestTests)
7676
}
7777
}

docs/README.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ You don't have to do that.
8383
Snippets marked with `[source,console]` are automatically annotated with
8484
"VIEW IN CONSOLE" and "COPY AS CURL" in the documentation and are automatically
8585
tested by the command `./gradlew -pdocs check`. To test just the docs from a
86-
single page, use e.g. `./gradlew -pdocs integTest --tests "\*rollover*"`.
86+
single page, use e.g. `./gradlew -pdocs yamlRestTest --tests "\*rollover*"`.
8787

8888
By default each `[source,console]` snippet runs as its own isolated test. You
8989
can manipulate the test execution in the following ways:

docs/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ restResources {
5858
}
5959
}
6060

61-
testClusters.matching { it.name == "integTest"}.configureEach {
61+
testClusters.matching { it.name == "yamlRestTest"}.configureEach {
6262
if (singleNode().testDistribution == DEFAULT) {
6363
setting 'xpack.license.self_generated.type', 'trial'
6464
setting 'indices.lifecycle.history_index_enabled', 'false'
@@ -86,8 +86,8 @@ testClusters.matching { it.name == "integTest"}.configureEach {
8686
// Whitelist reindexing from the local node so we can test it.
8787
setting 'reindex.remote.whitelist', '127.0.0.1:*'
8888

89-
extraConfigFile 'ingest-geoip/GeoLite2-City.mmdb', file("${project.projectDir}/src/test/resources/GeoLite2-City.mmdb")
90-
extraConfigFile 'ingest-geoip/GeoLite2-Country.mmdb', file("${project.projectDir}/src/test/resources/GeoLite2-Country.mmdb")
89+
extraConfigFile 'ingest-geoip/GeoLite2-City.mmdb', file("src/yamlRestTest/resources/GeoLite2-City.mmdb")
90+
extraConfigFile 'ingest-geoip/GeoLite2-Country.mmdb', file("src/yamlRestTest/resources/GeoLite2-Country.mmdb")
9191

9292
// TODO: remove this once cname is prepended to transport.publish_address by default in 8.0
9393
systemProperty 'es.transport.cname_in_publish_address', 'true'
@@ -108,7 +108,7 @@ testClusters.matching { it.name == "integTest"}.configureEach {
108108
}
109109
}
110110

111-
tasks.named("integTest").configure {
111+
tasks.named("yamlRestTest").configure {
112112
doFirst {
113113
delete("${buildDir}/cluster/shared/repo")
114114
}
@@ -1626,7 +1626,7 @@ setups['setup-snapshots'] = setups['setup-repository'] + '''
16261626
}
16271627

16281628
/* Load the actual events only if we're going to use them. */
1629-
File atomicRedRegsvr32File = new File("$projectDir/src/test/resources/normalized-T1117-AtomicRed-regsvr32.json")
1629+
File atomicRedRegsvr32File = new File("$projectDir/src/yamlRestTest/resources/normalized-T1117-AtomicRed-regsvr32.json")
16301630
inputs.file(atomicRedRegsvr32File)
16311631

16321632
doFirst {

docs/reference/cluster/health.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ with a single index with one shard and one replica:
181181
"active_shards_percent_as_number": 50.0
182182
}
183183
--------------------------------------------------
184-
// TESTRESPONSE[s/testcluster/integTest/]
184+
// TESTRESPONSE[s/testcluster/yamlRestTest/]
185185
// TESTRESPONSE[s/"number_of_pending_tasks" : 0,/"number_of_pending_tasks" : $body.number_of_pending_tasks,/]
186186
// TESTRESPONSE[s/"task_max_waiting_in_queue_millis": 0/"task_max_waiting_in_queue_millis": $body.task_max_waiting_in_queue_millis/]
187187

x-pack/docs/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ tasks.named("buildRestTests").configure {
2020
}
2121

2222
dependencies {
23-
testImplementation(testArtifact(project(xpackModule('core'))))
24-
testImplementation(testArtifact(project(xpackProject('plugin').path)))
23+
yamlRestTestImplementation(testArtifact(project(xpackModule('core'))))
24+
yamlRestTestImplementation(testArtifact(project(xpackProject('plugin').path)))
2525
}
2626

2727
restResources {
@@ -30,7 +30,7 @@ restResources {
3030
}
3131
}
3232

33-
testClusters.matching { it.name == "integTest" }.configureEach {
33+
testClusters.matching { it.name == "yamlRestTest" }.configureEach {
3434
extraConfigFile 'op-jwks.json', xpackProject('test:idp-fixture').file("oidc/op-jwks.json")
3535
extraConfigFile 'idp-docs-metadata.xml', xpackProject('test:idp-fixture').file("idp/shibboleth-idp/metadata/idp-docs-metadata.xml")
3636
extraConfigFile 'testClient.crt', xpackProject('plugin:security').file("src/test/resources/org/elasticsearch/xpack/security/action/pki_delegation/testClient.crt")

0 commit comments

Comments
 (0)