add instructions for customization of ./gradlew run (#88484)

This commit is contained in:
Jake Landis 2022-07-19 09:51:28 -05:00 committed by GitHub
parent 1441367d0b
commit 430b419f91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 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"` - 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("<path/to/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. === Test case filtering.
You can run a single test, provided that you specify the Gradle project. See the documentation on You can run a single test, provided that you specify the Gradle project. See the documentation on