Skip to content

Commit 624729e

Browse files
authored
Merge pull request #1 from elastic/master
merge the lastest commits from author
2 parents 30a9a76 + b0d346f commit 624729e

File tree

1,426 files changed

+32250
-19395
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,426 files changed

+32250
-19395
lines changed

LICENSE.txt

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
Source code in this repository is variously licensed under the Apache License
2-
Version 2.0, an Apache compatible license, or the Elastic License. Outside of
3-
the "x-pack" folder, source code in a given file is licensed under the Apache
4-
License Version 2.0, unless otherwise noted at the beginning of the file or a
5-
LICENSE file present in the directory subtree declares a separate license.
6-
Within the "x-pack" folder, source code in a given file is licensed under the
7-
Elastic License, unless otherwise noted at the beginning of the file or a
8-
LICENSE file present in the directory subtree declares a separate license.
1+
Source code in this repository is covered by one of three licenses: (i) the
2+
Apache License 2.0 (ii) an Apache License 2.0 compatible license (iii) the
3+
Elastic License. The default license throughout the repository is Apache License
4+
2.0 unless the header specifies another license. Elastic Licensed code is found
5+
only in the x-pack directory.
96

107
The build produces two sets of binaries - one set that falls under the Elastic
11-
License and another set that falls under Apache License Version 2.0. The
12-
binaries that contain `-oss` in the artifact name are licensed under the Apache
13-
License Version 2.0.
8+
License and another set that falls under Apache License 2.0. The binaries that
9+
contain `-oss` in the artifact name are licensed under Apache License 2.0 and
10+
these binaries do not package any code from the x-pack directory.

TESTING.asciidoc

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -76,28 +76,21 @@ In order to set an Elasticsearch setting, provide a setting with the following p
7676

7777
=== Test case filtering.
7878

79-
- `tests.class` is a class-filtering shell-like glob pattern,
80-
- `tests.method` is a method-filtering glob pattern.
79+
You can run a single test, provided that you specify the Gradle project. See the documentation on
80+
https://docs.gradle.org/current/userguide/userguide_single.html#simple_name_pattern[simple name pattern filtering].
8181

82-
Run a single test case (variants)
82+
Run a single test case in the `server` project:
8383

8484
----------------------------------------------------------
85-
./gradlew test -Dtests.class=org.elasticsearch.package.ClassName
86-
./gradlew test "-Dtests.class=*.ClassName"
85+
./gradlew :server:test --tests org.elasticsearch.package.ClassName
8786
----------------------------------------------------------
8887

89-
Run all tests in a package and its sub-packages
88+
Run all tests in a package and its sub-packages:
9089

9190
----------------------------------------------------
92-
./gradlew test "-Dtests.class=org.elasticsearch.package.*"
91+
./gradlew :server:test --tests 'org.elasticsearch.package.*'
9392
----------------------------------------------------
9493

95-
Run any test methods that contain 'esi' (like: ...r*esi*ze...)
96-
97-
-------------------------------
98-
./gradlew test "-Dtests.method=*esi*"
99-
-------------------------------
100-
10194
Run all tests that are waiting for a bugfix (disabled by default)
10295

10396
------------------------------------------------
@@ -118,7 +111,7 @@ Every test repetition will have a different method seed
118111
(derived from a single random master seed).
119112

120113
--------------------------------------------------
121-
./gradlew test -Dtests.iters=N -Dtests.class=*.ClassName
114+
./gradlew :server:test -Dtests.iters=N --tests org.elasticsearch.package.ClassName
122115
--------------------------------------------------
123116

124117
=== Repeats _all_ tests of ClassName N times.
@@ -127,7 +120,7 @@ Every test repetition will have exactly the same master (0xdead) and
127120
method-level (0xbeef) seed.
128121

129122
------------------------------------------------------------------------
130-
./gradlew test -Dtests.iters=N -Dtests.class=*.ClassName -Dtests.seed=DEAD:BEEF
123+
./gradlew :server:test -Dtests.iters=N -Dtests.seed=DEAD:BEEF --tests org.elasticsearch.package.ClassName
131124
------------------------------------------------------------------------
132125

133126
=== Repeats a given test N times
@@ -137,14 +130,14 @@ ie: testFoo[0], testFoo[1], etc... so using testmethod or tests.method
137130
ending in a glob is necessary to ensure iterations are run).
138131

