[Build] Add test admin when starting gradle run with trial license and

also add more documentation around gradle run task. (#30671)
This commit is contained in:
Martijn van Groningen 2018-05-18 14:11:11 +02:00 committed by GitHub
parent 6c313a9871
commit 33cba44d0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 10 deletions

View File

@ -25,6 +25,46 @@ run it using Gradle:
./gradlew run ./gradlew run
------------------------------------- -------------------------------------
==== Launching and debugging from an IDE
If you want to run Elasticsearch from your IDE, the `./gradlew run` task
supports a remote debugging option:
---------------------------------------------------------------------------
./gradlew run --debug-jvm
---------------------------------------------------------------------------
==== Distribution
By default a node is started with the zip distribution.
In order to start with a different distribution use the `-Drun.distribution` argument.
To for example start the open source distribution:
-------------------------------------
./gradlew run -Drun.distribution=oss-zip
-------------------------------------
==== License type
By default a node is started with the `basic` license type.
In order to start with a different license type use the `-Drun.license_type` argument.
In order to start a node with a trial license execute the following command:
-------------------------------------
./gradlew run -Drun.license_type=trial
-------------------------------------
This enables security and other paid features and adds a superuser with the username: `elastic-admin` and
password: `elastic-password`.
==== Other useful arguments
In order to start a node with a different max heap space add: `-Dtests.heap.size=4G`
In order to disable annotations add: `-Dtests.asserts=false`
In order to set an Elasticsearch setting, provide a setting with the following prefix: `-Dtests.es.`
=== Test case filtering. === Test case filtering.
- `tests.class` is a class-filtering shell-like glob pattern, - `tests.class` is a class-filtering shell-like glob pattern,
@ -572,15 +612,6 @@ as its build system. Since the switch to Gradle though, this is no longer possib
the code currently used to build Elasticsearch does not allow JaCoCo to recognize its tests. the code currently used to build Elasticsearch does not allow JaCoCo to recognize its tests.
For more information on this, see the discussion in https://github.com/elastic/elasticsearch/issues/28867[issue #28867]. For more information on this, see the discussion in https://github.com/elastic/elasticsearch/issues/28867[issue #28867].
== Launching and debugging from an IDE
If you want to run Elasticsearch from your IDE, the `./gradlew run` task
supports a remote debugging option:
---------------------------------------------------------------------------
./gradlew run --debug-jvm
---------------------------------------------------------------------------
== Debugging remotely from an IDE == Debugging remotely from an IDE
If you want to run Elasticsearch and be able to remotely attach the process If you want to run Elasticsearch and be able to remotely attach the process

View File

@ -310,12 +310,14 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
task run(type: RunTask) { task run(type: RunTask) {
distribution = System.getProperty('run.distribution', 'zip') distribution = System.getProperty('run.distribution', 'zip')
if (distribution == 'zip') { if (distribution == 'zip') {
String licenseType = System.getProperty("license_type", "basic") String licenseType = System.getProperty("run.license_type", "basic")
if (licenseType == 'trial') { if (licenseType == 'trial') {
setting 'xpack.ml.enabled', 'true' setting 'xpack.ml.enabled', 'true'
setting 'xpack.graph.enabled', 'true' setting 'xpack.graph.enabled', 'true'
setting 'xpack.watcher.enabled', 'true' setting 'xpack.watcher.enabled', 'true'
setting 'xpack.license.self_generated.type', 'trial' setting 'xpack.license.self_generated.type', 'trial'
setupCommand 'setupTestAdmin',
'bin/elasticsearch-users', 'useradd', 'elastic-admin', '-p', 'elastic-password', '-r', 'superuser'
} else if (licenseType != 'basic') { } else if (licenseType != 'basic') {
throw new IllegalArgumentException("Unsupported self-generated license type: [" + licenseType + "[basic] or [trial].") throw new IllegalArgumentException("Unsupported self-generated license type: [" + licenseType + "[basic] or [trial].")
} }