Skip to content

Commit 5d59f91

Browse files
committed
Merge remote-tracking branch 'es/6.x' into ccr-6.x
* es/6.x: (140 commits) Remove AcknowledgedRestListener in favour of RestToXContentListener (#28724) Migrate some *ResponseTests to AbstractStreamableXContentTestCase (#28749) Revert "Disable BWC tests for build issues" Skip some plugins service tests on Windows Build: Consolidate archives and packages configuration (#28760) Ensure that azure stream has socket privileges (#28773) Disable BWC tests for build issues Pass InputStream when creating XContent parser (#28754) [DOCS] Fixed broken link. [DOCS] Changed to use transient setting to reenabled allocation. Closes #27677 Delay path expansion on Windows [TEST] replace randomAsciiAlphanumOfLengthBetween with randomAsciiLettersOfLengthBetween REST high-level client: add support for Rollover Index API (#28698) [Tests] Extract the testing logic for Google Cloud Storage (#28576) Moved Grok helper code to a separate Gradle module and let ingest-common module depend on it. version set in ingest pipeline (#27573) [Docs] Update links to java9 docs (#28750) Revert "Add startup logging for standalone tests" Tests: don't wait for completion while trying to get completed task Add 5.6.9 snapshot version ...
2 parents ce994c5 + 18ba465 commit 5d59f91

File tree

575 files changed

+9557
-5581
lines changed

Some content is hidden

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

575 files changed

+9557
-5581
lines changed

CONTRIBUTING.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,12 @@ cd elasticsearch/
162162
./gradlew assemble
163163
```
164164

165-
You will find the newly built packages under: `./distribution/(deb|rpm|tar|zip)/build/distributions/`.
165+
The package distributions (Debian and RPM) can be found under:
166+
`./distribution/packages/(deb|rpm)/build/distributions/`
167+
168+
The archive distributions (tar and zip) can be found under:
169+
`./distribution/archives/(tar|zip)/build/distributions/`
170+
166171

167172
Before submitting your changes, run the test suite to make sure that nothing is broken, with:
168173

README.textile

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ h3. Distributed, Highly Available
192192

193193
Let's face it, things will fail....
194194

195-
Elasticsearch is a highly available and distributed search engine. Each index is broken down into shards, and each shard can have one or more replica. By default, an index is created with 5 shards and 1 replica per shard (5/1). There are many topologies that can be used, including 1/10 (improve search performance), or 20/1 (improve indexing performance, with search executed in a map reduce fashion across shards).
195+
Elasticsearch is a highly available and distributed search engine. Each index is broken down into shards, and each shard can have one or more replicas. By default, an index is created with 5 shards and 1 replica per shard (5/1). There are many topologies that can be used, including 1/10 (improve search performance), or 20/1 (improve indexing performance, with search executed in a map reduce fashion across shards).
196196

197197
In order to play with the distributed nature of Elasticsearch, simply bring more nodes up and shut down nodes. The system will continue to serve requests (make sure you use the correct http port) with the latest data indexed.
198198

TESTING.asciidoc

+2
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ The REST layer is tested through specific tests that are shared between all
264264
the elasticsearch official clients and consist of YAML files that describe the
265265
operations to be executed and the obtained results that need to be tested.
266266

267+
The YAML files support various operators defined in the link:/rest-api-spec/src/main/resources/rest-api-spec/test/README.asciidoc[rest-api-spec] and adhere to the link:/rest-api-spec/README.markdown[Elasticsearch REST API JSON specification]
268+
267269
The REST tests are run automatically when executing the "./gradlew check" command. To run only the
268270
REST tests use the following command:
269271

build.gradle

+31-19
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ allprojects {
103103
isIdea = System.getProperty("idea.active") != null || gradle.startParameter.taskNames.contains('idea') || gradle.startParameter.taskNames.contains('cleanIdea')
104104

105105
// for BWC testing
106-
versionCollection = versions
106+
bwcVersions = versions
107107

108108
buildMetadata = buildMetadataMap
109109
}
@@ -122,13 +122,13 @@ task verifyVersions {
122122
Set<Version> knownVersions = new TreeSet<>(xml.versioning.versions.version.collect { it.text() }.findAll { it ==~ /\d\.\d\.\d/ }.collect { Version.fromString(it) })
123123

124124
// Limit the known versions to those that should be index compatible, and are not future versions
125-
knownVersions = knownVersions.findAll { it.major >= versions.currentVersion.major - 1 && it.before(VersionProperties.elasticsearch) }
125+
knownVersions = knownVersions.findAll { it.major >= bwcVersions.currentVersion.major - 1 && it.before(VersionProperties.elasticsearch) }
126126

127127
/* Limit the listed versions to those that have been marked as released.
128128
* Versions not marked as released don't get the same testing and we want
129129
* to make sure that we flip all unreleased versions to released as soon
130130
* as possible after release. */
131-
Set<Version> actualVersions = new TreeSet<>(versions.versionsIndexCompatibleWithCurrent.findAll { false == it.snapshot })
131+
Set<Version> actualVersions = new TreeSet<>(bwcVersions.indexCompatible.findAll { false == it.snapshot })
132132

133133
// Finally, compare!
134134
if (knownVersions.equals(actualVersions) == false) {
@@ -144,8 +144,19 @@ task verifyVersions {
144144
* the enabled state of every bwc task. It should be set back to true
145145
* after the backport of the backcompat code is complete.
146146
*/
147-
allprojects {
148-
ext.bwc_tests_enabled = true
147+
final boolean bwc_tests_enabled = true
148+
final String bwc_tests_disabled_issue = "" /* place a PR link here when commiting bwc changes */
149+
if (bwc_tests_enabled == false) {
150+
if (bwc_tests_disabled_issue.isEmpty()) {
151+
throw new GradleException("bwc_tests_disabled_issue must be set when bwc_tests_enabled == false")
152+
}
153+
println "========================= WARNING ========================="
154+
println " Backwards compatibility tests are disabled!"
155+
println "See ${bwc_tests_disabled_issue}"
156+
println "==========================================================="
157+
}
158+
subprojects {
159+
ext.bwc_tests_enabled = bwc_tests_enabled
149160
/*
150161
* Versions of Elasticsearch 5.1.1 through 5.3.0 inclusive did not start on versions of Linux with cgroups v2 enabled (kernel >= 4.5).
151162
* This property is provided to all projects that need to check conditionally if they should skip a BWC test task.
@@ -155,7 +166,7 @@ allprojects {
155166

156167
task verifyBwcTestsEnabled {
157168
doLast {
158-
if (project.bwc_tests_enabled == false) {
169+
if (bwc_tests_enabled == false) {
159170
throw new GradleException('Bwc tests are disabled. They must be re-enabled after completing backcompat behavior backporting.')
160171
}
161172
}
@@ -196,11 +207,11 @@ subprojects {
196207
"org.elasticsearch.client:test:${version}": ':client:test',
197208
"org.elasticsearch.client:transport:${version}": ':client:transport',
198209
"org.elasticsearch.test:framework:${version}": ':test:framework',
199-
"org.elasticsearch.distribution.integ-test-zip:elasticsearch:${version}": ':distribution:integ-test-zip',
200-
"org.elasticsearch.distribution.zip:elasticsearch:${version}": ':distribution:zip',
201-
"org.elasticsearch.distribution.tar:elasticsearch:${version}": ':distribution:tar',
202-
"org.elasticsearch.distribution.rpm:elasticsearch:${version}": ':distribution:rpm',
203-
"org.elasticsearch.distribution.deb:elasticsearch:${version}": ':distribution:deb',
210+
"org.elasticsearch.distribution.integ-test-zip:elasticsearch:${version}": ':distribution:archives:integ-test-zip',
211+
"org.elasticsearch.distribution.zip:elasticsearch:${version}": ':distribution:archives:zip',
212+
"org.elasticsearch.distribution.tar:elasticsearch:${version}": ':distribution:archives:tar',
213+
"org.elasticsearch.distribution.rpm:elasticsearch:${version}": ':distribution:packages:rpm',
214+
"org.elasticsearch.distribution.deb:elasticsearch:${version}": ':distribution:packages:deb',
204215
"org.elasticsearch.test:logger-usage:${version}": ':test:logger-usage',
205216
// for transport client
206217
"org.elasticsearch.plugin:transport-netty4-client:${version}": ':modules:transport-netty4',
@@ -212,13 +223,14 @@ subprojects {
212223
"org.elasticsearch.plugin:rank-eval-client:${version}": ':modules:rank-eval',
213224
]
214225

215-
for (final Version version : versionCollection.versionsIndexCompatibleWithCurrent) {
216-
if (version.branch != null) {
217-
final String snapshotProject = ":distribution:bwc-snapshot-${version.branch}"
218-
project(snapshotProject).ext.bwcVersion = version
219-
ext.projectSubstitutions["org.elasticsearch.distribution.deb:elasticsearch:${version}"] = snapshotProject
220-
ext.projectSubstitutions["org.elasticsearch.distribution.rpm:elasticsearch:${version}"] = snapshotProject
221-
ext.projectSubstitutions["org.elasticsearch.distribution.zip:elasticsearch:${version}"] = snapshotProject
226+
bwcVersions.snapshotProjectNames.each { snapshotName ->
227+
Version snapshot = bwcVersions.getSnapshotForProject(snapshotName)
228+
if (snapshot != null ) {
229+
String snapshotProject = ":distribution:bwc:${snapshotName}"
230+
project(snapshotProject).ext.bwcVersion = snapshot
231+
ext.projectSubstitutions["org.elasticsearch.distribution.deb:elasticsearch:${snapshot}"] = snapshotProject
232+
ext.projectSubstitutions["org.elasticsearch.distribution.rpm:elasticsearch:${snapshot}"] = snapshotProject
233+
ext.projectSubstitutions["org.elasticsearch.distribution.zip:elasticsearch:${snapshot}"] = snapshotProject
222234
}
223235
}
224236

@@ -249,7 +261,7 @@ subprojects {
249261
}
250262
}
251263
project.configurations.compile.dependencies.findAll().toSorted(sortClosure).each(depJavadocClosure)
252-
project.configurations.provided.dependencies.findAll().toSorted(sortClosure).each(depJavadocClosure)
264+
project.configurations.compileOnly.dependencies.findAll().toSorted(sortClosure).each(depJavadocClosure)
253265
}
254266
}
255267
}

buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/TestProgressLogger.groovy

+70-85
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,14 @@ package com.carrotsearch.gradle.junit4
2121

2222
import com.carrotsearch.ant.tasks.junit4.JUnit4
2323
import com.carrotsearch.ant.tasks.junit4.dependencies.com.google.common.eventbus.Subscribe
24+
import com.carrotsearch.ant.tasks.junit4.events.TestStartedEvent
25+
import com.carrotsearch.ant.tasks.junit4.events.aggregated.AggregatedQuitEvent
2426
import com.carrotsearch.ant.tasks.junit4.events.aggregated.AggregatedStartEvent
2527
import com.carrotsearch.ant.tasks.junit4.events.aggregated.AggregatedSuiteResultEvent
28+
import com.carrotsearch.ant.tasks.junit4.events.aggregated.AggregatedSuiteStartedEvent
2629
import com.carrotsearch.ant.tasks.junit4.events.aggregated.AggregatedTestResultEvent
30+
import com.carrotsearch.ant.tasks.junit4.events.aggregated.ChildBootstrap
31+
import com.carrotsearch.ant.tasks.junit4.events.aggregated.HeartBeatEvent
2732
import com.carrotsearch.ant.tasks.junit4.listeners.AggregatedEventListener
2833
import org.gradle.internal.logging.progress.ProgressLogger
2934
import org.gradle.internal.logging.progress.ProgressLoggerFactory
@@ -34,7 +39,6 @@ import static com.carrotsearch.ant.tasks.junit4.events.aggregated.TestStatus.FAI
3439
import static com.carrotsearch.ant.tasks.junit4.events.aggregated.TestStatus.IGNORED
3540
import static com.carrotsearch.ant.tasks.junit4.events.aggregated.TestStatus.IGNORED_ASSUMPTION
3641
import static com.carrotsearch.ant.tasks.junit4.events.aggregated.TestStatus.OK
37-
import static java.lang.Math.max
3842

3943
/**
4044
* Adapts junit4's event listeners into gradle's ProgressLogger. Note that
@@ -54,137 +58,118 @@ import static java.lang.Math.max
5458
class TestProgressLogger implements AggregatedEventListener {
5559
/** Factory to build a progress logger when testing starts */
5660
ProgressLoggerFactory factory
57-
ProgressLogger progressLogger
61+
ProgressLogger parentProgressLogger
62+
ProgressLogger suiteLogger
63+
ProgressLogger testLogger
64+
ProgressLogger[] slaveLoggers
5865
int totalSuites
5966
int totalSlaves
6067

61-
// sprintf formats used to align the integers we print
62-
String suitesFormat
63-
String slavesFormat
64-
String testsFormat
65-
6668
// Counters incremented test completion.
6769
volatile int suitesCompleted = 0
6870
volatile int testsCompleted = 0
6971
volatile int testsFailed = 0
7072
volatile int testsIgnored = 0
7173

72-
// Information about the last, most interesting event.
73-
volatile String eventDescription
74-
volatile int eventSlave
75-
volatile long eventExecutionTime
76-
77-
/** Have we finished a whole suite yet? */
78-
volatile boolean suiteFinished = false
79-
/* Note that we probably overuse volatile here but it isn't hurting us and
80-
lets us move things around without worrying about breaking things. */
81-
8274
@Subscribe
8375
void onStart(AggregatedStartEvent e) throws IOException {
8476
totalSuites = e.suiteCount
8577
totalSlaves = e.slaveCount
86-
progressLogger = factory.newOperation(TestProgressLogger)
87-
progressLogger.setDescription('Randomized test runner')
88-
progressLogger.started()
89-
progressLogger.progress(
90-
"Starting JUnit4 for ${totalSuites} suites on ${totalSlaves} jvms")
91-
92-
suitesFormat = "%0${widthForTotal(totalSuites)}d"
93-
slavesFormat = "%-${widthForTotal(totalSlaves)}s"
94-
/* Just guess the number of tests because we can't figure it out from
95-
here and it isn't worth doing anything fancy to prevent the console
96-
from jumping around a little. 200 is a pretty wild guess for the
97-
minimum but it makes REST tests output sanely. */
98-
int totalNumberOfTestsGuess = max(200, totalSuites * 10)
99-
testsFormat = "%0${widthForTotal(totalNumberOfTestsGuess)}d"
78+
parentProgressLogger = factory.newOperation(TestProgressLogger)
79+
parentProgressLogger.setDescription('Randomized test runner')
80+
parentProgressLogger.started()
81+
82+
suiteLogger = factory.newOperation(TestProgressLogger, parentProgressLogger)
83+
suiteLogger.setDescription('Suite logger')
84+
suiteLogger.started("Suites: 0/" + totalSuites)
85+
testLogger = factory.newOperation(TestProgressLogger, parentProgressLogger)
86+
testLogger.setDescription('Test logger')
87+
testLogger.started('Tests: completed: 0, failed: 0, ignored: 0')
88+
slaveLoggers = new ProgressLogger[e.slaveCount]
89+
for (int i = 0; i < e.slaveCount; ++i) {
90+
slaveLoggers[i] = factory.newOperation(TestProgressLogger, parentProgressLogger)
91+
slaveLoggers[i].setDescription("J${i} test logger")
92+
slaveLoggers[i].started("J${i}: initializing...")
93+
}
94+
}
95+
96+
@Subscribe
97+
void onChildBootstrap(ChildBootstrap e) throws IOException {
98+
slaveLoggers[e.getSlave().id].progress("J${e.slave.id}: starting (pid ${e.slave.pidString})")
99+
}
100+
101+
@Subscribe
102+
void onQuit(AggregatedQuitEvent e) throws IOException {
103+
suiteLogger.completed()
104+
testLogger.completed()
105+
for (ProgressLogger slaveLogger : slaveLoggers) {
106+
slaveLogger.completed()
107+
}
108+
parentProgressLogger.completed()
109+
}
110+
111+
@Subscribe
112+
void onSuiteStart(AggregatedSuiteStartedEvent e) throws IOException {
113+
String suiteName = simpleName(e.suiteStartedEvent.description.className)
114+
slaveLoggers[e.slave.id].progress("J${e.slave.id}: ${suiteName} - initializing")
115+
}
116+
117+
@Subscribe
118+
void onSuiteResult(AggregatedSuiteResultEvent e) throws IOException {
119+
suitesCompleted++
120+
suiteLogger.progress("Suites: " + suitesCompleted + "/" + totalSuites)
100121
}
101122

102123
@Subscribe
103124
void onTestResult(AggregatedTestResultEvent e) throws IOException {
125+
final String statusMessage
104126
testsCompleted++
105127
switch (e.status) {
106128
case ERROR:
107129
case FAILURE:
108130
testsFailed++
131+
statusMessage = "failed"
109132
break
110133
case IGNORED:
111134
case IGNORED_ASSUMPTION:
112135
testsIgnored++
136+
statusMessage = "ignored"
113137
break
114138
case OK:
139+
String time = formatDurationInSeconds(e.executionTime)
140+
statusMessage = "completed [${time}]"
115141
break
116142
default:
117-
throw new IllegalArgumentException(
118-
"Unknown test status: [${e.status}]")
143+
throw new IllegalArgumentException("Unknown test status: [${e.status}]")
119144
}
120-
if (!suiteFinished) {
121-
updateEventInfo(e)
122-
}
123-
124-
log()
145+
testLogger.progress("Tests: completed: ${testsCompleted}, failed: ${testsFailed}, ignored: ${testsIgnored}")
146+
String testName = simpleName(e.description.className) + '.' + e.description.methodName
147+
slaveLoggers[e.slave.id].progress("J${e.slave.id}: ${testName} ${statusMessage}")
125148
}
126149

127150
@Subscribe
128-
void onSuiteResult(AggregatedSuiteResultEvent e) throws IOException {
129-
suitesCompleted++
130-
suiteFinished = true
131-
updateEventInfo(e)
132-
log()
151+
void onTestStarted(TestStartedEvent e) throws IOException {
152+
String testName = simpleName(e.description.className) + '.' + e.description.methodName
153+
slaveLoggers[e.slave.id].progress("J${e.slave.id}: ${testName} ...")
133154
}
134155

135-
/**
136-
* Update the suite information with a junit4 event.
137-
*/
138-
private void updateEventInfo(Object e) {
139-
eventDescription = simpleName(e.description.className)
140-
if (e.description.methodName != null) {
141-
eventDescription += "#${e.description.methodName}"
142-
}
143-
eventSlave = e.slave.id
144-
eventExecutionTime = e.executionTime
156+
@Subscribe
157+
void onHeartbeat(HeartBeatEvent e) throws IOException {
158+
String testName = simpleName(e.description.className) + '.' + e.description.methodName
159+
String time = formatDurationInSeconds(e.getNoEventDuration())
160+
slaveLoggers[e.slave.id].progress("J${e.slave.id}: ${testName} stalled for ${time}")
145161
}
146162

147163
/**
148164
* Extract a Class#getSimpleName style name from Class#getName style
149165
* string. We can't just use Class#getSimpleName because junit descriptions
150-
* don't alway s set the class field but they always set the className
166+
* don't always set the class field but they always set the className
151167
* field.
152168
*/
153169
private static String simpleName(String className) {
154170
return className.substring(className.lastIndexOf('.') + 1)
155171
}
156172

157-
private void log() {
158-
/* Remember that instances of this class are only ever active on one
159-
thread at a time so there really aren't race conditions here. It'd be
160-
OK if there were because they'd only display an overcount
161-
temporarily. */
162-
String log = ''
163-
if (totalSuites > 1) {
164-
/* Skip printing the suites to save space when there is only a
165-
single suite. This is nice because when there is only a single
166-
suite we log the method name and those can be long. */
167-
log += sprintf("Suites [${suitesFormat}/${suitesFormat}], ",
168-
[suitesCompleted, totalSuites])
169-
}
170-
log += sprintf("Tests [${testsFormat}|%d|%d], ",
171-
[testsCompleted, testsFailed, testsIgnored])
172-
log += "in ${formatDurationInSeconds(eventExecutionTime)} "
173-
if (totalSlaves > 1) {
174-
/* Skip printing the slaves if there is only one of them. This is
175-
nice because when there is only a single slave there is often
176-
only a single suite and we could use the extra space to log the
177-
test method names. */
178-
log += "J${sprintf(slavesFormat, eventSlave)} "
179-
}
180-
log += "completed ${eventDescription}"
181-
progressLogger.progress(log)
182-
}
183-
184-
private static int widthForTotal(int total) {
185-
return ((total - 1) as String).length()
186-
}
187-
188173
@Override
189174
void setOuter(JUnit4 junit) {}
190175
}

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

+5-3
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ class BuildPlugin implements Plugin<Project> {
7676
project.pluginManager.apply('nebula.info-java')
7777
project.pluginManager.apply('nebula.info-scm')
7878
project.pluginManager.apply('nebula.info-jar')
79-
project.pluginManager.apply(ProvidedBasePlugin)
8079

8180
globalBuildInfo(project)
8281
configureRepositories(project)
@@ -261,6 +260,9 @@ class BuildPlugin implements Plugin<Project> {
261260
* to iterate the transitive dependencies and add excludes.
262261
*/
263262
static void configureConfigurations(Project project) {
263+
// we want to test compileOnly deps!
264+
project.configurations.testCompile.extendsFrom(project.configurations.compileOnly)
265+
264266
// we are not shipping these jars, we act like dumb consumers of these things
265267
if (project.path.startsWith(':test:fixtures') || project.path == ':build-tools') {
266268
return
@@ -297,7 +299,7 @@ class BuildPlugin implements Plugin<Project> {
297299

298300
project.configurations.compile.dependencies.all(disableTransitiveDeps)
299301
project.configurations.testCompile.dependencies.all(disableTransitiveDeps)
300-
project.configurations.provided.dependencies.all(disableTransitiveDeps)
302+
project.configurations.compileOnly.dependencies.all(disableTransitiveDeps)
301303
}
302304

303305
/** Adds repositories used by ES dependencies */
@@ -665,7 +667,7 @@ class BuildPlugin implements Plugin<Project> {
665667
// only require dependency licenses for non-elasticsearch deps
666668
project.dependencyLicenses.dependencies = project.configurations.runtime.fileCollection {
667669
it.group.startsWith('org.elasticsearch') == false
668-
} - project.configurations.provided
670+
} - project.configurations.compileOnly
669671
}
670672

671673
private static configureDependenciesInfo(Project project) {

0 commit comments

Comments
 (0)