139132
-------------------------------------------------------------------------
140-
./gradlew test -Dtests.iters=N -Dtests.class=*.ClassName -Dtests.method=mytest*
133+
./gradlew :server:test -Dtests.iters=N --tests org.elasticsearch.package.ClassName.methodName
141134
-------------------------------------------------------------------------
142135

143136
Repeats N times but skips any tests after the first failure or M initial failures.
144137

145138
-------------------------------------------------------------
146-
./gradlew test -Dtests.iters=N -Dtests.failfast=true -Dtestcase=...
147-
./gradlew test -Dtests.iters=N -Dtests.maxfailures=M -Dtestcase=...
139+
./gradlew test -Dtests.iters=N -Dtests.failfast=true ...
140+
./gradlew test -Dtests.iters=N -Dtests.maxfailures=M ...
148141
-------------------------------------------------------------
149142

150143
=== Test groups.
@@ -175,7 +168,7 @@ systemProp.tests.jvms=8
175168
----------------------------
176169

177170
Its difficult to pick the "right" number here. Hypercores don't count for CPU
178-
intensive tests and you should leave some slack for JVM-interal threads like
171+
intensive tests and you should leave some slack for JVM-internal threads like
179172
the garbage collector. And you have to have enough RAM to handle each JVM.
180173

181174
=== Test compatibility.
@@ -553,10 +546,10 @@ When running `./gradlew check`, minimal bwc checks are also run against compatib
553546
Sometimes a backward compatibility change spans two versions. A common case is a new functionality
554547
that needs a BWC bridge in an unreleased versioned of a release branch (for example, 5.x).
555548
To test the changes, you can instruct Gradle to build the BWC version from a another remote/branch combination instead of
556-
pulling the release branch from GitHub. You do so using the `tests.bwc.remote` and `tests.bwc.refspec.BRANCH` system properties:
549+
pulling the release branch from GitHub. You do so using the `bwc.remote` and `bwc.refspec.BRANCH` system properties:
557550

558551
-------------------------------------------------
559-
./gradlew check -Dtests.bwc.remote=${remote} -Dtests.bwc.refspec.5.x=index_req_bwc_5.x
552+
./gradlew check -Dbwc.remote=${remote} -Dbwc.refspec.5.x=index_req_bwc_5.x
560553
-------------------------------------------------
561554

562555
The branch needs to be available on the remote that the BWC makes of the
@@ -571,7 +564,7 @@ will need to:
571564
will contain your change.
572565
. Create a branch called `index_req_bwc_5.x` off `5.x`. This will contain your bwc layer.
573566
. Push both branches to your remote repository.
574-
. Run the tests with `./gradlew check -Dtests.bwc.remote=${remote} -Dtests.bwc.refspec.5.x=index_req_bwc_5.x`.
567+
. Run the tests with `./gradlew check -Dbwc.remote=${remote} -Dbwc.refspec.5.x=index_req_bwc_5.x`.
575568

576569
==== Skip fetching latest
577570

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import org.gradle.plugins.ide.eclipse.model.SourceFolder
3232
import static org.elasticsearch.gradle.tool.Boilerplate.maybeConfigure
3333

3434
plugins {
35-
id 'com.gradle.build-scan' version '2.3'
35+
id 'com.gradle.build-scan' version '2.4'
3636
id 'base'
3737
id 'elasticsearch.global-build-info'
3838
}
@@ -524,9 +524,9 @@ allprojects {
524524
def checkPart2 = tasks.register('checkPart2')
525525
plugins.withId('lifecycle-base') {
526526
if (project.path.startsWith(":x-pack:")) {
527-
checkPart1.configure { dependsOn 'check' }
528-
} else {
529527
checkPart2.configure { dependsOn 'check' }
528+
} else {
529+
checkPart1.configure { dependsOn 'check' }
530530
}
531531
}
532532
}

buildSrc/build.gradle

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,27 +77,13 @@ sourceSets {
7777
minimumRuntime { }
7878
}
7979

80-
configurations {
81-
reaper
82-
}
83-
8480
compileMinimumRuntimeJava {
8581
targetCompatibility = 8
8682
sourceCompatibility = 8
8783
}
8884

