From 430b419f919f32686dccf8e37c8df349d0305fb3 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Tue, 19 Jul 2022 09:51:28 -0500 Subject: [PATCH] add instructions for customization of ./gradlew run (#88484) --- TESTING.asciidoc | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/TESTING.asciidoc b/TESTING.asciidoc index 64a669aa5d56..a9ecf0cf47a8 100644 --- a/TESTING.asciidoc +++ b/TESTING.asciidoc @@ -108,6 +108,40 @@ password: `elastic-password`. - In order to set an Elasticsearch setting, provide a setting with the following prefix: `-Dtests.es.` - In order to pass a JVM setting, e.g. to disable assertions: `-Dtests.jvm.argline="-da"` +==== Customizing the test cluster for ./gradlew run + +You may need to customize the cluster configuration for the ./gradlew run task. +You can simply find the task in the source code and configure it there. +(The task is currently defined in build-tools-internal/src/main/groovy/elasticsearch.run.gradle) +However, this requires modifying a source controlled file and subject to accidental commits. +Alternatively, you can use a Gradle init script to inject custom build logic with the -I flag to configure this task locally. + +For example: + +To enable HTTPS for use with ./gradlew run, an extraConfigFile is needed to be added to the cluster configuration. +Create a file (for example ~/custom-run.gradle) with the following contents: +------------------------------------- +rootProject { + if(project.name == 'elasticsearch') { + afterEvaluate { + testClusters.matching { it.name == "runTask"}.configureEach { + extraConfigFile 'http.p12', file("/http.p12") + } + } + } +} +------------------------------------- +Now tell Gradle to use this init script: +------------------------------------- +./gradlew run -I ~/custom-run.gradle \ +-Dtests.es.xpack.security.http.ssl.enabled=true \ +-Dtests.es.xpack.security.http.ssl.keystore.path=http.p12 +------------------------------------- + +Now the http.p12 file will be placed in the config directory of the running cluster and available for use. +Assuming you have the http.ssl.keystore setup correctly, you can now use HTTPS with ./gradlew run without the risk +of accidentally committing your local configurations. + === Test case filtering. You can run a single test, provided that you specify the Gradle project. See the documentation on