Skip to content

Commit 43f555b

Browse files
committed
Merge branch 'master' into replicated-closed-indices
2 parents c484c66 + de8ba77 commit 43f555b

File tree

356 files changed

+12617
-2835
lines changed

Some content is hidden

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

356 files changed

+12617
-2835
lines changed

.ci/packer_cache.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ export JAVA_HOME="${HOME}"/.java/${ES_BUILD_JAVA}
2121
export JAVA8_HOME="${HOME}"/.java/java8
2222
export JAVA11_HOME="${HOME}"/.java/java11
2323
export JAVA12_HOME="${HOME}"/.java/java12
24-
./gradlew --parallel clean pullFixture --scan -Porg.elasticsearch.acceptScanTOS=true -s resolveAllDependencies
24+
./gradlew --parallel clean --scan -Porg.elasticsearch.acceptScanTOS=true -s resolveAllDependencies

build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -616,9 +616,10 @@ if (System.properties.get("build.compare") != null) {
616616

617617
allprojects {
618618
task resolveAllDependencies {
619-
doLast {
620-
configurations.findAll { it.isCanBeResolved() }.each { it.resolve() }
621-
}
619+
dependsOn tasks.matching { it.name == "pullFixture"}
620+
doLast {
621+
configurations.findAll { it.isCanBeResolved() }.each { it.resolve() }
622+
}
622623
}
623624
}
624625

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ package com.carrotsearch.gradle.junit4
33
import com.carrotsearch.ant.tasks.junit4.JUnit4
44
import org.gradle.api.Plugin
55
import org.gradle.api.Project
6-
import org.gradle.api.Task
76
import org.gradle.api.tasks.TaskContainer
87

98
class RandomizedTestingPlugin implements Plugin<Project> {
109

1110
void apply(Project project) {
12-
setupSeed(project)
11+
String seed = setupSeed(project)
1312
createUnitTestTask(project.tasks)
14-
configureAnt(project.ant)
13+
configureAnt(project.ant, seed)
1514
}
1615

1716
/**
@@ -21,12 +20,12 @@ class RandomizedTestingPlugin implements Plugin<Project> {
2120
* outcome of subsequent runs. Pinning the seed up front like this makes
2221
* the reproduction line from one run be useful on another run.
2322
*/
24-
static void setupSeed(Project project) {
23+
static String setupSeed(Project project) {
2524
if (project.rootProject.ext.has('testSeed')) {
2625
/* Skip this if we've already pinned the testSeed. It is important
2726
* that this checks the rootProject so that we know we've only ever
2827
* initialized one time. */
29-
return
28+
return project.rootProject.ext.testSeed
3029
}
3130
String testSeed = System.getProperty('tests.seed')
3231
if (testSeed == null) {
@@ -39,6 +38,8 @@ class RandomizedTestingPlugin implements Plugin<Project> {
3938
project.rootProject.subprojects {
4039
project.ext.testSeed = testSeed
4140
}
41+
42+
return testSeed
4243
}
4344

4445
static void createUnitTestTask(TaskContainer tasks) {
@@ -52,7 +53,8 @@ class RandomizedTestingPlugin implements Plugin<Project> {
5253
}
5354
}
5455

55-
static void configureAnt(AntBuilder ant) {
56+
static void configureAnt(AntBuilder ant, String seed) {
5657
ant.project.addTaskDefinition('junit4:junit4', JUnit4.class)
58+
ant.properties.put('tests.seed', seed)
5759
}
5860
}

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

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import com.carrotsearch.ant.tasks.junit4.events.aggregated.HeartBeatEvent
3232
import com.carrotsearch.ant.tasks.junit4.listeners.AggregatedEventListener
3333
import org.gradle.internal.logging.progress.ProgressLogger
3434
import org.gradle.internal.logging.progress.ProgressLoggerFactory
35+
import org.junit.runner.Description
3536

3637
import static com.carrotsearch.ant.tasks.junit4.FormattingUtils.formatDurationInSeconds
3738
import static com.carrotsearch.ant.tasks.junit4.events.aggregated.TestStatus.ERROR
@@ -113,7 +114,7 @@ class TestProgressLogger implements AggregatedEventListener {
113114

114115
@Subscribe
115116
void onSuiteStart(AggregatedSuiteStartedEvent e) throws IOException {
116-
String suiteName = simpleName(e.suiteStartedEvent.description.className)
117+
String suiteName = simpleName(e.suiteStartedEvent.description)
117118
slaveLoggers[e.slave.id].progress("J${e.slave.id}: ${suiteName} - initializing")
118119
}
119120

@@ -146,31 +147,45 @@ class TestProgressLogger implements AggregatedEventListener {
146147
throw new IllegalArgumentException("Unknown test status: [${e.status}]")
147148
}
148149
testLogger.progress("Tests: completed: ${testsCompleted}, failed: ${testsFailed}, ignored: ${testsIgnored}")
149-
String testName = simpleName(e.description.className) + '.' + e.description.methodName
150+
String testName = testName(e.description)
150151
slaveLoggers[e.slave.id].progress("J${e.slave.id}: ${testName} ${statusMessage}")
151152
}
152153

153154
@Subscribe
154155
void onTestStarted(TestStartedEvent e) throws IOException {
155-
String testName = simpleName(e.description.className) + '.' + e.description.methodName
156+
String testName = testName(e.description)
156157
slaveLoggers[e.slave.id].progress("J${e.slave.id}: ${testName} ...")
157158
}
158159

159160
@Subscribe
160161
void onHeartbeat(HeartBeatEvent e) throws IOException {
161-
String testName = simpleName(e.description.className) + '.' + e.description.methodName
162+
String testName = testName(e.description)
162163
String time = formatDurationInSeconds(e.getNoEventDuration())
163164
slaveLoggers[e.slave.id].progress("J${e.slave.id}: ${testName} stalled for ${time}")
164165
}
165166

167+
/**
168+
* Build the test name in the format of <className>.<methodName>
169+
*/
170+
private static String testName(Description description) {
171+
String className = simpleName(description)
172+
if (description == null) {
173+
return className + "." + "<unknownMethod>"
174+
}
175+
return className + "." + description.methodName
176+
}
177+
166178
/**
167179
* Extract a Class#getSimpleName style name from Class#getName style
168180
* string. We can't just use Class#getSimpleName because junit descriptions
169181
* don't always set the class field but they always set the className
170182
* field.
171183
*/
172-
private static String simpleName(String className) {
173-
return className.substring(className.lastIndexOf('.') + 1)
184+
private static String simpleName(Description description) {
185+
if (description == null) {
186+
return "<unknownClass>"
187+
}
188+
return description.className.substring(description.className.lastIndexOf('.') + 1)
174189
}
175190

176191
@Override

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,16 @@ class ClusterConfiguration {
118118
if (seedNode == node) {
119119
return null
120120
}
121-
ant.waitfor(maxwait: '40', maxwaitunit: 'second', checkevery: '500', checkeveryunit: 'millisecond') {
121+
ant.waitfor(maxwait: '40', maxwaitunit: 'second', checkevery: '500', checkeveryunit: 'millisecond',
122+
timeoutproperty: "failed.${seedNode.transportPortsFile.path}") {
122123
resourceexists {
123124
file(file: seedNode.transportPortsFile.toString())
124125
}
125126
}
127+
if (ant.properties.containsKey("failed.${seedNode.transportPortsFile.path}".toString())) {
128+
throw new GradleException("Failed to locate seed node transport file [${seedNode.transportPortsFile}]: " +
129+
"timed out waiting for it to be created after ${waitSeconds} seconds")
130+
}
126131
return seedNode.transportUri()
127132
}
128133

buildSrc/src/main/groovy/org/elasticsearch/gradle/vagrant/VagrantTestPlugin.groovy

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,11 @@ class VagrantTestPlugin implements Plugin<Project> {
547547
project.gradle.removeListener(batsPackagingReproListener)
548548
}
549549
if (project.extensions.esvagrant.boxes.contains(box)) {
550-
packagingTest.dependsOn(batsPackagingTest)
550+
// these tests are temporarily disabled for suse boxes while we debug an issue
551+
// https://github.com/elastic/elasticsearch/issues/30295
552+
if (box.equals("opensuse-42") == false && box.equals("sles-12") == false) {
553+
packagingTest.dependsOn(batsPackagingTest)
554+
}
551555
}
552556
}
553557

@@ -586,7 +590,11 @@ class VagrantTestPlugin implements Plugin<Project> {
586590
project.gradle.removeListener(javaPackagingReproListener)
587591
}
588592
if (project.extensions.esvagrant.boxes.contains(box)) {
589-
packagingTest.dependsOn(javaPackagingTest)
593+
// these tests are temporarily disabled for suse boxes while we debug an issue
594+
// https://github.com/elastic/elasticsearch/issues/30295
595+
if (box.equals("opensuse-42") == false && box.equals("sles-12") == false) {
596+
packagingTest.dependsOn(javaPackagingTest)
597+
}
590598
}
591599

592600
/*

buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -243,35 +243,46 @@ synchronized void stop(boolean tailLogs) {
243243
}
244244
logger.info("Stopping `{}`, tailLogs: {}", this, tailLogs);
245245
requireNonNull(esProcess, "Can't stop `" + this + "` as it was not started or already stopped.");
246-
stopHandle(esProcess.toHandle());
246+
// Test clusters are not reused, don't spend time on a graceful shutdown
247+
stopHandle(esProcess.toHandle(), true);
247248
if (tailLogs) {
248249
logFileContents("Standard output of node", esStdoutFile);
249250
logFileContents("Standard error of node", esStderrFile);
250251
}
251252
esProcess = null;
252253
}
253254

254-
private void stopHandle(ProcessHandle processHandle) {
255+
private void stopHandle(ProcessHandle processHandle, boolean forcibly) {
255256
// Stop all children first, ES could actually be a child when there's some wrapper process like on Windows.
256-
if (processHandle.isAlive()) {
257-
processHandle.children().forEach(this::stopHandle);
258-
}
259-
logProcessInfo("Terminating elasticsearch process:", processHandle.info());
260-
if (processHandle.isAlive()) {
261-
processHandle.destroy();
262-
} else {
257+
if (processHandle.isAlive() == false) {
263258
logger.info("Process was not running when we tried to terminate it.");
259+
return;
264260
}
265-
waitForProcessToExit(processHandle);
266-
if (processHandle.isAlive()) {
261+
262+
// Stop all children first, ES could actually be a child when there's some wrapper process like on Windows.
263+
processHandle.children().forEach(each -> stopHandle(each, forcibly));
264+
265+
logProcessInfo(
266+
"Terminating elasticsearch process" + (forcibly ? " forcibly " : "gracefully") + ":",
267+
processHandle.info()
268+
);
269+
270+
if (forcibly) {
271+
processHandle.destroyForcibly();
272+
} else {
273+
processHandle.destroy();
274+
waitForProcessToExit(processHandle);
275+
if (processHandle.isAlive() == false) {
276+
return;
277+
}
267278
logger.info("process did not terminate after {} {}, stopping it forcefully",
268-
ES_DESTROY_TIMEOUT, ES_DESTROY_TIMEOUT_UNIT
269-
);
279+
ES_DESTROY_TIMEOUT, ES_DESTROY_TIMEOUT_UNIT);
270280
processHandle.destroyForcibly();
271281
}
282+
272283
waitForProcessToExit(processHandle);
273284
if (processHandle.isAlive()) {
274-
throw new TestClustersException("Was not able to terminate es process");
285+
throw new TestClustersException("Was not able to terminate elasticsearch process");
275286
}
276287
}
277288

buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/SyncTestClustersConfiguration.java

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)