89-
normalization {
90-
runtimeClasspath {
91-
// Ignore the embedded JAR as we track this separately below as a runtime dependency
92-
ignore 'META-INF/*.jar'
93-
}
94-
}
95-
9685
jar {
9786
from sourceSets.minimumRuntime.output
98-
into('META-INF') {
99-
from configurations.reaper
100-
}
10187
}
10288

10389
javadoc {
@@ -135,7 +121,6 @@ dependencies {
135121
testCompile "junit:junit:${props.getProperty('junit')}"
136122
testCompile "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${props.getProperty('randomizedrunner')}"
137123
testCompile 'com.github.tomakehurst:wiremock-jre8-standalone:2.23.2'
138-
reaper project('reaper')
139124
minimumRuntimeCompile "junit:junit:${props.getProperty('junit')}"
140125
minimumRuntimeCompile localGroovy()
141126
minimumRuntimeCompile gradleApi()
@@ -184,9 +169,11 @@ if (project != rootProject) {
184169

185170
configurations {
186171
distribution
172+
reaper
187173
}
188174

189175
dependencies {
176+
reaper project('reaper')
190177
distribution project(':distribution:archives:windows-zip')
191178
distribution project(':distribution:archives:oss-windows-zip')
192179
distribution project(':distribution:archives:darwin-tar')
@@ -198,6 +185,9 @@ if (project != rootProject) {
198185
// for external projects we want to remove the marker file indicating we are running the Elasticsearch project
199186
processResources {
200187
exclude 'buildSrc.marker'
188+
into('META-INF') {
189+
from configurations.reaper
190+
}
201191
}
202192

203193
String localDownloads = "${rootProject.buildDir}/local-downloads"

buildSrc/reaper/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
jar {
2+
archiveName = "${project.name}.jar"
23
manifest {
34
attributes 'Main-Class': 'org.elasticsearch.gradle.reaper.Reaper'
45
}

buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ import org.gradle.authentication.http.HttpHeaderAuthentication
7878
import org.gradle.external.javadoc.CoreJavadocOptions
7979
import org.gradle.internal.jvm.Jvm
8080
import org.gradle.language.base.plugins.LifecycleBasePlugin
81+
import org.gradle.process.CommandLineArgumentProvider
8182
import org.gradle.process.ExecResult
8283
import org.gradle.process.ExecSpec
8384
import org.gradle.util.GradleVersion
@@ -834,10 +835,9 @@ class BuildPlugin implements Plugin<Project> {
834835

835836
test.jvmArgs "-Xmx${System.getProperty('tests.heap.size', '512m')}",
836837
"-Xms${System.getProperty('tests.heap.size', '512m')}",
837-
'-XX:+HeapDumpOnOutOfMemoryError',
838-
"-XX:HeapDumpPath=$heapdumpDir",
839838
'--illegal-access=warn'
840839

840+
test.jvmArgumentProviders.add({ ['-XX:+HeapDumpOnOutOfMemoryError', "-XX:HeapDumpPath=$heapdumpDir"] } as CommandLineArgumentProvider)
841841

842842
if (System.getProperty('tests.jvm.argline')) {
843843
test.jvmArgs System.getProperty('tests.jvm.argline').split(" ")
@@ -848,8 +848,7 @@ class BuildPlugin implements Plugin<Project> {
848848
}
849849

850850
// we use './temp' since this is per JVM and tests are forbidden from writing to CWD
851-
test.systemProperties 'gradle.dist.lib': new File(project.class.location.toURI()).parent,
852-
'java.io.tmpdir': './temp',
851+
test.systemProperties 'java.io.tmpdir': './temp',
853852
'java.awt.headless': 'true',
854853
'tests.gradle': 'true',
855854
'tests.artifact': project.name,
@@ -865,6 +864,7 @@ class BuildPlugin implements Plugin<Project> {
865864
}
866865

867866
// don't track these as inputs since they contain absolute paths and break cache relocatability
867+
nonInputProperties.systemProperty('gradle.dist.lib', new File(project.class.location.toURI()).parent)
868868
nonInputProperties.systemProperty('gradle.worker.jar', "${project.gradle.getGradleUserHomeDir()}/caches/${project.gradle.gradleVersion}/workerMain/gradle-worker.jar")
869869
nonInputProperties.systemProperty('gradle.user.home', project.gradle.getGradleUserHomeDir())
870870

@@ -881,6 +881,9 @@ class BuildPlugin implements Plugin<Project> {
881881
// TODO: remove this once ctx isn't added to update script params in 7.0
882882
test.systemProperty 'es.scripting.update.ctx_in_params', 'false'
883883

884+
// TODO: remove this once cname is prepended to transport.publish_address by default in 8.0
885+
test.systemProperty 'es.transport.cname_in_publish_address', 'true'
886+
884887
test.testLogging { TestLoggingContainer logging ->
885888
logging.showExceptions = true
886889
logging.showCauses = true

buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,16 +237,12 @@ class PrecommitTasks {
237237
// on them. We also want `precommit` to depend on `checkstyle`.
238238
project.pluginManager.apply('checkstyle')
239239
project.checkstyle {
240-
config = project.resources.text.fromFile(checkstyleConf, 'UTF-8')
241-
configProperties = [
242-
suppressions: checkstyleSuppressions
243-
]
240+
configDir = checkstyleDir
244241
toolVersion = CHECKSTYLE_VERSION
245242
}
246243

247244
project.tasks.withType(Checkstyle).configureEach { task ->
248245
task.dependsOn(copyCheckstyleConf)
249-
task.inputs.file(checkstyleSuppressions)
250246
task.reports {
251247
html.enabled false
252248
}

buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ package org.elasticsearch.gradle.test
2121
import org.apache.tools.ant.DefaultLogger
2222
import org.apache.tools.ant.taskdefs.condition.Os
2323
import org.elasticsearch.gradle.BuildPlugin
24+
import org.elasticsearch.gradle.BwcVersions
2425
import org.elasticsearch.gradle.LoggedExec
2526
import org.elasticsearch.gradle.Version
26-
import org.elasticsearch.gradle.BwcVersions
2727
import org.elasticsearch.gradle.VersionProperties
2828
import org.elasticsearch.gradle.plugin.PluginBuildPlugin
2929
import org.elasticsearch.gradle.plugin.PluginPropertiesExtension
@@ -39,11 +39,13 @@ import org.gradle.api.logging.Logger
3939
import org.gradle.api.tasks.Copy
4040
import org.gradle.api.tasks.Delete
4141
import org.gradle.api.tasks.Exec
42+
import org.gradle.internal.jvm.Jvm
4243

4344
import java.nio.charset.StandardCharsets
4445
import java.nio.file.Paths
4546
import java.util.concurrent.TimeUnit
4647
import java.util.stream.Collectors
48+
4749
/**
4850
* A helper for creating tasks to build a cluster that is used by a task, and tear down the cluster when the task is finished.
4951
*/
@@ -887,15 +889,7 @@ class ClusterFormationTasks {
887889
onlyIf { node.pidFile.exists() }
888890
// the pid file won't actually be read until execution time, since the read is wrapped within an inner closure of the GString
889891
ext.pid = "${ -> node.pidFile.getText('UTF-8').trim()}"
890-
File jps
891-
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
892-
jps = getJpsExecutableByName(project, "jps.exe")
893-
} else {
894-
jps = getJpsExecutableByName(project, "jps")
895-
}
896-
if (!jps.exists()) {
897-
throw new GradleException("jps executable not found; ensure that you're running Gradle with the JDK rather than the JRE")
898-
}
892+
final File jps = Jvm.forHome(project.runtimeJavaHome).getExecutable('jps')
899893
commandLine jps, '-l'
900894
standardOutput = new ByteArrayOutputStream()
901895
doLast {
@@ -914,10 +908,6 @@ class ClusterFormationTasks {
914908
}
915909
}
916910

917-
private static File getJpsExecutableByName(Project project, String jpsExecutableName) {
918-
return Paths.get(project.runtimeJavaHome.toString(), "bin/" + jpsExecutableName).toFile()
919-
}
920-
921911
/** Adds a task to kill an elasticsearch node with the given pidfile */
922912
static Task configureStopTask(String name, Project project, Object depends, NodeInfo node) {
923913
return project.tasks.create(name: name, type: LoggedExec, dependsOn: depends) {

0 commit comments

Comments
 (0)