Skip to content

Commit 33cba44

Browse files
authored
[Build] Add test admin when starting gradle run with trial license and
also add more documentation around gradle run task. (elastic#30671)
1 parent 6c313a9 commit 33cba44

File tree

2 files changed

+43
-10
lines changed

2 files changed

+43
-10
lines changed

TESTING.asciidoc

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,46 @@ run it using Gradle:
2525
./gradlew run
2626
-------------------------------------
2727

28+
==== Launching and debugging from an IDE
29+
30+
If you want to run Elasticsearch from your IDE, the `./gradlew run` task
31+
supports a remote debugging option:
32+
33+
---------------------------------------------------------------------------
34+
./gradlew run --debug-jvm
35+
---------------------------------------------------------------------------
36+
37+
==== Distribution
38+
39+
By default a node is started with the zip distribution.
40+
In order to start with a different distribution use the `-Drun.distribution` argument.
41+
42+
To for example start the open source distribution:
43+
44+
-------------------------------------
45+
./gradlew run -Drun.distribution=oss-zip
46+
-------------------------------------
47+
48+
==== License type
49+
50+
By default a node is started with the `basic` license type.
51+
In order to start with a different license type use the `-Drun.license_type` argument.
52+
53+
In order to start a node with a trial license execute the following command:
54+
55+
-------------------------------------
56+
./gradlew run -Drun.license_type=trial
57+
-------------------------------------
58+
59+
This enables security and other paid features and adds a superuser with the username: `elastic-admin` and
60+
password: `elastic-password`.
61+
62+
==== Other useful arguments
63+
64+
In order to start a node with a different max heap space add: `-Dtests.heap.size=4G`
65+
In order to disable annotations add: `-Dtests.asserts=false`
66+
In order to set an Elasticsearch setting, provide a setting with the following prefix: `-Dtests.es.`
67+
2868
=== Test case filtering.
2969

3070
- `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
572612
the code currently used to build Elasticsearch does not allow JaCoCo to recognize its tests.
573613
For more information on this, see the discussion in https://github.com/elastic/elasticsearch/issues/28867[issue #28867].
574614

575-
== Launching and debugging from an IDE
576-
577-
If you want to run Elasticsearch from your IDE, the `./gradlew run` task
578-
supports a remote debugging option:
579-
580-
---------------------------------------------------------------------------
581-
./gradlew run --debug-jvm
582-
---------------------------------------------------------------------------
583-
584615
== Debugging remotely from an IDE
585616

586617
If you want to run Elasticsearch and be able to remotely attach the process

distribution/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,14 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
310310
task run(type: RunTask) {
311311
distribution = System.getProperty('run.distribution', 'zip')
312312
if (distribution == 'zip') {
313-
String licenseType = System.getProperty("license_type", "basic")
313+
String licenseType = System.getProperty("run.license_type", "basic")
314314
if (licenseType == 'trial') {
315315
setting 'xpack.ml.enabled', 'true'
316316
setting 'xpack.graph.enabled', 'true'
317317
setting 'xpack.watcher.enabled', 'true'
318318
setting 'xpack.license.self_generated.type', 'trial'
319+
setupCommand 'setupTestAdmin',
320+
'bin/elasticsearch-users', 'useradd', 'elastic-admin', '-p', 'elastic-password', '-r', 'superuser'
319321
} else if (licenseType != 'basic') {
320322
throw new IllegalArgumentException("Unsupported self-generated license type: [" + licenseType + "[basic] or [trial].")
321323
}

0 commit comments

Comments
 (0)