From 70effe47d3a1f50b01bfebba11f9df4dd26e8fef Mon Sep 17 00:00:00 2001 From: Alpar Torok Date: Fri, 18 May 2018 09:16:09 +0300 Subject: [PATCH 01/28] Move to Gradle 4.8 RC1 --- gradle/wrapper/gradle-wrapper.jar | Bin 54329 -> 54413 bytes gradle/wrapper/gradle-wrapper.properties | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index a5fe1cb94b9ee5ce57e6113458225bcba12d83e3..91ca28c8b802289c3a438766657a5e98f20eff03 100644 GIT binary patch delta 7397 zcmY+JWmFVEyv3IV=@jV(>F!z@2@w$KmS%wkX_s20k!ES6J0t|8k&cC>kxuDOX?#B4 zJ1^$b@7_Ce=FH5Ong2AGqQ;b=#*3n*Sr_*uNE)JFxShG70OBcY>n*sk%p!xW6fgjQ zBRDM&7tC8npX5nn+ckXXnY>Y{cCI=kWN6%){zd#LVaB+K7p4${BAbJYEe{+=^g7o2 z__WmJ>zD&~hr|ATWSj$-S%Gb#e5Sm?p<;&4WZ3+X?4hqH!1wr#Ksqkbh>`eCw*T+> zdr4oIU5+5{&z^U6jHJ3~r{01DW22Zt>hf#9IBE|C7t*QCvC|Q0*{0hOPzIC%= zQ~86R@Nx1*(OD6DAAhX2>zDp?^3l(m3<+(5VctWD-UDZ}ZTc@y9Q*FiP_%Axap|1< z!cW)r{Ltu)8r7|NIH$V8}$P&4CK|U7pkjTPh7{DVY2-*0E<=ux<`7XB~s7k>OnJOT0zW_N)}E z+g1`<4W42#8BC;7L%Z2UF=_s>L?z*|w|n&6dGuDALeY@xl%#dE8tsB$VoFb#-B1$; z?l2EYZZ3fYzSNvjt^GTfLZ5Ck_rS zb=+}lXfza2Kg4%j^mWuVtR-m0-PGJ-<{|A1_w>f(M2+>%gZeS4Q=RPJtsOa~wu^M{;luOUT~@`NyIiV`8gW1%!)1FBg69GkONB9Yy5ArTOk<9HJqOLnS; z_ha%bf9_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yv{EKCR=@KCA-J07r9jtCPY;sErsxLYFqSy zpRa`6c&VNj7E~Q>XAh<9oheJb>bN1#aCs7v_)4pLc*@?EQ&+qPN2_w=%C)pPU z`qG1bHY0&$@%oV_A8o70y;+Pe*M6Yqz<13#?yku5Wb}o`ow?(564Msn(j|Voblb)y zb|hBE{poM|>~Gfe*mNKoObWrCHJ1s*+--P2(MHqnkF%#k*V`bkd@4IA8qKtXEsQhun;iPD7L>yhJ6ke)XRkB}778=2oy^9^2e3 zJ#NlJ8DE3^`Vs~_&n-%CH4QYuQvMRM?o@?_ukh<3%KLsnYE>|n$%zJ-W^_wDDeco>i?Zrz?xQ(wY&{+Pf&Ui42owzveuMd`stT-H7EU&5ERaH&#e z0(CveCSFA9SD?iGTpHL|@f>w9Q3-0_h4h zpYBigduDhd=e4<>eUq|S} z{#`y z02v-yBI&;8gyghq(jl-vqS3YSvt_En#Tw`XN)VGp~NL=Whi+2*1ihlybmgwR9gCQFuzY zZz!)yx6?V~`Y_65uc;|1I~r6m`c?iMOi{S-7o1FWHLs%9x?(+c$M^k$ zC7NN3nW?iyc^q7-AWup4dqAAGsw(mBUg2A275Mznkl@sm-k@l@@U22}sGpjs>j z&=CJu+sS)Gp5p&Taevde{|<6K=*BQ1^khT;5UB7EMZfU_aFqUG!ADGJ`nUH0vXB4d z={GTe9Oxg8gD9bNg0+@7!_9at58^)#JEuiP)+JFI Date: Fri, 18 May 2018 09:16:27 +0300 Subject: [PATCH 02/28] Use latest version of plugin The current does not work with Gradle 4.8 RC1 --- buildSrc/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 5256968b6ca3e..50a6f07077845 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -106,7 +106,7 @@ GradleVersion logVersion = GradleVersion.current() > GradleVersion.version('4.3' dependencies { compileOnly "org.gradle:gradle-logging:${logVersion.getVersion()}" - compile 'ru.vyarus:gradle-animalsniffer-plugin:1.2.0' // Gradle 2.14 requires a version > 1.0.1 + compile 'ru.vyarus:gradle-animalsniffer-plugin:1.4.3' } /***************************************************************************** From 541ae72f41580b95d7ce96bc9676fe8c84885ac2 Mon Sep 17 00:00:00 2001 From: Alpar Torok Date: Mon, 11 Jun 2018 12:25:25 +0300 Subject: [PATCH 03/28] Switch to Gradle GA --- gradle/wrapper/gradle-wrapper.jar | Bin 54413 -> 54418 bytes gradle/wrapper/gradle-wrapper.properties | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 91ca28c8b802289c3a438766657a5e98f20eff03..f5a7e5e1fcf56305fbcbf1dda36c9786b8a2ec3d 100644 GIT binary patch delta 95 zcmeBO$vkN#^8|Ai&(Gi7Ct63aMSdvySj0H_V5;=SErEw5Heb;7x@OA45a7+u!MkbV pc?kvv1~DL>Jn^v1WRt_%V11jD58o5ugiBBMx?;;Fdl;yS0RR#VB98z7 delta 90 zcmbQVlDT&!^8|C287a$-PPC3-oB6ruV-e%zgQ?ORw*(#%HfCoC@Mh Date: Mon, 11 Jun 2018 16:03:33 +0300 Subject: [PATCH 04/28] Add and configure build compare plugin --- build.gradle | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build.gradle b/build.gradle index 9bb08cf29dbbc..068c8e00ea25c 100644 --- a/build.gradle +++ b/build.gradle @@ -575,3 +575,12 @@ gradle.projectsEvaluated { } } } + +apply plugin: 'compare-gradle-builds' + +compareGradleBuilds { + targetBuild { + gradleVersion = "4.7" + tasks = [ "assemble" ] + } +} From b0c9ff4dcc63de22f5001eae13edde62db6ab385 Mon Sep 17 00:00:00 2001 From: Alpar Torok Date: Mon, 11 Jun 2018 16:03:58 +0300 Subject: [PATCH 05/28] add work-around for https://github.com/gradle/gradle/issues/5692 --- .../main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index eb3cd1dc8c6da..6b5e6f5a3ff5f 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -348,7 +348,10 @@ class BuildPlugin implements Plugin { // just a self contained test-fixture configuration, likely transitive and hellacious return } - configuration.resolutionStrategy.failOnVersionConflict() + configuration.resolutionStrategy { + failOnVersionConflict() + preferProjectModules() + } }) // force all dependencies added directly to compile/testCompile to be non-transitive, except for ES itself From b18dc3085a6487c3b16e167d05a2508bdf8f25e0 Mon Sep 17 00:00:00 2001 From: Alpar Torok Date: Tue, 12 Jun 2018 13:35:39 +0300 Subject: [PATCH 06/28] work around https://github.com/gradle/gradle/issues/5696 --- .../org/elasticsearch/gradle/BuildPlugin.groovy | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index 6b5e6f5a3ff5f..a72a189a7a513 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -478,13 +478,15 @@ class BuildPlugin implements Plugin { } } - project.tasks.withType(GenerateMavenPom.class) { GenerateMavenPom t -> - // place the pom next to the jar it is for - t.destination = new File(project.buildDir, "distributions/${project.archivesBaseName}-${project.version}.pom") - // build poms with assemble (if the assemble task exists) - Task assemble = project.tasks.findByName('assemble') - if (assemble) { - assemble.dependsOn(t) + project.getGradle().getTaskGraph().whenReady { + project.tasks.withType(GenerateMavenPom.class) { GenerateMavenPom t -> + // place the pom next to the jar it is for + t.destination = new File(project.buildDir, "distributions/${project.archivesBaseName}-${project.version}.pom") + // build poms with assemble (if the assemble task exists) + Task assemble = project.tasks.findByName('assemble') + if (assemble) { + assemble.dependsOn(t) + } } } } From d6479de1aaf3189c74478544f3c1b4e72247df9f Mon Sep 17 00:00:00 2001 From: Alpar Torok Date: Tue, 12 Jun 2018 14:00:53 +0300 Subject: [PATCH 07/28] Make use of Gradle build compare with reference project --- build.gradle | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 068c8e00ea25c..f447c92a3866f 100644 --- a/build.gradle +++ b/build.gradle @@ -579,8 +579,19 @@ gradle.projectsEvaluated { apply plugin: 'compare-gradle-builds' compareGradleBuilds { - targetBuild { - gradleVersion = "4.7" - tasks = [ "assemble" ] + ext.referenceProject = "../elasticsearch_build_reference" + doFirst { + if (file(referenceProject).exists() == false) { + throw new GradleException( + "Use git worktree to check out a version to compare against to ../elasticsearch_build_reference" + ) } + } + sourceBuild { + projectDir = referenceProject + tasks = [ "clean", "assemble" ] + } + targetBuild { + tasks = [ "clean", "assemble" ] + } } From bbb2f9a58d697d734073521163fb57ce69230ddf Mon Sep 17 00:00:00 2001 From: Alpar Torok Date: Tue, 12 Jun 2018 14:38:02 +0300 Subject: [PATCH 08/28] Make the manifest more compare friendly --- build.gradle | 4 ++++ .../groovy/org/elasticsearch/gradle/BuildPlugin.groovy | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/build.gradle b/build.gradle index f447c92a3866f..5c05896c009bc 100644 --- a/build.gradle +++ b/build.gradle @@ -588,10 +588,14 @@ compareGradleBuilds { } } sourceBuild { + gradleVersion = "4.7" // does not default to gradle weapper of project dir, but current version projectDir = referenceProject tasks = [ "clean", "assemble" ] + arguments = ["-Dbuild.compare_friendly=true"] } targetBuild { tasks = [ "clean", "assemble" ] + // use -Dorg.gradle.java.home= to alter jdk versions + arguments = ["-Dbuild.compare_friendly=true"] } } diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index a72a189a7a513..bddb6e78fdf45 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -630,6 +630,13 @@ class BuildPlugin implements Plugin { jarTask.manifest.attributes('Change': shortHash) } } + // Force manifest entries that change by nature to a constant to be able to compare builds more effectively + if (System.properties.getProperty("build.compare_friendly", "false") == "true") { + jarTask.manifest.attributes( + 'Gradle-Version': 'compare_friendly', + 'Build-Date': 'compare_friendly' + ) + } } // add license/notice files project.afterEvaluate { From 302f171fe16e9f4a12f7a6e983a4d55b02bc1529 Mon Sep 17 00:00:00 2001 From: Alpar Torok Date: Tue, 12 Jun 2018 16:19:11 +0300 Subject: [PATCH 09/28] Clear the manifest in compare friendly mode --- .../main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index bddb6e78fdf45..a8b677e582258 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -632,10 +632,7 @@ class BuildPlugin implements Plugin { } // Force manifest entries that change by nature to a constant to be able to compare builds more effectively if (System.properties.getProperty("build.compare_friendly", "false") == "true") { - jarTask.manifest.attributes( - 'Gradle-Version': 'compare_friendly', - 'Build-Date': 'compare_friendly' - ) + jarTask.manifest.getAttributes().clear() } } // add license/notice files From 50b7c3c8ba8a01d4130be403c2a4392f011c9438 Mon Sep 17 00:00:00 2001 From: Alpar Torok Date: Tue, 12 Jun 2018 16:37:57 +0300 Subject: [PATCH 10/28] Remove animalsniffer from buildscript classpath --- buildSrc/build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 50a6f07077845..9c139eee2152a 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -106,7 +106,6 @@ GradleVersion logVersion = GradleVersion.current() > GradleVersion.version('4.3' dependencies { compileOnly "org.gradle:gradle-logging:${logVersion.getVersion()}" - compile 'ru.vyarus:gradle-animalsniffer-plugin:1.4.3' } /***************************************************************************** From db8ebd300168202f3dd90b59c577fea6474911d0 Mon Sep 17 00:00:00 2001 From: Alpar Torok Date: Thu, 14 Jun 2018 15:53:53 +0300 Subject: [PATCH 11/28] reference Gradle issues in comments --- .../main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index a8b677e582258..e69fc3821a768 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -350,6 +350,7 @@ class BuildPlugin implements Plugin { } configuration.resolutionStrategy { failOnVersionConflict() + // work around https://github.com/gradle/gradle/issues/5692 preferProjectModules() } }) @@ -478,6 +479,8 @@ class BuildPlugin implements Plugin { } } + // Work around Gradle 4.8 issue until we `enableFeaturePreview('STABLE_PUBLISHING')` + // https://github.com/gradle/gradle/issues/5696#issuecomment-396965185 project.getGradle().getTaskGraph().whenReady { project.tasks.withType(GenerateMavenPom.class) { GenerateMavenPom t -> // place the pom next to the jar it is for From 869a84b1789047eda250684893255eed8e249357 Mon Sep 17 00:00:00 2001 From: Alpar Torok Date: Thu, 14 Jun 2018 16:03:11 +0300 Subject: [PATCH 12/28] Conditionally configure build compare --- build.gradle | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/build.gradle b/build.gradle index 5c05896c009bc..dc67294f3d140 100644 --- a/build.gradle +++ b/build.gradle @@ -578,24 +578,26 @@ gradle.projectsEvaluated { apply plugin: 'compare-gradle-builds' -compareGradleBuilds { - ext.referenceProject = "../elasticsearch_build_reference" - doFirst { - if (file(referenceProject).exists() == false) { - throw new GradleException( - "Use git worktree to check out a version to compare against to ../elasticsearch_build_reference" - ) +if (System.properties.get("build.compare") != null) { + compareGradleBuilds { + ext.referenceProject = System.properties.get("build.compare") + doFirst { + if (file(referenceProject).exists() == false) { + throw new GradleException( + "Use git worktree to check out a version to compare against to ../elasticsearch_build_reference" + ) + } + } + sourceBuild { + gradleVersion = "4.7" // does not default to gradle weapper of project dir, but current version + projectDir = referenceProject + tasks = ["clean", "assemble"] + arguments = ["-Dbuild.compare_friendly=true"] + } + targetBuild { + tasks = ["clean", "assemble"] + // use -Dorg.gradle.java.home= to alter jdk versions + arguments = ["-Dbuild.compare_friendly=true"] } - } - sourceBuild { - gradleVersion = "4.7" // does not default to gradle weapper of project dir, but current version - projectDir = referenceProject - tasks = [ "clean", "assemble" ] - arguments = ["-Dbuild.compare_friendly=true"] - } - targetBuild { - tasks = [ "clean", "assemble" ] - // use -Dorg.gradle.java.home= to alter jdk versions - arguments = ["-Dbuild.compare_friendly=true"] } } From a54139c0c75a0623d83d0082c4551e54ee312240 Mon Sep 17 00:00:00 2001 From: Alpar Torok Date: Tue, 12 Jun 2018 17:50:19 +0300 Subject: [PATCH 13/28] Fix javadoc errors --- .../main/java/org/elasticsearch/client/RestClient.java | 4 ++-- .../src/main/java/org/elasticsearch/search/SearchHit.java | 4 ++-- .../bucket/composite/CompositeAggregator.java | 2 +- .../bucket/composite/CompositeValuesCollectorQueue.java | 2 +- .../bucket/composite/SingleDimensionValuesSource.java | 8 ++++---- .../org/elasticsearch/xpack/rollup/job/RollupIndexer.java | 3 ++- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/client/rest/src/main/java/org/elasticsearch/client/RestClient.java b/client/rest/src/main/java/org/elasticsearch/client/RestClient.java index 82039cab5d04c..1a2d767d68923 100644 --- a/client/rest/src/main/java/org/elasticsearch/client/RestClient.java +++ b/client/rest/src/main/java/org/elasticsearch/client/RestClient.java @@ -1008,8 +1008,8 @@ public int compareTo(DeadNode rhs) { } /** - * Adapts an Iterator into an - * Iterator. + * Adapts an Iterator<DeadNodeAndRevival> into an + * Iterator<Node>. */ private static class DeadNodeIteratorAdapter implements Iterator { private final Iterator itr; diff --git a/server/src/main/java/org/elasticsearch/search/SearchHit.java b/server/src/main/java/org/elasticsearch/search/SearchHit.java index 34b48fce941f8..8c688cbf4466a 100644 --- a/server/src/main/java/org/elasticsearch/search/SearchHit.java +++ b/server/src/main/java/org/elasticsearch/search/SearchHit.java @@ -497,8 +497,8 @@ public XContentBuilder toInnerXContent(XContentBuilder builder, Params params) t * This parser outputs a temporary map of the objects needed to create the * SearchHit instead of directly creating the SearchHit. The reason for this * is that this way we can reuse the parser when parsing xContent from - * {@link CompletionSuggestion.Entry.Option} which unfortunately inlines the - * output of + * {@link org.elasticsearch.search.suggest.completion.CompletionSuggestion.Entry.Option} which unfortunately inlines + * the output of * {@link #toInnerXContent(XContentBuilder, org.elasticsearch.common.xcontent.ToXContent.Params)} * of the included search hit. The output of the map is used to create the * actual SearchHit instance via {@link #createFromMap(Map)} diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/CompositeAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/CompositeAggregator.java index 2cde321230ebc..ab529ac033e73 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/CompositeAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/CompositeAggregator.java @@ -200,7 +200,7 @@ public void collect(int doc, long bucket) throws IOException { /** * Replay the documents that might contain a top bucket and pass top buckets to - * the {@link this#deferredCollectors}. + * the {@link #deferredCollectors}. */ private void runDeferredCollections() throws IOException { final boolean needsScores = needsScores(); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/CompositeValuesCollectorQueue.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/CompositeValuesCollectorQueue.java index b7b29a8841489..38e22296333ae 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/CompositeValuesCollectorQueue.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/CompositeValuesCollectorQueue.java @@ -49,7 +49,7 @@ final class CompositeValuesCollectorQueue implements Releasable { * * @param sources The list of {@link CompositeValuesSourceConfig} to build the composite buckets. * @param size The number of composite buckets to keep. - * @param afterKey + * @param afterKey composite key */ CompositeValuesCollectorQueue(BigArrays bigArrays, SingleDimensionValuesSource[] sources, int size, CompositeKey afterKey) { this.bigArrays = bigArrays; diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/SingleDimensionValuesSource.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/SingleDimensionValuesSource.java index 1718bb4204879..c73820fc32a78 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/SingleDimensionValuesSource.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/SingleDimensionValuesSource.java @@ -74,7 +74,7 @@ abstract class SingleDimensionValuesSource> implements R * The current value is filled by a {@link LeafBucketCollector} that visits all the * values of each document. This method saves this current value in a slot and should only be used * in the context of a collection. - * See {@link this#getLeafCollector}. + * See {@link #getLeafCollector}. */ abstract void copyCurrent(int slot); @@ -87,7 +87,7 @@ abstract class SingleDimensionValuesSource> implements R * The current value is filled by a {@link LeafBucketCollector} that visits all the * values of each document. This method compares this current value with the value present in * the provided slot and should only be used in the context of a collection. - * See {@link this#getLeafCollector}. + * See {@link #getLeafCollector}. */ abstract int compareCurrent(int slot); @@ -95,7 +95,7 @@ abstract class SingleDimensionValuesSource> implements R * The current value is filled by a {@link LeafBucketCollector} that visits all the * values of each document. This method compares this current value with the after value * set on this source and should only be used in the context of a collection. - * See {@link this#getLeafCollector}. + * See {@link #getLeafCollector}. */ abstract int compareCurrentWithAfter(); @@ -120,7 +120,7 @@ T getAfter() { * Creates a {@link LeafBucketCollector} that extracts all values from a document and invokes * {@link LeafBucketCollector#collect} on the provided next collector for each of them. * The current value of this source is set on each call and can be accessed by next via - * the {@link this#copyCurrent(int)} and {@link this#compareCurrent(int)} methods. Note that these methods + * the {@link #copyCurrent(int)} and {@link #compareCurrent(int)} methods. Note that these methods * are only valid when invoked from the {@link LeafBucketCollector} created in this source. */ abstract LeafBucketCollector getLeafCollector(LeafReaderContext context, LeafBucketCollector next) throws IOException; diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/job/RollupIndexer.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/job/RollupIndexer.java index 3ba3611293fdc..730a1669616d4 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/job/RollupIndexer.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/job/RollupIndexer.java @@ -405,7 +405,8 @@ private CompositeAggregationBuilder createCompositeBuilder(RollupJobConfig confi } /** - * Creates the range query that limits the search to documents that appear before the maximum allowed time (see {@link this#maxBoundary} + * Creates the range query that limits the search to documents that appear before the maximum allowed time + * (see {@link #maxBoundary} * and on or after the last processed time. * @param position The current position of the pagination * @return The range query to execute From db92ced33596afe7fac66ecdd8800859b7420832 Mon Sep 17 00:00:00 2001 From: Alpar Torok Date: Wed, 13 Jun 2018 11:15:47 +0300 Subject: [PATCH 14/28] Fix doc issues --- .../common/xcontent/BaseXContentTestCase.java | 2 +- .../org/elasticsearch/index/mapper/package-info.java | 4 +--- .../elasticsearch/index/shard/IndexShardTestCase.java | 2 +- .../org/elasticsearch/test/AbstractQueryTestCase.java | 1 - .../org/elasticsearch/license/ExpirationCallback.java | 6 +++--- .../java/org/elasticsearch/xpack/core/ssl/DerParser.java | 9 ++++----- .../java/org/elasticsearch/xpack/core/ssl/PemUtils.java | 2 -- .../xpack/core/ssl/RestrictedTrustManager.java | 2 +- .../security/support/RestorableContextClassLoader.java | 2 +- .../xpack/sql/expression/predicate/Range.java | 4 ++-- 10 files changed, 14 insertions(+), 20 deletions(-) diff --git a/server/src/test/java/org/elasticsearch/common/xcontent/BaseXContentTestCase.java b/server/src/test/java/org/elasticsearch/common/xcontent/BaseXContentTestCase.java index 86e55c1ab6a91..7d8699c320435 100644 --- a/server/src/test/java/org/elasticsearch/common/xcontent/BaseXContentTestCase.java +++ b/server/src/test/java/org/elasticsearch/common/xcontent/BaseXContentTestCase.java @@ -854,7 +854,7 @@ public void testEnsureNoSelfReferences() throws IOException { /** * Test that the same map written multiple times do not trigger the self-reference check in - * {@link CollectionUtils#ensureNoSelfReferences(Object)} + * {@link CollectionUtils#ensureNoSelfReferences(Object, String)} (Object)} */ public void testRepeatedMapsAndNoSelfReferences() throws Exception { Map mapB = singletonMap("b", "B"); diff --git a/server/src/test/java/org/elasticsearch/index/mapper/package-info.java b/server/src/test/java/org/elasticsearch/index/mapper/package-info.java index 4221a5d4a9668..9a06e56a820a5 100644 --- a/server/src/test/java/org/elasticsearch/index/mapper/package-info.java +++ b/server/src/test/java/org/elasticsearch/index/mapper/package-info.java @@ -19,9 +19,7 @@ /** * Mappings. Mappings define the way that documents should be translated to - * Lucene indices, for instance how the - * {@link org.elasticsearch.index.mapper.UidFieldMapper document identifier} - * should be indexed, whether a string field should be indexed as a + * Lucene indices, for instance whether a string field should be indexed as a * {@link org.elasticsearch.index.mapper.TextFieldMapper text} or * {@link org.elasticsearch.index.mapper.KeywordFieldMapper keyword} field, * etc. This parsing is done by the diff --git a/test/framework/src/main/java/org/elasticsearch/index/shard/IndexShardTestCase.java b/test/framework/src/main/java/org/elasticsearch/index/shard/IndexShardTestCase.java index 9b21af713701a..5a8e91841c5a7 100644 --- a/test/framework/src/main/java/org/elasticsearch/index/shard/IndexShardTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/index/shard/IndexShardTestCase.java @@ -275,7 +275,7 @@ protected IndexShard newShard(ShardRouting routing, IndexMetaData indexMetaData, * @param indexMetaData indexMetaData for the shard, including any mapping * @param indexSearcherWrapper an optional wrapper to be used during searchers * @param globalCheckpointSyncer callback for syncing global checkpoints - * @param indexEventListener + * @param indexEventListener index even listener * @param listeners an optional set of listeners to add to the shard */ protected IndexShard newShard(ShardRouting routing, ShardPath shardPath, IndexMetaData indexMetaData, diff --git a/test/framework/src/main/java/org/elasticsearch/test/AbstractQueryTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/AbstractQueryTestCase.java index 48301fa5746e2..a2acc5371a19e 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/AbstractQueryTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/AbstractQueryTestCase.java @@ -132,7 +132,6 @@ protected String[] shuffleProtectedFields() { * To find the right position in the root query, we add a marker as `queryName` which * all query builders support. The added bogus field after that should trigger the exception. * Queries that allow arbitrary field names at this level need to override this test. - * @throws IOException */ public void testUnknownField() throws IOException { String marker = "#marker#"; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/ExpirationCallback.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/ExpirationCallback.java index 26bec9e62948f..d3916f9dd3ab1 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/ExpirationCallback.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/ExpirationCallback.java @@ -134,8 +134,8 @@ final TimeValue delay(long expirationDate, long now) { } /** - * {@link SchedulerEngine.Schedule#nextScheduledTimeAfter(long, long)} with respect to - * license expiry date + * {@link org.elasticsearch.xpack.core.scheduler.SchedulerEngine.Schedule#nextScheduledTimeAfter(long, long)} + * with respect to license expiry date */ public final long nextScheduledTimeForExpiry(long expiryDate, long startTime, long time) { TimeValue delay = delay(expiryDate, time); @@ -169,4 +169,4 @@ public final String toString() { orientation.name(), TimeValue.timeValueMillis(min), TimeValue.timeValueMillis(max), TimeValue.timeValueMillis(frequency)); } -} \ No newline at end of file +} diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/DerParser.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/DerParser.java index fedbbb3194724..ae15c70e97b9b 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/DerParser.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/DerParser.java @@ -87,7 +87,8 @@ Asn1Object readAsn1Object() throws IOException { * Decode the length of the field. Can only support length * encoding up to 4 octets. *

- *

In BER/DER encoding, length can be encoded in 2 forms, + * In BER/DER encoding, length can be encoded in 2 forms: + *

*
    *
  • Short form. One octet. Bit 8 has value "0" and bits 7-1 * give the length. @@ -100,7 +101,6 @@ Asn1Object readAsn1Object() throws IOException { *
* * @return The length as integer - * @throws IOException */ private int getLength() throws IOException { @@ -145,7 +145,8 @@ static class Asn1Object { * Construct a ASN.1 TLV. The TLV could be either a * constructed or primitive entity. *

- *

The first byte in DER encoding is made of following fields, + * The first byte in DER encoding is made of following fields: + *

*
          * -------------------------------------------------
          * |Bit 8|Bit 7|Bit 6|Bit 5|Bit 4|Bit 3|Bit 2|Bit 1|
@@ -192,7 +193,6 @@ public boolean isConstructed() {
          * For constructed field, return a parser for its content.
          *
          * @return A parser for the construct.
-         * @throws IOException
          */
         public DerParser getParser() throws IOException {
             if (!isConstructed())
@@ -205,7 +205,6 @@ public DerParser getParser() throws IOException {
          * Get the value as integer
          *
          * @return BigInteger
-         * @throws IOException
          */
         public BigInteger getInteger() throws IOException {
             if (type != DerParser.INTEGER)
diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/PemUtils.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/PemUtils.java
index 9ff44d0135ffa..d959c017e0a35 100644
--- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/PemUtils.java
+++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/PemUtils.java
@@ -108,7 +108,6 @@ public static PrivateKey readPrivateKey(Path keyPath, Supplier passwordS
      * Removes the EC Headers that OpenSSL adds to EC private keys as the information in them
      * is redundant
      *
-     * @param bReader
      * @throws IOException if the EC Parameter footer is missing
      */
     private static BufferedReader removeECHeaders(BufferedReader bReader) throws IOException {
@@ -133,7 +132,6 @@ private static BufferedReader removeECHeaders(BufferedReader bReader) throws IOE
      * Removes the DSA Params Headers that OpenSSL adds to DSA private keys as the information in them
      * is redundant
      *
-     * @param bReader
      * @throws IOException if the EC Parameter footer is missing
      */
     private static BufferedReader removeDsaHeaders(BufferedReader bReader) throws IOException {
diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/RestrictedTrustManager.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/RestrictedTrustManager.java
index c49692dda98c1..8a82694785a28 100644
--- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/RestrictedTrustManager.java
+++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/RestrictedTrustManager.java
@@ -132,7 +132,7 @@ private Set readCommonNames(X509Certificate certificate) throws Certific
      * Decodes the otherName CN from the certificate
      *
      * @param value       The DER Encoded Subject Alternative Name
-     * @param certificate
+     * @param certificate The certificate
      * @return the CN or null if it could not be parsed
      */
     private String decodeDerValue(byte[] value, X509Certificate certificate) {
diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/RestorableContextClassLoader.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/RestorableContextClassLoader.java
index f2e36ebf98273..95c68eab9c28a 100644
--- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/RestorableContextClassLoader.java
+++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/RestorableContextClassLoader.java
@@ -12,7 +12,7 @@
 import org.elasticsearch.SpecialPermission;
 
 /**
- * A try-with-resource compatible object for configuring a thread {@link Thread#contextClassLoader}.
+ * A try-with-resource compatible object for configuring a thread {@link Thread#getContextClassLoader()}.
  * On construction this class will set the current (or provided) thread's context class loader.
  * On {@link #close()}, it restores the previous value of the class loader.
  */
diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/Range.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/Range.java
index 54d541ab406b7..c17e9634492a1 100644
--- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/Range.java
+++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/Range.java
@@ -87,7 +87,7 @@ public Object fold() {
     }
 
     /**
-     * Check whether the boundaries are invalid ( upper < lower) or not.
+     * Check whether the boundaries are invalid ( upper < lower) or not.
      * If they do, the value does not have to be evaluate.
      */
     private boolean areBoundariesInvalid() {
@@ -139,4 +139,4 @@ public String toString() {
         sb.append(upper);
         return sb.toString();
     }
-}
\ No newline at end of file
+}

From 93213abb9f9feb7553b438c6e8eb216591bc0aaa Mon Sep 17 00:00:00 2001
From: Alpar Torok 
Date: Mon, 18 Jun 2018 17:12:37 +0300
Subject: [PATCH 15/28] Fix some more doclint issues

---
 .../org/elasticsearch/client/RestClientSingleHostTests.java  | 2 +-
 .../test/java/org/elasticsearch/client/RestClientTests.java  | 2 +-
 .../xpack/security/authc/saml/SamlTestCase.java              | 5 +----
 .../java/org/elasticsearch/upgrades/IndexAuditUpgradeIT.java | 1 -
 4 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/client/rest/src/test/java/org/elasticsearch/client/RestClientSingleHostTests.java b/client/rest/src/test/java/org/elasticsearch/client/RestClientSingleHostTests.java
index 5987fe7dd9849..76e9f6ec883f0 100644
--- a/client/rest/src/test/java/org/elasticsearch/client/RestClientSingleHostTests.java
+++ b/client/rest/src/test/java/org/elasticsearch/client/RestClientSingleHostTests.java
@@ -314,7 +314,7 @@ public void testBody() throws IOException {
     }
 
     /**
-     * @deprecated will remove method in 7.0 but needs tests until then. Replaced by {@link RequestTests#testAddHeaders()}.
+     * @deprecated will remove method in 7.0 but needs tests until then. Replaced by {@link RequestTests}.
      */
     @Deprecated
     public void tesPerformRequestOldStyleNullHeaders() throws IOException {
diff --git a/client/rest/src/test/java/org/elasticsearch/client/RestClientTests.java b/client/rest/src/test/java/org/elasticsearch/client/RestClientTests.java
index 04742ccab4f32..d31a4386b3efb 100644
--- a/client/rest/src/test/java/org/elasticsearch/client/RestClientTests.java
+++ b/client/rest/src/test/java/org/elasticsearch/client/RestClientTests.java
@@ -141,7 +141,7 @@ public void onFailure(Exception exception) {
     }
 
     /**
-     * @deprecated will remove method in 7.0 but needs tests until then. Replaced by {@link RequestTests#testAddHeader()}.
+     * @deprecated will remove method in 7.0 but needs tests until then. Replaced by {@link RequestTests}.
      */
     @Deprecated
     public void testPerformOldStyleAsyncWithNullHeaders() throws Exception {
diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/saml/SamlTestCase.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/saml/SamlTestCase.java
index 51a6d8732a5b3..adaba34a73aa3 100644
--- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/saml/SamlTestCase.java
+++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/saml/SamlTestCase.java
@@ -64,7 +64,6 @@ public static void restoreLocale() throws Exception {
      * Generates signed certificate and associates with generated key pair.
      * @see #readRandomKeyPair(String)
      * @return X509Certificate a signed certificate, it's PrivateKey {@link Tuple}
-     * @throws Exception
      */
     protected static Tuple readRandomKeyPair() throws Exception {
         return readRandomKeyPair("RSA");
@@ -73,9 +72,7 @@ protected static Tuple readRandomKeyPair() throws E
     /**
      * Reads a key pair and associated certificate for given algorithm and key length
      * For testing, for "EC" algorithm 256 key size is used, others use 2048 as default.
-     * @param algorithm
-     * @return X509Certificate a signed certificate, it's PrivateKey {@link Tuple}
-     * @throws Exception
+     * @return X509Certificate a signed certificate, it's PrivateKey
      */
     protected static Tuple readRandomKeyPair(String algorithm) throws Exception {
         int keySize;
diff --git a/x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/IndexAuditUpgradeIT.java b/x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/IndexAuditUpgradeIT.java
index 7c81a7141a991..92a8c3d2f830f 100644
--- a/x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/IndexAuditUpgradeIT.java
+++ b/x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/IndexAuditUpgradeIT.java
@@ -87,7 +87,6 @@ private void assertNumUniqueNodeNameBuckets(int numBuckets) throws Exception {
 
     /**
      * Has the master been upgraded to the new version?
-     * @throws IOException
      */
     private boolean masterIsNewVersion() throws IOException {
         Map map = entityAsMap(client().performRequest("GET", "/_nodes/_master"));

From 46fefdc427f86a35c25906f5a1e4818160c02183 Mon Sep 17 00:00:00 2001
From: Alpar Torok 
Date: Tue, 19 Jun 2018 10:11:55 +0300
Subject: [PATCH 16/28] fix typo in build script

---
 benchmarks/build.gradle | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/benchmarks/build.gradle b/benchmarks/build.gradle
index bd80deda89c6f..e7ee5a059ab37 100644
--- a/benchmarks/build.gradle
+++ b/benchmarks/build.gradle
@@ -30,7 +30,7 @@ buildscript {
 
 apply plugin: 'elasticsearch.build'
 
-// order of this seciont matters, see: https://github.com/johnrengelman/shadow/issues/336
+// order of this section matters, see: https://github.com/johnrengelman/shadow/issues/336
 apply plugin: 'application' // have the shadow plugin provide the runShadow task
 mainClassName = 'org.openjdk.jmh.Main'
 apply plugin: 'com.github.johnrengelman.shadow' // build an uberjar with all benchmarks

From 5e53dee7cf4ddd87e86b90b6063355609ceb3e2b Mon Sep 17 00:00:00 2001
From: Alpar Torok 
Date: Tue, 19 Jun 2018 10:17:57 +0300
Subject: [PATCH 17/28] Add sanity check to make sure the test task was
 replaced

Relates to #31324. It seems like Gradle has an inconsistent behavior and
the taks is not always replaced.
---
 .../junit4/RandomizedTestingPlugin.groovy     | 23 +++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
index c375f773bf9b5..12e0ddff2bebe 100644
--- a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
+++ b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
@@ -2,6 +2,7 @@ package com.carrotsearch.gradle.junit4
 
 import com.carrotsearch.ant.tasks.junit4.JUnit4
 import org.gradle.api.AntBuilder
+import org.gradle.api.GradleException
 import org.gradle.api.Plugin
 import org.gradle.api.Project
 import org.gradle.api.Task
@@ -9,12 +10,34 @@ import org.gradle.api.plugins.JavaBasePlugin
 import org.gradle.api.tasks.TaskContainer
 import org.gradle.api.tasks.testing.Test
 
+import java.util.concurrent.atomic.AtomicBoolean
+
 class RandomizedTestingPlugin implements Plugin {
 
+    static private AtomicBoolean sanityCheckConfigured = new AtomicBoolean(false)
+
     void apply(Project project) {
         setupSeed(project)
         replaceTestTask(project.tasks)
         configureAnt(project.ant)
+        configureSanityCheck(project)
+    }
+
+    private static void configureSanityCheck(Project project) {
+        // Check the task graph to confirm tasks were indeed replaced
+        // https://github.com/elastic/elasticsearch/issues/31324
+        if (sanityCheckConfigured.getAndSet(true) == false) {
+            project.rootProject.getGradle().getTaskGraph().whenReady {
+                def nonConforming = project.getGradle().getTaskGraph().allTasks
+                        .findAll { it.name == "test" }
+                        .findAll { (it instanceof RandomizedTestingTask) == false}
+                        .collect { "${it.path} -> ${it.class}" }
+                if (nonConforming.isEmpty() == false) {
+                    throw new GradleException("Found the following `test` tasks:" +
+                            "\n  ${nonConforming.join("\n  ")}")
+                }
+            }
+        }
     }
 
     /**

From 9eaa07e86c5bf11e8e63932a019bcc4e62472a6e Mon Sep 17 00:00:00 2001
From: Alpar Torok 
Date: Tue, 19 Jun 2018 10:44:15 +0300
Subject: [PATCH 18/28] Include number of non conforming tasks in the
 exception.

---
 .../carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
index 12e0ddff2bebe..8682708686744 100644
--- a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
+++ b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
@@ -33,7 +33,7 @@ class RandomizedTestingPlugin implements Plugin {
                         .findAll { (it instanceof RandomizedTestingTask) == false}
                         .collect { "${it.path} -> ${it.class}" }
                 if (nonConforming.isEmpty() == false) {
-                    throw new GradleException("Found the following `test` tasks:" +
+                    throw new GradleException("Found the ${nonConforming.size()} `test` tasks:" +
                             "\n  ${nonConforming.join("\n  ")}")
                 }
             }

From 6ccfec815df482c301ba8ee486f61035ce34e1e5 Mon Sep 17 00:00:00 2001
From: Alpar Torok 
Date: Wed, 20 Jun 2018 11:56:16 +0300
Subject: [PATCH 19/28] No longer replace test task, create implicit instead

Closes #31324. The issue has full context in comments.

With this change the `test` task becomes nothing more than an alias for `utest`.
Some of the stand alone tests that had a `test` task now have `integTest`, and a
few of them that used to have `integTest` to run multiple tests now only
have `check`.
This will also help separarate unit/micro tests from integration tests.
---
 benchmarks/build.gradle                       |  2 -
 buildSrc/build.gradle                         |  2 +-
 .../junit4/RandomizedTestingPlugin.groovy     | 65 +++++++------------
 .../elasticsearch/gradle/BuildPlugin.groovy   |  4 +-
 .../gradle/plugin/PluginBuildPlugin.groovy    |  2 +-
 .../gradle/test/StandaloneTestPlugin.groovy   | 25 ++++---
 client/benchmark/build.gradle                 |  6 --
 .../build.gradle                              |  1 -
 client/test/build.gradle                      |  3 +-
 .../tools/java-version-checker/build.gradle   |  1 -
 distribution/tools/plugin-cli/build.gradle    |  2 +-
 libs/cli/build.gradle                         |  1 -
 libs/plugin-classloader/build.gradle          |  2 -
 modules/lang-painless/build.gradle            |  2 +-
 modules/lang-painless/spi/build.gradle        |  5 +-
 modules/reindex/build.gradle                  |  2 +-
 modules/transport-netty4/build.gradle         |  2 +-
 plugins/discovery-ec2/build.gradle            |  2 +-
 plugins/discovery-gce/build.gradle            |  2 +-
 .../examples/painless-whitelist/build.gradle  |  4 +-
 plugins/examples/rest-handler/build.gradle    |  3 -
 .../script-expert-scoring/build.gradle        |  1 -
 plugins/repository-s3/build.gradle            |  2 +-
 qa/die-with-dignity/build.gradle              |  2 -
 qa/evil-tests/build.gradle                    |  2 +-
 qa/full-cluster-restart/build.gradle          | 13 +---
 qa/mixed-cluster/build.gradle                 | 13 +---
 qa/multi-cluster-search/build.gradle          |  9 +--
 qa/query-builder-bwc/build.gradle             | 12 +---
 qa/rolling-upgrade/build.gradle               | 14 ++--
 qa/vagrant/build.gradle                       |  3 -
 qa/verify-version-constants/build.gradle      | 12 +---
 qa/wildfly/build.gradle                       |  2 -
 rest-api-spec/build.gradle                    |  1 -
 server/build.gradle                           |  8 +--
 test/fixtures/hdfs-fixture/build.gradle       |  1 -
 test/fixtures/krb5kdc-fixture/build.gradle    |  1 -
 test/fixtures/old-elasticsearch/build.gradle  |  1 -
 test/framework/build.gradle                   |  2 +-
 x-pack/plugin/core/build.gradle               |  2 +-
 x-pack/plugin/ml/build.gradle                 |  8 +--
 x-pack/plugin/monitoring/build.gradle         |  8 +--
 x-pack/plugin/rollup/build.gradle             |  8 +--
 x-pack/plugin/security/build.gradle           |  2 +-
 x-pack/plugin/sql/jdbc/build.gradle           |  2 +-
 x-pack/plugin/sql/sql-cli/build.gradle        |  2 +-
 x-pack/plugin/upgrade/build.gradle            |  8 +--
 x-pack/plugin/watcher/build.gradle            |  2 +-
 x-pack/qa/full-cluster-restart/build.gradle   | 14 +---
 .../build.gradle                              |  7 +-
 x-pack/qa/openldap-tests/build.gradle         |  6 +-
 x-pack/qa/rolling-upgrade-basic/build.gradle  | 12 +---
 x-pack/qa/rolling-upgrade/build.gradle        | 13 +---
 x-pack/qa/sql/build.gradle                    |  4 --
 .../third-party/active-directory/build.gradle |  8 +--
 x-pack/test/idp-fixture/build.gradle          |  1 -
 x-pack/test/smb-fixture/build.gradle          |  1 -
 57 files changed, 110 insertions(+), 235 deletions(-)

diff --git a/benchmarks/build.gradle b/benchmarks/build.gradle
index e7ee5a059ab37..77de2a02d5986 100644
--- a/benchmarks/build.gradle
+++ b/benchmarks/build.gradle
@@ -41,8 +41,6 @@ build.dependsOn.remove('assemble')
 
 archivesBaseName = 'elasticsearch-benchmarks'
 
-test.enabled = false
-
 dependencies {
     compile("org.elasticsearch:elasticsearch:${version}") {
         // JMH ships with the conflicting version 4.6. This prevents us from using jopt-simple in benchmarks (which should be ok) but allows
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
index 9c139eee2152a..64a10a9003ff6 100644
--- a/buildSrc/build.gradle
+++ b/buildSrc/build.gradle
@@ -146,7 +146,7 @@ if (project != rootProject) {
   thirdPartyAudit.enabled = false
 
   // test for elasticsearch.build tries to run with ES...
-  test.enabled = false
+  utest.enabled = false
 
   // TODO: re-enable once randomizedtesting gradle code is published and removed from here
   licenseHeaders.enabled = false
diff --git a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
index 8682708686744..eac75784486ad 100644
--- a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
+++ b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
@@ -2,42 +2,19 @@ package com.carrotsearch.gradle.junit4
 
 import com.carrotsearch.ant.tasks.junit4.JUnit4
 import org.gradle.api.AntBuilder
-import org.gradle.api.GradleException
 import org.gradle.api.Plugin
 import org.gradle.api.Project
-import org.gradle.api.Task
 import org.gradle.api.plugins.JavaBasePlugin
-import org.gradle.api.tasks.TaskContainer
 import org.gradle.api.tasks.testing.Test
 
 import java.util.concurrent.atomic.AtomicBoolean
 
 class RandomizedTestingPlugin implements Plugin {
 
-    static private AtomicBoolean sanityCheckConfigured = new AtomicBoolean(false)
-
     void apply(Project project) {
         setupSeed(project)
-        replaceTestTask(project.tasks)
+        createTestTask(project)
         configureAnt(project.ant)
-        configureSanityCheck(project)
-    }
-
-    private static void configureSanityCheck(Project project) {
-        // Check the task graph to confirm tasks were indeed replaced
-        // https://github.com/elastic/elasticsearch/issues/31324
-        if (sanityCheckConfigured.getAndSet(true) == false) {
-            project.rootProject.getGradle().getTaskGraph().whenReady {
-                def nonConforming = project.getGradle().getTaskGraph().allTasks
-                        .findAll { it.name == "test" }
-                        .findAll { (it instanceof RandomizedTestingTask) == false}
-                        .collect { "${it.path} -> ${it.class}" }
-                if (nonConforming.isEmpty() == false) {
-                    throw new GradleException("Found the ${nonConforming.size()} `test` tasks:" +
-                            "\n  ${nonConforming.join("\n  ")}")
-                }
-            }
-        }
     }
 
     /**
@@ -67,32 +44,40 @@ class RandomizedTestingPlugin implements Plugin {
         }
     }
 
-    static void replaceTestTask(TaskContainer tasks) {
-        Test oldTestTask = tasks.findByPath('test')
-        if (oldTestTask == null) {
-            // no test task, ok, user will use testing task on their own
+    static void createTestTask(Project project) {
+        Test oldTestTask = project.tasks.findByPath('test')
+        if (oldTestTask != null) {
+            oldTestTask.enabled = false
+            if (oldTestTask.getDependsOn().isEmpty() == false) {
+                // we used to pass dependencies along to the new task,
+                // we no longer do, so make sure nobody relies on that.
+                throw new Exception("did not expect any dependencies for test task but got: ${oldTestTask.getDependsOn()}")
+            }
+            oldTestTask.dependsOn('utest')
+        } else {
             return
         }
-        tasks.remove(oldTestTask)
 
-        Map properties = [
-            name: 'test',
+        RandomizedTestingTask newTestTask = project.tasks.create([
+            name: 'utest',
             type: RandomizedTestingTask,
-            dependsOn: oldTestTask.dependsOn,
             group: JavaBasePlugin.VERIFICATION_GROUP,
             description: 'Runs unit tests with the randomized testing framework'
-        ]
-        RandomizedTestingTask newTestTask = tasks.create(properties)
+        ])
         newTestTask.classpath = oldTestTask.classpath
         newTestTask.testClassesDir = oldTestTask.project.sourceSets.test.output.classesDir
-        // since gradle 4.5, tasks immutable dependencies are "hidden" (do not show up in dependsOn)
-        // so we must explicitly add a dependency on generating the test classpath
         newTestTask.dependsOn('testClasses')
 
-        // hack so check task depends on custom test
-        Task checkTask = tasks.findByPath('check')
-        checkTask.dependsOn.remove(oldTestTask)
-        checkTask.dependsOn.add(newTestTask)
+        project.tasks.findByPath('check').dependsOn.add(newTestTask)
+        // if there isn't actually a tests folder disable the task. Since we still have IT and Test in mixed folders
+        // need to check by file name convention
+        Set testSources = project.sourceSets.test.java.getFiles().findAll { it.name.endsWith("Tests.java") }
+        if (testSources.isEmpty()) {
+            newTestTask.enabled = false
+            project.logger.info("Found ${testSources.size()} source files, utest task will be disabled")
+        } else {
+            project.logger.debug("Found ${testSources.size()} source files, utest task will be enabled")
+        }
     }
 
     static void configureAnt(AntBuilder ant) {
diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy
index e69fc3821a768..01f0a70c37fe3 100644
--- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy
@@ -742,7 +742,7 @@ class BuildPlugin implements Plugin {
 
     /** Configures the test task */
     static Task configureTest(Project project) {
-        RandomizedTestingTask test = project.tasks.getByName('test')
+        RandomizedTestingTask test = project.tasks.getByName('utest')
         test.configure(commonTestConfig(project))
         test.configure {
             include '**/*Tests.class'
@@ -765,7 +765,7 @@ class BuildPlugin implements Plugin {
     private static configurePrecommit(Project project) {
         Task precommit = PrecommitTasks.create(project, true)
         project.check.dependsOn(precommit)
-        project.test.mustRunAfter(precommit)
+        project.utest.mustRunAfter(precommit)
         // only require dependency licenses for non-elasticsearch deps
         project.dependencyLicenses.dependencies = project.configurations.runtime.fileCollection {
             it.group.startsWith('org.elasticsearch') == false
diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy
index 28008f4313c97..5ed00b47b7645 100644
--- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy
@@ -110,7 +110,7 @@ public class PluginBuildPlugin extends BuildPlugin {
     /** Adds an integTest task which runs rest tests */
     private static void createIntegTestTask(Project project) {
         RestIntegTestTask integTest = project.tasks.create('integTest', RestIntegTestTask.class)
-        integTest.mustRunAfter(project.precommit, project.test)
+        integTest.mustRunAfter(project.precommit, project.utest)
         project.integTestCluster.distribution = 'integ-test-zip'
         project.check.dependsOn(integTest)
     }
diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/StandaloneTestPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/StandaloneTestPlugin.groovy
index 5eec829dfa1ba..1c438f0063487 100644
--- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/StandaloneTestPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/StandaloneTestPlugin.groovy
@@ -1,6 +1,6 @@
 /*
  * Licensed to Elasticsearch under one or more contributor
- * license agreements. See the NOTICE file distributed with
+ * license agreements. See the NOTICE file delasticsearch.standalone-testistributed with
  * this work for additional information regarding copyright
  * ownership. Elasticsearch licenses this file to you under
  * the Apache License, Version 2.0 (the "License"); you may
@@ -36,26 +36,25 @@ public class StandaloneTestPlugin implements Plugin {
     public void apply(Project project) {
         project.pluginManager.apply(StandaloneRestTestPlugin)
 
-        Map testOptions = [
-            name: 'test',
+        BuildPlugin.configureCompile(project)
+        project.tasks.withType(JavaCompile) {
+            // This will be the default in Gradle 5.0
+            if (options.compilerArgs.contains("-processor") == false) {
+                options.compilerArgs << '-proc:none'
+            }
+        }
+
+        RandomizedTestingTask test = project.tasks.create([
+            name: 'integTest',
             type: RandomizedTestingTask,
             dependsOn: 'testClasses',
             group: JavaBasePlugin.VERIFICATION_GROUP,
             description: 'Runs unit tests that are separate'
-        ]
-        RandomizedTestingTask test = project.tasks.create(testOptions)
+        ])
         test.configure(BuildPlugin.commonTestConfig(project))
-        BuildPlugin.configureCompile(project)
         test.classpath = project.sourceSets.test.runtimeClasspath
         test.testClassesDir project.sourceSets.test.output.classesDir
         test.mustRunAfter(project.precommit)
         project.check.dependsOn(test)
-
-        project.tasks.withType(JavaCompile) {
-            // This will be the default in Gradle 5.0
-            if (options.compilerArgs.contains("-processor") == false) {
-                options.compilerArgs << '-proc:none'
-            }
-        }
     }
 }
diff --git a/client/benchmark/build.gradle b/client/benchmark/build.gradle
index 9ca53292a4956..18088b684cf95 100644
--- a/client/benchmark/build.gradle
+++ b/client/benchmark/build.gradle
@@ -44,12 +44,6 @@ build.dependsOn.remove('assemble')
 archivesBaseName = 'client-benchmarks'
 mainClassName = 'org.elasticsearch.client.benchmark.BenchmarkMain'
 
-
-// never try to invoke tests on the benchmark project - there aren't any
-check.dependsOn.remove(test)
-// explicitly override the test task too in case somebody invokes 'gradle test' so it won't trip
-task test(type: Test, overwrite: true)
-
 dependencies {
   compile 'org.apache.commons:commons-math3:3.2'
 
diff --git a/client/client-benchmark-noop-api-plugin/build.gradle b/client/client-benchmark-noop-api-plugin/build.gradle
index cc84207d90d22..d49a69d5f3aa2 100644
--- a/client/client-benchmark-noop-api-plugin/build.gradle
+++ b/client/client-benchmark-noop-api-plugin/build.gradle
@@ -37,5 +37,4 @@ dependenciesInfo.enabled = false
 compileJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-rawtypes,-try,-unchecked"
 
 // no unit tests
-test.enabled = false
 integTest.enabled = false
diff --git a/client/test/build.gradle b/client/test/build.gradle
index 59c45186fe76b..3f701c50db077 100644
--- a/client/test/build.gradle
+++ b/client/test/build.gradle
@@ -56,5 +56,4 @@ dependenciesInfo.enabled = false
 namingConventions.enabled = false
 
 //we aren't releasing this jar
-thirdPartyAudit.enabled = false
-test.enabled = false
+thirdPartyAudit.enabled = false
\ No newline at end of file
diff --git a/distribution/tools/java-version-checker/build.gradle b/distribution/tools/java-version-checker/build.gradle
index ad9b56fec0502..be52b157c035f 100644
--- a/distribution/tools/java-version-checker/build.gradle
+++ b/distribution/tools/java-version-checker/build.gradle
@@ -7,7 +7,6 @@ targetCompatibility = JavaVersion.VERSION_1_7
 // java_version_checker do not depend on core so only JDK signatures should be checked
 forbiddenApisMain.signaturesURLs = [PrecommitTasks.getResource('/forbidden/jdk-signatures.txt')]
 
-test.enabled = false
 namingConventions.enabled = false
 javadoc.enabled = false
 loggerUsageCheck.enabled = false
diff --git a/distribution/tools/plugin-cli/build.gradle b/distribution/tools/plugin-cli/build.gradle
index c47786299bc2f..08821608f52b0 100644
--- a/distribution/tools/plugin-cli/build.gradle
+++ b/distribution/tools/plugin-cli/build.gradle
@@ -35,7 +35,7 @@ dependencyLicenses {
   mapping from: /bc.*/, to: 'bouncycastle'
 }
 
-test {
+utest {
   // TODO: find a way to add permissions for the tests in this module
   systemProperty 'tests.security.manager', 'false'
 }
diff --git a/libs/cli/build.gradle b/libs/cli/build.gradle
index 91fbca19eca99..3595ada7101fb 100644
--- a/libs/cli/build.gradle
+++ b/libs/cli/build.gradle
@@ -39,7 +39,6 @@ dependencies {
     compile "org.elasticsearch:elasticsearch-core:${version}"
 }
 
-test.enabled = false
 // Since CLI does not depend on :server, it cannot run the jarHell task
 jarHell.enabled = false
 
diff --git a/libs/plugin-classloader/build.gradle b/libs/plugin-classloader/build.gradle
index d6af6600d3463..18cd353bc0e67 100644
--- a/libs/plugin-classloader/build.gradle
+++ b/libs/plugin-classloader/build.gradle
@@ -17,8 +17,6 @@
  * under the License.
  */
 
-test.enabled = false
-
 // test depend on ES core...
 forbiddenApisMain.enabled = false
 jarHell.enabled = false
diff --git a/modules/lang-painless/build.gradle b/modules/lang-painless/build.gradle
index d287d7ee02378..ef8d80b01b39d 100644
--- a/modules/lang-painless/build.gradle
+++ b/modules/lang-painless/build.gradle
@@ -38,7 +38,7 @@ dependencyLicenses {
   mapping from: /asm-.*/, to: 'asm'
 }
 
-test {
+utest {
   jvmArg '-XX:-OmitStackTraceInFastThrow'
 }
 
diff --git a/modules/lang-painless/spi/build.gradle b/modules/lang-painless/spi/build.gradle
index 7e43a242a23a9..f67c8c86b1140 100644
--- a/modules/lang-painless/spi/build.gradle
+++ b/modules/lang-painless/spi/build.gradle
@@ -34,7 +34,4 @@ publishing {
 
 dependencies {
   compile "org.elasticsearch:elasticsearch:${version}"
-}
-
-// no tests...yet?
-test.enabled = false
+}
\ No newline at end of file
diff --git a/modules/reindex/build.gradle b/modules/reindex/build.gradle
index 8870e21858d18..39bc64063b4a5 100644
--- a/modules/reindex/build.gradle
+++ b/modules/reindex/build.gradle
@@ -45,7 +45,7 @@ run {
   setting 'reindex.remote.whitelist', '127.0.0.1:*'
 }
 
-test {
+utest {
   /*
    * We have to disable setting the number of available processors as tests in the
    * same JVM randomize processors and will step on each other if we allow them to
diff --git a/modules/transport-netty4/build.gradle b/modules/transport-netty4/build.gradle
index 5d4bcd7c10a84..cf195a50dedb3 100644
--- a/modules/transport-netty4/build.gradle
+++ b/modules/transport-netty4/build.gradle
@@ -47,7 +47,7 @@ dependencyLicenses {
   mapping from: /netty-.*/, to: 'netty'
 }
 
-test {
+utest {
     /*
      * We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
      * other if we allow them to set the number of available processors as it's set-once in Netty.
diff --git a/plugins/discovery-ec2/build.gradle b/plugins/discovery-ec2/build.gradle
index b1c3b62fd6edf..ea41b57b02ae9 100644
--- a/plugins/discovery-ec2/build.gradle
+++ b/plugins/discovery-ec2/build.gradle
@@ -48,7 +48,7 @@ bundlePlugin {
   }
 }
 
-test {
+utest {
   // this is needed for insecure plugins, remove if possible!
   systemProperty 'tests.artifact', project.name
 }
diff --git a/plugins/discovery-gce/build.gradle b/plugins/discovery-gce/build.gradle
index 82de9ba031b25..9df6de8f8dc9a 100644
--- a/plugins/discovery-gce/build.gradle
+++ b/plugins/discovery-gce/build.gradle
@@ -56,7 +56,7 @@ dependencyLicenses {
   mapping from: /google-.*/, to: 'google'
 }
 
-test {
+utest {
   // this is needed for insecure plugins, remove if possible!
   systemProperty 'tests.artifact', project.name 
 }
diff --git a/plugins/examples/painless-whitelist/build.gradle b/plugins/examples/painless-whitelist/build.gradle
index 12bbff8b0419e..16f5fefc30ec7 100644
--- a/plugins/examples/painless-whitelist/build.gradle
+++ b/plugins/examples/painless-whitelist/build.gradle
@@ -32,6 +32,4 @@ dependencies {
 
 integTestCluster {
   distribution = 'zip'
-}
-
-test.enabled = false
+}
\ No newline at end of file
diff --git a/plugins/examples/rest-handler/build.gradle b/plugins/examples/rest-handler/build.gradle
index cfe84e6a45a93..042fa5254db74 100644
--- a/plugins/examples/rest-handler/build.gradle
+++ b/plugins/examples/rest-handler/build.gradle
@@ -25,9 +25,6 @@ esplugin {
   classname 'org.elasticsearch.example.resthandler.ExampleRestHandlerPlugin'
 }
 
-// No unit tests in this example
-test.enabled = false
-
 task exampleFixture(type: org.elasticsearch.gradle.test.AntFixture) {
   dependsOn testClasses
   env 'CLASSPATH', "${ -> project.sourceSets.test.runtimeClasspath.asPath }"
diff --git a/plugins/examples/script-expert-scoring/build.gradle b/plugins/examples/script-expert-scoring/build.gradle
index 7c602d9bc027d..476c5b7593874 100644
--- a/plugins/examples/script-expert-scoring/build.gradle
+++ b/plugins/examples/script-expert-scoring/build.gradle
@@ -25,4 +25,3 @@ esplugin {
   classname 'org.elasticsearch.example.expertscript.ExpertScriptPlugin'
 }
 
-test.enabled = false
diff --git a/plugins/repository-s3/build.gradle b/plugins/repository-s3/build.gradle
index 8448b2ab9e1ac..d3420b06cff91 100644
--- a/plugins/repository-s3/build.gradle
+++ b/plugins/repository-s3/build.gradle
@@ -59,7 +59,7 @@ additionalTest('testRepositoryCreds'){
   systemProperty 'es.allow_insecure_settings', 'true'
 }
 
-test {
+utest {
   // these are tested explicitly in separate test tasks
   exclude '**/*CredentialsTests.class'
 }
diff --git a/qa/die-with-dignity/build.gradle b/qa/die-with-dignity/build.gradle
index 49a4d3c50873e..c0c0d82d731b0 100644
--- a/qa/die-with-dignity/build.gradle
+++ b/qa/die-with-dignity/build.gradle
@@ -32,6 +32,4 @@ integTestRunner {
     systemProperty 'runtime.java.home', "${project.runtimeJavaHome}"
 }
 
-test.enabled = false
-
 check.dependsOn integTest
diff --git a/qa/evil-tests/build.gradle b/qa/evil-tests/build.gradle
index 472fc87261602..1fed511376232 100644
--- a/qa/evil-tests/build.gradle
+++ b/qa/evil-tests/build.gradle
@@ -31,7 +31,7 @@ dependencies {
 
 // TODO: give each evil test its own fresh JVM for more isolation.
 
-test {
+integTest {
   systemProperty 'tests.security.manager', 'false'
 }
 
diff --git a/qa/full-cluster-restart/build.gradle b/qa/full-cluster-restart/build.gradle
index ca8371e30e7ac..053bb2d91df92 100644
--- a/qa/full-cluster-restart/build.gradle
+++ b/qa/full-cluster-restart/build.gradle
@@ -99,16 +99,9 @@ for (Version version : bwcVersions.indexCompatible) {
   }
 }
 
-test.enabled = false // no unit tests for rolling upgrades, only the rest integration test
-
-// basic integ tests includes testing bwc against the most recent version
-task integTest {
-  if (project.bwc_tests_enabled) {
-    for (final def version : bwcVersions.snapshotsIndexCompatible) {
-      dependsOn "v${version}#bwcTest"
-    }
-  }
+if (project.bwc_tests_enabled) {
+  check.dependsOn(bwcTest)
 }
 
-check.dependsOn(integTest)
+
 
diff --git a/qa/mixed-cluster/build.gradle b/qa/mixed-cluster/build.gradle
index da99bbb4c8036..6abd49c12d3de 100644
--- a/qa/mixed-cluster/build.gradle
+++ b/qa/mixed-cluster/build.gradle
@@ -67,15 +67,8 @@ for (Version version : bwcVersions.wireCompatible) {
   }
 }
 
-test.enabled = false // no unit tests for rolling upgrades, only the rest integration test
-
-// basic integ tests includes testing bwc against the most recent version
-task integTest {
-  if (project.bwc_tests_enabled) {
-    for (final def version : bwcVersions.snapshotsWireCompatible) {
-      dependsOn "v${version}#bwcTest"
-    }
-  }
+if (project.bwc_tests_enabled) {
+  check.dependsOn(bwcTest)
 }
 
-check.dependsOn(integTest)
+
diff --git a/qa/multi-cluster-search/build.gradle b/qa/multi-cluster-search/build.gradle
index 782e83fbb34f2..89710c126b466 100644
--- a/qa/multi-cluster-search/build.gradle
+++ b/qa/multi-cluster-search/build.gradle
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+
 import org.elasticsearch.gradle.test.RestIntegTestTask
 
 apply plugin: 'elasticsearch.standalone-test'
@@ -49,10 +50,4 @@ mixedClusterTestRunner {
   finalizedBy 'remoteClusterTestCluster#node0.stop','remoteClusterTestCluster#node1.stop'
 }
 
-task integTest {
-  dependsOn = [mixedClusterTest]
-}
-
-test.enabled = false // no unit tests for multi-cluster-search, only the rest integration test
-
-check.dependsOn(integTest)
+check.dependsOn(mixedClusterTest)
diff --git a/qa/query-builder-bwc/build.gradle b/qa/query-builder-bwc/build.gradle
index c0144041e1a46..ccb68b6a64a8a 100644
--- a/qa/query-builder-bwc/build.gradle
+++ b/qa/query-builder-bwc/build.gradle
@@ -76,14 +76,8 @@ for (Version version : bwcVersions.indexCompatible) {
     }
 }
 
-test.enabled = false // no unit tests for rolling upgrades, only the rest integration test
-
-// basic integ tests includes testing bwc against the most recent version
-task integTest {
-  if (project.bwc_tests_enabled) {
-      final def version = bwcVersions.snapshotsIndexCompatible.first()
-      dependsOn "v${version}#bwcTest"
-  }
+if (project.bwc_tests_enabled) {
+  check.dependsOn(bwcTest)
 }
 
-check.dependsOn(integTest)
+
diff --git a/qa/rolling-upgrade/build.gradle b/qa/rolling-upgrade/build.gradle
index bfd37863cc246..03e5deb1bf8f3 100644
--- a/qa/rolling-upgrade/build.gradle
+++ b/qa/rolling-upgrade/build.gradle
@@ -140,15 +140,9 @@ for (Version version : bwcVersions.wireCompatible) {
   }
 }
 
-test.enabled = false // no unit tests for rolling upgrades, only the rest integration test
-
-// basic integ tests includes testing bwc against the most recent version
-task integTest {
-  if (project.bwc_tests_enabled) {
-    for (final def version : bwcVersions.snapshotsWireCompatible) {
-      dependsOn "v${version}#bwcTest"
-    }
-  }
+if (project.bwc_tests_enabled) {
+  check.dependsOn(bwcTest)
 }
 
-check.dependsOn(integTest)
+
+
diff --git a/qa/vagrant/build.gradle b/qa/vagrant/build.gradle
index 23d171f312512..447f145510b00 100644
--- a/qa/vagrant/build.gradle
+++ b/qa/vagrant/build.gradle
@@ -67,9 +67,6 @@ forbiddenApisMain {
   ]
 }
 
-// we don't have additional tests for the tests themselves
-tasks.test.enabled = false
-
 // this project doesn't get published
 tasks.dependencyLicenses.enabled = false
 tasks.dependenciesInfo.enabled = false
diff --git a/qa/verify-version-constants/build.gradle b/qa/verify-version-constants/build.gradle
index 30c879ec6146e..f403b6594de14 100644
--- a/qa/verify-version-constants/build.gradle
+++ b/qa/verify-version-constants/build.gradle
@@ -53,13 +53,8 @@ for (Version version : bwcVersions.indexCompatible) {
     bwcTest.dependsOn(versionBwcTest)
 }
 
-test.enabled = false
-
-task integTest {
-  if (project.bwc_tests_enabled) {
-    final def version = bwcVersions.snapshotsIndexCompatible.first()
-    dependsOn "v${version}#bwcTest"
-  }
+if (project.bwc_tests_enabled) {
+    check.dependsOn(bwcTest)
 }
 
 task verifyDocsLuceneVersion {
@@ -83,5 +78,4 @@ task verifyDocsLuceneVersion {
     }
   }
 }
-
-check.dependsOn integTest, verifyDocsLuceneVersion
+check.dependsOn verifyDocsLuceneVersion
diff --git a/qa/wildfly/build.gradle b/qa/wildfly/build.gradle
index 6c6bf5d9b31b9..6adf34652596b 100644
--- a/qa/wildfly/build.gradle
+++ b/qa/wildfly/build.gradle
@@ -212,8 +212,6 @@ if (!Os.isFamily(Os.FAMILY_WINDOWS)) {
 
 check.dependsOn(integTest)
 
-test.enabled = false
-
 dependencyLicenses.enabled = false
 dependenciesInfo.enabled = false
 
diff --git a/rest-api-spec/build.gradle b/rest-api-spec/build.gradle
index cd49b9f192599..0e48d3f8dbb12 100644
--- a/rest-api-spec/build.gradle
+++ b/rest-api-spec/build.gradle
@@ -2,6 +2,5 @@ apply plugin: 'elasticsearch.build'
 apply plugin: 'nebula.maven-base-publish'
 apply plugin: 'nebula.maven-scm'
 
-test.enabled = false
 jarHell.enabled = false
 licenseHeaders.enabled = false
diff --git a/server/build.gradle b/server/build.gradle
index 7e880e0dae4d2..556d0aaef6913 100644
--- a/server/build.gradle
+++ b/server/build.gradle
@@ -329,12 +329,12 @@ if (isEclipse == false || project.path == ":server-tests") {
   task integTest(type: RandomizedTestingTask,
                  group: JavaBasePlugin.VERIFICATION_GROUP,
                  description: 'Multi-node tests',
-                 dependsOn: test.dependsOn) {
+                 dependsOn: utest.dependsOn) {
     configure(BuildPlugin.commonTestConfig(project))
-    classpath = project.test.classpath
-    testClassesDir = project.test.testClassesDir
+    classpath = project.utest.classpath
+    testClassesDir = project.utest.testClassesDir
     include '**/*IT.class'
   }
   check.dependsOn integTest
-  integTest.mustRunAfter test
+  integTest.mustRunAfter utest
 }
diff --git a/test/fixtures/hdfs-fixture/build.gradle b/test/fixtures/hdfs-fixture/build.gradle
index 70cb2b6bed2cb..b88662e1e7ac8 100644
--- a/test/fixtures/hdfs-fixture/build.gradle
+++ b/test/fixtures/hdfs-fixture/build.gradle
@@ -39,4 +39,3 @@ task hdfs(type: JavaExec) {
 // just a test fixture: we aren't using jars in releases
 thirdPartyAudit.enabled = false
 // TODO: add a simple HDFS client test for this fixture
-test.enabled = false
diff --git a/test/fixtures/krb5kdc-fixture/build.gradle b/test/fixtures/krb5kdc-fixture/build.gradle
index 046ecc5fc0416..5e4466d735264 100644
--- a/test/fixtures/krb5kdc-fixture/build.gradle
+++ b/test/fixtures/krb5kdc-fixture/build.gradle
@@ -75,7 +75,6 @@ task destroy(type: org.elasticsearch.gradle.vagrant.VagrantCommandTask) {
 
 thirdPartyAudit.enabled = false
 licenseHeaders.enabled = false
-test.enabled = false
 
 // installKDC uses tabs in it for the Kerberos ACL file.
 // Ignore it for pattern checking.
diff --git a/test/fixtures/old-elasticsearch/build.gradle b/test/fixtures/old-elasticsearch/build.gradle
index 5cfc02bbba3c6..1bae4d863329c 100644
--- a/test/fixtures/old-elasticsearch/build.gradle
+++ b/test/fixtures/old-elasticsearch/build.gradle
@@ -24,7 +24,6 @@ a "ports" file with the port on which Elasticsearch is running.
 """
 
 apply plugin: 'elasticsearch.build'
-test.enabled = false
 
 dependencies {
   // Just for the constants....
diff --git a/test/framework/build.gradle b/test/framework/build.gradle
index 5f1bc524da599..066e7fbd783c2 100644
--- a/test/framework/build.gradle
+++ b/test/framework/build.gradle
@@ -71,7 +71,7 @@ task namingConventionsMain(type: org.elasticsearch.gradle.precommit.NamingConven
 }
 precommit.dependsOn namingConventionsMain
 
-test.configure {
+utest {
   systemProperty 'tests.gradle_index_compat_versions', bwcVersions.indexCompatible.join(',')
   systemProperty 'tests.gradle_wire_compat_versions', bwcVersions.wireCompatible.join(',')
 }
diff --git a/x-pack/plugin/core/build.gradle b/x-pack/plugin/core/build.gradle
index 4bbe339a09b79..98d170bffeef7 100644
--- a/x-pack/plugin/core/build.gradle
+++ b/x-pack/plugin/core/build.gradle
@@ -96,7 +96,7 @@ sourceSets.test.java {
     srcDir '../../license-tools/src/main/java'
 }
 
-test {
+utest {
     /*
      * We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
      * other if we allow them to set the number of available processors as it's set-once in Netty.
diff --git a/x-pack/plugin/ml/build.gradle b/x-pack/plugin/ml/build.gradle
index 8b991555c0670..bd734581db155 100644
--- a/x-pack/plugin/ml/build.gradle
+++ b/x-pack/plugin/ml/build.gradle
@@ -96,15 +96,15 @@ integTest.enabled = false
 task internalClusterTest(type: RandomizedTestingTask,
                          group: JavaBasePlugin.VERIFICATION_GROUP,
                          description: 'Multi-node tests',
-                         dependsOn: test.dependsOn) {
+                         dependsOn: utest.dependsOn) {
   configure(BuildPlugin.commonTestConfig(project))
-  classpath = project.test.classpath
-  testClassesDir = project.test.testClassesDir
+  classpath = project.utest.classpath
+  testClassesDir = project.utest.testClassesDir
   include '**/*IT.class'
   systemProperty 'es.set.netty.runtime.available.processors', 'false'
 }
 check.dependsOn internalClusterTest
-internalClusterTest.mustRunAfter test
+internalClusterTest.mustRunAfter utest
 
 // also add an "alias" task to make typing on the command line easier
 task icTest {
diff --git a/x-pack/plugin/monitoring/build.gradle b/x-pack/plugin/monitoring/build.gradle
index fbdb388e78e19..9f64625831adb 100644
--- a/x-pack/plugin/monitoring/build.gradle
+++ b/x-pack/plugin/monitoring/build.gradle
@@ -59,15 +59,15 @@ integTest.enabled = false
 task internalClusterTest(type: RandomizedTestingTask,
                          group: JavaBasePlugin.VERIFICATION_GROUP,
                          description: 'Multi-node tests',
-                         dependsOn: test.dependsOn) {
+                         dependsOn: utest.dependsOn) {
   configure(BuildPlugin.commonTestConfig(project))
-  classpath = project.test.classpath
-  testClassesDir = project.test.testClassesDir
+  classpath = project.utest.classpath
+  testClassesDir = project.utest.testClassesDir
   include '**/*IT.class'
   systemProperty 'es.set.netty.runtime.available.processors', 'false'
 }
 check.dependsOn internalClusterTest 
-internalClusterTest.mustRunAfter test
+internalClusterTest.mustRunAfter utest
 
 // also add an "alias" task to make typing on the command line easier task icTest {
 task icTest {
diff --git a/x-pack/plugin/rollup/build.gradle b/x-pack/plugin/rollup/build.gradle
index d8ce1ca304763..3bb7f8f1cc62d 100644
--- a/x-pack/plugin/rollup/build.gradle
+++ b/x-pack/plugin/rollup/build.gradle
@@ -39,15 +39,15 @@ integTest.enabled = false
 task internalClusterTest(type: RandomizedTestingTask,
         group: JavaBasePlugin.VERIFICATION_GROUP,
         description: 'Multi-node tests',
-        dependsOn: test.dependsOn) {
+        dependsOn: utest.dependsOn) {
     configure(BuildPlugin.commonTestConfig(project))
-    classpath = project.test.classpath
-    testClassesDir = project.test.testClassesDir
+    classpath = project.utest.classpath
+    testClassesDir = project.utest.testClassesDir
     include '**/*IT.class'
     systemProperty 'es.set.netty.runtime.available.processors', 'false'
 }
 check.dependsOn internalClusterTest
-internalClusterTest.mustRunAfter test
+internalClusterTest.mustRunAfter utest
 
 // also add an "alias" task to make typing on the command line easier task icTest {
 task icTest {
diff --git a/x-pack/plugin/security/build.gradle b/x-pack/plugin/security/build.gradle
index 12533a389b5f1..016e2ab35f187 100644
--- a/x-pack/plugin/security/build.gradle
+++ b/x-pack/plugin/security/build.gradle
@@ -219,7 +219,7 @@ run {
     plugin xpackModule('core')
 }
 
-test {
+utest {
     /*
      * We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
      * other if we allow them to set the number of available processors as it's set-once in Netty.
diff --git a/x-pack/plugin/sql/jdbc/build.gradle b/x-pack/plugin/sql/jdbc/build.gradle
index e383e71cd4c76..b4944ea82bfd7 100644
--- a/x-pack/plugin/sql/jdbc/build.gradle
+++ b/x-pack/plugin/sql/jdbc/build.gradle
@@ -86,7 +86,7 @@ publishing {
 assemble.dependsOn shadowJar
 
 // Use the jar for testing so the tests are more "real"
-test {
+utest {
     classpath -= compileJava.outputs.files
     classpath -= configurations.compile
     classpath -= configurations.runtime
diff --git a/x-pack/plugin/sql/sql-cli/build.gradle b/x-pack/plugin/sql/sql-cli/build.gradle
index 06eb24c743ad8..4a8032896948a 100644
--- a/x-pack/plugin/sql/sql-cli/build.gradle
+++ b/x-pack/plugin/sql/sql-cli/build.gradle
@@ -133,7 +133,7 @@ task runcli {
 }
 
 // Use the jar for testing so we can get the proper version information
-test {
+utest {
     classpath -= compileJava.outputs.files
     classpath -= configurations.compile
     classpath -= configurations.runtime
diff --git a/x-pack/plugin/upgrade/build.gradle b/x-pack/plugin/upgrade/build.gradle
index 5cead96ac7aa5..af8563658ac30 100644
--- a/x-pack/plugin/upgrade/build.gradle
+++ b/x-pack/plugin/upgrade/build.gradle
@@ -32,15 +32,15 @@ integTest.enabled = false
 task internalClusterTest(type: RandomizedTestingTask,
                          group: JavaBasePlugin.VERIFICATION_GROUP,
                          description: 'Multi-node tests',
-                         dependsOn: test.dependsOn) {
+                         dependsOn: utest.dependsOn) {
   configure(BuildPlugin.commonTestConfig(project))
-  classpath = project.test.classpath
-  testClassesDir = project.test.testClassesDir
+  classpath = project.utest.classpath
+  testClassesDir = project.utest.testClassesDir
   include '**/*IT.class'
   systemProperty 'es.set.netty.runtime.available.processors', 'false'
 }
 check.dependsOn internalClusterTest 
-internalClusterTest.mustRunAfter test
+internalClusterTest.mustRunAfter utest
 
 // also add an "alias" task to make typing on the command line easier
 task icTest {
diff --git a/x-pack/plugin/watcher/build.gradle b/x-pack/plugin/watcher/build.gradle
index 2b7b73d37962e..f92b89db618ed 100644
--- a/x-pack/plugin/watcher/build.gradle
+++ b/x-pack/plugin/watcher/build.gradle
@@ -102,7 +102,7 @@ run {
     plugin xpackModule('core')
 }
 
-test {
+utest {
     /*
      * We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
      * other if we allow them to set the number of available processors as it's set-once in Netty.
diff --git a/x-pack/qa/full-cluster-restart/build.gradle b/x-pack/qa/full-cluster-restart/build.gradle
index b2bb7a63f6fb4..baa080139a42d 100644
--- a/x-pack/qa/full-cluster-restart/build.gradle
+++ b/x-pack/qa/full-cluster-restart/build.gradle
@@ -8,7 +8,6 @@ import java.util.regex.Matcher
 
 // Apply the java plugin to this project so the sources can be edited in an IDE
 apply plugin: 'elasticsearch.build'
-test.enabled = false
 
 dependencies {
     testCompile project(path: xpackModule('core'), configuration: 'runtime')
@@ -233,19 +232,10 @@ subprojects {
     }
   }
 
-  test.enabled = false // no unit tests for full cluster restarts, only the rest integration test
-
-  // basic integ tests includes testing bwc against the most recent version
-  task integTest {
-    if (project.bwc_tests_enabled) {
-      for (final def version : bwcVersions.snapshotsIndexCompatible) {
-        dependsOn "v${version}#bwcTest"
-      }
-    }
+  if (project.bwc_tests_enabled) {
+    check.dependsOn(bwcTest)
   }
 
-  check.dependsOn(integTest)
-
   dependencies {
       testCompile project(path: xpackModule('core'), configuration: 'runtime')
       testCompile project(path: xpackModule('watcher'), configuration: 'runtime')
diff --git a/x-pack/qa/multi-cluster-search-security/build.gradle b/x-pack/qa/multi-cluster-search-security/build.gradle
index f5265466965c1..ee771f0dc617c 100644
--- a/x-pack/qa/multi-cluster-search-security/build.gradle
+++ b/x-pack/qa/multi-cluster-search-security/build.gradle
@@ -69,9 +69,4 @@ mixedClusterTestRunner {
   finalizedBy 'remoteClusterTestCluster#node0.stop','remoteClusterTestCluster#node1.stop'
 }
 
-task integTest {
-  dependsOn = [mixedClusterTest]
-}
-
-test.enabled = false // no unit tests for multi-cluster-search, only the rest integration test
-check.dependsOn(integTest)
+check.dependsOn(mixedClusterTest)
diff --git a/x-pack/qa/openldap-tests/build.gradle b/x-pack/qa/openldap-tests/build.gradle
index 24976ab6113ab..805bef80be889 100644
--- a/x-pack/qa/openldap-tests/build.gradle
+++ b/x-pack/qa/openldap-tests/build.gradle
@@ -21,10 +21,10 @@ task copyIdpTrust(type: Copy) {
 }
 if (project.rootProject.vagrantSupported) {
   project.sourceSets.test.output.dir(outputDir, builtBy: copyIdpTrust)
-  test.dependsOn openLdapFixture
-  test.finalizedBy idpFixtureProject.halt
+  integTest.dependsOn openLdapFixture
+  integTest.finalizedBy idpFixtureProject.halt
 } else {
-  test.enabled = false
+  integTest.enabled = false
 }
 
 namingConventions {
diff --git a/x-pack/qa/rolling-upgrade-basic/build.gradle b/x-pack/qa/rolling-upgrade-basic/build.gradle
index 6d5b250b460b7..01eb0ef3ffdf8 100644
--- a/x-pack/qa/rolling-upgrade-basic/build.gradle
+++ b/x-pack/qa/rolling-upgrade-basic/build.gradle
@@ -119,17 +119,9 @@ for (Version version : bwcVersions.wireCompatible) {
     }
 }
 
-test.enabled = false // no unit tests for rolling upgrades, only the rest integration test
-
-// basic integ tests includes testing bwc against the most recent version
-task integTest {
-    if (project.bwc_tests_enabled) {
-        for (final def version : bwcVersions.snapshotsWireCompatible) {
-            dependsOn "v${version}#bwcTest"
-        }
-    }
+if (project.bwc_tests_enabled) {
+    check.dependsOn(bwcTest)
 }
-check.dependsOn(integTest)
 
 compileTestJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-rawtypes,-try,-unchecked"
 
diff --git a/x-pack/qa/rolling-upgrade/build.gradle b/x-pack/qa/rolling-upgrade/build.gradle
index 351f33b941227..e8d1bc1dee23d 100644
--- a/x-pack/qa/rolling-upgrade/build.gradle
+++ b/x-pack/qa/rolling-upgrade/build.gradle
@@ -7,7 +7,6 @@ import java.util.regex.Matcher
 
 // Apply the java plugin to this project so the sources can be edited in an IDE
 apply plugin: 'elasticsearch.build'
-test.enabled = false
 
 dependencies {
   testCompile project(path: xpackModule('core'), configuration: 'runtime')
@@ -271,17 +270,9 @@ subprojects {
     }
   }
 
-  test.enabled = false // no unit tests for rolling upgrades, only the rest integration test
-
-  // basic integ tests includes testing bwc against the most recent version
-  task integTest {
-    if (project.bwc_tests_enabled) {
-      for (final def version : bwcVersions.snapshotsWireCompatible) {
-        dependsOn "v${version}#bwcTest"
-      }
-    }
+  if (project.bwc_tests_enabled) {
+      check.dependsOn(bwcTest)
   }
-  check.dependsOn(integTest)
 
   dependencies {
     testCompile project(path: xpackModule('core'), configuration: 'runtime')
diff --git a/x-pack/qa/sql/build.gradle b/x-pack/qa/sql/build.gradle
index 0bea3a9364b71..1640bfff8b3f1 100644
--- a/x-pack/qa/sql/build.gradle
+++ b/x-pack/qa/sql/build.gradle
@@ -17,10 +17,6 @@ dependencies {
   compile "org.jline:jline:3.6.0"
 }
 
-/* disable unit tests because these are all integration tests used
- * other qa projects. */
-test.enabled = false
-
 dependencyLicenses.enabled = false
 dependenciesInfo.enabled = false
 
diff --git a/x-pack/qa/third-party/active-directory/build.gradle b/x-pack/qa/third-party/active-directory/build.gradle
index c9fa55652108d..3a72ebb98d636 100644
--- a/x-pack/qa/third-party/active-directory/build.gradle
+++ b/x-pack/qa/third-party/active-directory/build.gradle
@@ -20,7 +20,7 @@ forbiddenPatterns {
   exclude '**/*.der'
 }
 
-test {
+integTest {
   /*
    * We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
    * other if we allow them to set the number of available processors as it's set-once in Netty.
@@ -39,9 +39,9 @@ task smbFixture {
 
 if (project.rootProject.vagrantSupported) {
   if (project.hasProperty('useExternalAD') == false) {
-    test.dependsOn smbFixture
-    test.finalizedBy smbFixtureProject.halt
+    integTest.dependsOn smbFixture
+    integTest.finalizedBy smbFixtureProject.halt
   }
 } else {
-  test.enabled = false
+  integTest.enabled = false
 }
diff --git a/x-pack/test/idp-fixture/build.gradle b/x-pack/test/idp-fixture/build.gradle
index c62ac0409ba95..6442846e94029 100644
--- a/x-pack/test/idp-fixture/build.gradle
+++ b/x-pack/test/idp-fixture/build.gradle
@@ -39,5 +39,4 @@ task destroy(type: org.elasticsearch.gradle.vagrant.VagrantCommandTask) {
 
 thirdPartyAudit.enabled = false
 licenseHeaders.enabled = false
-test.enabled = false
 jarHell.enabled = false
diff --git a/x-pack/test/smb-fixture/build.gradle b/x-pack/test/smb-fixture/build.gradle
index 233b289b295db..b16e616daf6d2 100644
--- a/x-pack/test/smb-fixture/build.gradle
+++ b/x-pack/test/smb-fixture/build.gradle
@@ -39,5 +39,4 @@ task destroy(type: org.elasticsearch.gradle.vagrant.VagrantCommandTask) {
 
 thirdPartyAudit.enabled = false
 licenseHeaders.enabled = false
-test.enabled = false
 jarHell.enabled = false

From e141e4bb1d983a82666bdac49dc43f8b6ab24c2f Mon Sep 17 00:00:00 2001
From: Alpar Torok 
Date: Thu, 21 Jun 2018 09:03:14 +0300
Subject: [PATCH 20/28] Revert "No longer replace test task, create implicit
 instead"

This reverts commit f1ebaf7d93e4a0a19e751109bf620477dc35023c.
---
 benchmarks/build.gradle                       |  2 +
 buildSrc/build.gradle                         |  2 +-
 .../junit4/RandomizedTestingPlugin.groovy     | 65 ++++++++++++-------
 .../elasticsearch/gradle/BuildPlugin.groovy   |  4 +-
 .../gradle/plugin/PluginBuildPlugin.groovy    |  2 +-
 .../gradle/test/StandaloneTestPlugin.groovy   | 25 +++----
 client/benchmark/build.gradle                 |  6 ++
 .../build.gradle                              |  1 +
 client/test/build.gradle                      |  3 +-
 .../tools/java-version-checker/build.gradle   |  1 +
 distribution/tools/plugin-cli/build.gradle    |  2 +-
 libs/cli/build.gradle                         |  1 +
 libs/plugin-classloader/build.gradle          |  2 +
 modules/lang-painless/build.gradle            |  2 +-
 modules/lang-painless/spi/build.gradle        |  5 +-
 modules/reindex/build.gradle                  |  2 +-
 modules/transport-netty4/build.gradle         |  2 +-
 plugins/discovery-ec2/build.gradle            |  2 +-
 plugins/discovery-gce/build.gradle            |  2 +-
 .../examples/painless-whitelist/build.gradle  |  4 +-
 plugins/examples/rest-handler/build.gradle    |  3 +
 .../script-expert-scoring/build.gradle        |  1 +
 plugins/repository-s3/build.gradle            |  2 +-
 qa/die-with-dignity/build.gradle              |  2 +
 qa/evil-tests/build.gradle                    |  2 +-
 qa/full-cluster-restart/build.gradle          | 13 +++-
 qa/mixed-cluster/build.gradle                 | 13 +++-
 qa/multi-cluster-search/build.gradle          |  9 ++-
 qa/query-builder-bwc/build.gradle             | 12 +++-
 qa/rolling-upgrade/build.gradle               | 14 ++--
 qa/vagrant/build.gradle                       |  3 +
 qa/verify-version-constants/build.gradle      | 12 +++-
 qa/wildfly/build.gradle                       |  2 +
 rest-api-spec/build.gradle                    |  1 +
 server/build.gradle                           |  8 +--
 test/fixtures/hdfs-fixture/build.gradle       |  1 +
 test/fixtures/krb5kdc-fixture/build.gradle    |  1 +
 test/fixtures/old-elasticsearch/build.gradle  |  1 +
 test/framework/build.gradle                   |  2 +-
 x-pack/plugin/core/build.gradle               |  2 +-
 x-pack/plugin/ml/build.gradle                 |  8 +--
 x-pack/plugin/monitoring/build.gradle         |  8 +--
 x-pack/plugin/rollup/build.gradle             |  8 +--
 x-pack/plugin/security/build.gradle           |  2 +-
 x-pack/plugin/sql/jdbc/build.gradle           |  2 +-
 x-pack/plugin/sql/sql-cli/build.gradle        |  2 +-
 x-pack/plugin/upgrade/build.gradle            |  8 +--
 x-pack/plugin/watcher/build.gradle            |  2 +-
 x-pack/qa/full-cluster-restart/build.gradle   | 14 +++-
 .../build.gradle                              |  7 +-
 x-pack/qa/openldap-tests/build.gradle         |  6 +-
 x-pack/qa/rolling-upgrade-basic/build.gradle  | 12 +++-
 x-pack/qa/rolling-upgrade/build.gradle        | 13 +++-
 x-pack/qa/sql/build.gradle                    |  4 ++
 .../third-party/active-directory/build.gradle |  8 +--
 x-pack/test/idp-fixture/build.gradle          |  1 +
 x-pack/test/smb-fixture/build.gradle          |  1 +
 57 files changed, 235 insertions(+), 110 deletions(-)

diff --git a/benchmarks/build.gradle b/benchmarks/build.gradle
index 77de2a02d5986..e7ee5a059ab37 100644
--- a/benchmarks/build.gradle
+++ b/benchmarks/build.gradle
@@ -41,6 +41,8 @@ build.dependsOn.remove('assemble')
 
 archivesBaseName = 'elasticsearch-benchmarks'
 
+test.enabled = false
+
 dependencies {
     compile("org.elasticsearch:elasticsearch:${version}") {
         // JMH ships with the conflicting version 4.6. This prevents us from using jopt-simple in benchmarks (which should be ok) but allows
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
index 64a10a9003ff6..9c139eee2152a 100644
--- a/buildSrc/build.gradle
+++ b/buildSrc/build.gradle
@@ -146,7 +146,7 @@ if (project != rootProject) {
   thirdPartyAudit.enabled = false
 
   // test for elasticsearch.build tries to run with ES...
-  utest.enabled = false
+  test.enabled = false
 
   // TODO: re-enable once randomizedtesting gradle code is published and removed from here
   licenseHeaders.enabled = false
diff --git a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
index eac75784486ad..8682708686744 100644
--- a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
+++ b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
@@ -2,19 +2,42 @@ package com.carrotsearch.gradle.junit4
 
 import com.carrotsearch.ant.tasks.junit4.JUnit4
 import org.gradle.api.AntBuilder
+import org.gradle.api.GradleException
 import org.gradle.api.Plugin
 import org.gradle.api.Project
+import org.gradle.api.Task
 import org.gradle.api.plugins.JavaBasePlugin
+import org.gradle.api.tasks.TaskContainer
 import org.gradle.api.tasks.testing.Test
 
 import java.util.concurrent.atomic.AtomicBoolean
 
 class RandomizedTestingPlugin implements Plugin {
 
+    static private AtomicBoolean sanityCheckConfigured = new AtomicBoolean(false)
+
     void apply(Project project) {
         setupSeed(project)
-        createTestTask(project)
+        replaceTestTask(project.tasks)
         configureAnt(project.ant)
+        configureSanityCheck(project)
+    }
+
+    private static void configureSanityCheck(Project project) {
+        // Check the task graph to confirm tasks were indeed replaced
+        // https://github.com/elastic/elasticsearch/issues/31324
+        if (sanityCheckConfigured.getAndSet(true) == false) {
+            project.rootProject.getGradle().getTaskGraph().whenReady {
+                def nonConforming = project.getGradle().getTaskGraph().allTasks
+                        .findAll { it.name == "test" }
+                        .findAll { (it instanceof RandomizedTestingTask) == false}
+                        .collect { "${it.path} -> ${it.class}" }
+                if (nonConforming.isEmpty() == false) {
+                    throw new GradleException("Found the ${nonConforming.size()} `test` tasks:" +
+                            "\n  ${nonConforming.join("\n  ")}")
+                }
+            }
+        }
     }
 
     /**
@@ -44,40 +67,32 @@ class RandomizedTestingPlugin implements Plugin {
         }
     }
 
-    static void createTestTask(Project project) {
-        Test oldTestTask = project.tasks.findByPath('test')
-        if (oldTestTask != null) {
-            oldTestTask.enabled = false
-            if (oldTestTask.getDependsOn().isEmpty() == false) {
-                // we used to pass dependencies along to the new task,
-                // we no longer do, so make sure nobody relies on that.
-                throw new Exception("did not expect any dependencies for test task but got: ${oldTestTask.getDependsOn()}")
-            }
-            oldTestTask.dependsOn('utest')
-        } else {
+    static void replaceTestTask(TaskContainer tasks) {
+        Test oldTestTask = tasks.findByPath('test')
+        if (oldTestTask == null) {
+            // no test task, ok, user will use testing task on their own
             return
         }
+        tasks.remove(oldTestTask)
 
-        RandomizedTestingTask newTestTask = project.tasks.create([
-            name: 'utest',
+        Map properties = [
+            name: 'test',
             type: RandomizedTestingTask,
+            dependsOn: oldTestTask.dependsOn,
             group: JavaBasePlugin.VERIFICATION_GROUP,
             description: 'Runs unit tests with the randomized testing framework'
-        ])
+        ]
+        RandomizedTestingTask newTestTask = tasks.create(properties)
         newTestTask.classpath = oldTestTask.classpath
         newTestTask.testClassesDir = oldTestTask.project.sourceSets.test.output.classesDir
+        // since gradle 4.5, tasks immutable dependencies are "hidden" (do not show up in dependsOn)
+        // so we must explicitly add a dependency on generating the test classpath
         newTestTask.dependsOn('testClasses')
 
-        project.tasks.findByPath('check').dependsOn.add(newTestTask)
-        // if there isn't actually a tests folder disable the task. Since we still have IT and Test in mixed folders
-        // need to check by file name convention
-        Set testSources = project.sourceSets.test.java.getFiles().findAll { it.name.endsWith("Tests.java") }
-        if (testSources.isEmpty()) {
-            newTestTask.enabled = false
-            project.logger.info("Found ${testSources.size()} source files, utest task will be disabled")
-        } else {
-            project.logger.debug("Found ${testSources.size()} source files, utest task will be enabled")
-        }
+        // hack so check task depends on custom test
+        Task checkTask = tasks.findByPath('check')
+        checkTask.dependsOn.remove(oldTestTask)
+        checkTask.dependsOn.add(newTestTask)
     }
 
     static void configureAnt(AntBuilder ant) {
diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy
index 01f0a70c37fe3..e69fc3821a768 100644
--- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy
@@ -742,7 +742,7 @@ class BuildPlugin implements Plugin {
 
     /** Configures the test task */
     static Task configureTest(Project project) {
-        RandomizedTestingTask test = project.tasks.getByName('utest')
+        RandomizedTestingTask test = project.tasks.getByName('test')
         test.configure(commonTestConfig(project))
         test.configure {
             include '**/*Tests.class'
@@ -765,7 +765,7 @@ class BuildPlugin implements Plugin {
     private static configurePrecommit(Project project) {
         Task precommit = PrecommitTasks.create(project, true)
         project.check.dependsOn(precommit)
-        project.utest.mustRunAfter(precommit)
+        project.test.mustRunAfter(precommit)
         // only require dependency licenses for non-elasticsearch deps
         project.dependencyLicenses.dependencies = project.configurations.runtime.fileCollection {
             it.group.startsWith('org.elasticsearch') == false
diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy
index 5ed00b47b7645..28008f4313c97 100644
--- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy
@@ -110,7 +110,7 @@ public class PluginBuildPlugin extends BuildPlugin {
     /** Adds an integTest task which runs rest tests */
     private static void createIntegTestTask(Project project) {
         RestIntegTestTask integTest = project.tasks.create('integTest', RestIntegTestTask.class)
-        integTest.mustRunAfter(project.precommit, project.utest)
+        integTest.mustRunAfter(project.precommit, project.test)
         project.integTestCluster.distribution = 'integ-test-zip'
         project.check.dependsOn(integTest)
     }
diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/StandaloneTestPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/StandaloneTestPlugin.groovy
index 1c438f0063487..5eec829dfa1ba 100644
--- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/StandaloneTestPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/StandaloneTestPlugin.groovy
@@ -1,6 +1,6 @@
 /*
  * Licensed to Elasticsearch under one or more contributor
- * license agreements. See the NOTICE file delasticsearch.standalone-testistributed with
+ * license agreements. See the NOTICE file distributed with
  * this work for additional information regarding copyright
  * ownership. Elasticsearch licenses this file to you under
  * the Apache License, Version 2.0 (the "License"); you may
@@ -36,25 +36,26 @@ public class StandaloneTestPlugin implements Plugin {
     public void apply(Project project) {
         project.pluginManager.apply(StandaloneRestTestPlugin)
 
-        BuildPlugin.configureCompile(project)
-        project.tasks.withType(JavaCompile) {
-            // This will be the default in Gradle 5.0
-            if (options.compilerArgs.contains("-processor") == false) {
-                options.compilerArgs << '-proc:none'
-            }
-        }
-
-        RandomizedTestingTask test = project.tasks.create([
-            name: 'integTest',
+        Map testOptions = [
+            name: 'test',
             type: RandomizedTestingTask,
             dependsOn: 'testClasses',
             group: JavaBasePlugin.VERIFICATION_GROUP,
             description: 'Runs unit tests that are separate'
-        ])
+        ]
+        RandomizedTestingTask test = project.tasks.create(testOptions)
         test.configure(BuildPlugin.commonTestConfig(project))
+        BuildPlugin.configureCompile(project)
         test.classpath = project.sourceSets.test.runtimeClasspath
         test.testClassesDir project.sourceSets.test.output.classesDir
         test.mustRunAfter(project.precommit)
         project.check.dependsOn(test)
+
+        project.tasks.withType(JavaCompile) {
+            // This will be the default in Gradle 5.0
+            if (options.compilerArgs.contains("-processor") == false) {
+                options.compilerArgs << '-proc:none'
+            }
+        }
     }
 }
diff --git a/client/benchmark/build.gradle b/client/benchmark/build.gradle
index 18088b684cf95..9ca53292a4956 100644
--- a/client/benchmark/build.gradle
+++ b/client/benchmark/build.gradle
@@ -44,6 +44,12 @@ build.dependsOn.remove('assemble')
 archivesBaseName = 'client-benchmarks'
 mainClassName = 'org.elasticsearch.client.benchmark.BenchmarkMain'
 
+
+// never try to invoke tests on the benchmark project - there aren't any
+check.dependsOn.remove(test)
+// explicitly override the test task too in case somebody invokes 'gradle test' so it won't trip
+task test(type: Test, overwrite: true)
+
 dependencies {
   compile 'org.apache.commons:commons-math3:3.2'
 
diff --git a/client/client-benchmark-noop-api-plugin/build.gradle b/client/client-benchmark-noop-api-plugin/build.gradle
index d49a69d5f3aa2..cc84207d90d22 100644
--- a/client/client-benchmark-noop-api-plugin/build.gradle
+++ b/client/client-benchmark-noop-api-plugin/build.gradle
@@ -37,4 +37,5 @@ dependenciesInfo.enabled = false
 compileJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-rawtypes,-try,-unchecked"
 
 // no unit tests
+test.enabled = false
 integTest.enabled = false
diff --git a/client/test/build.gradle b/client/test/build.gradle
index 3f701c50db077..59c45186fe76b 100644
--- a/client/test/build.gradle
+++ b/client/test/build.gradle
@@ -56,4 +56,5 @@ dependenciesInfo.enabled = false
 namingConventions.enabled = false
 
 //we aren't releasing this jar
-thirdPartyAudit.enabled = false
\ No newline at end of file
+thirdPartyAudit.enabled = false
+test.enabled = false
diff --git a/distribution/tools/java-version-checker/build.gradle b/distribution/tools/java-version-checker/build.gradle
index be52b157c035f..ad9b56fec0502 100644
--- a/distribution/tools/java-version-checker/build.gradle
+++ b/distribution/tools/java-version-checker/build.gradle
@@ -7,6 +7,7 @@ targetCompatibility = JavaVersion.VERSION_1_7
 // java_version_checker do not depend on core so only JDK signatures should be checked
 forbiddenApisMain.signaturesURLs = [PrecommitTasks.getResource('/forbidden/jdk-signatures.txt')]
 
+test.enabled = false
 namingConventions.enabled = false
 javadoc.enabled = false
 loggerUsageCheck.enabled = false
diff --git a/distribution/tools/plugin-cli/build.gradle b/distribution/tools/plugin-cli/build.gradle
index 08821608f52b0..c47786299bc2f 100644
--- a/distribution/tools/plugin-cli/build.gradle
+++ b/distribution/tools/plugin-cli/build.gradle
@@ -35,7 +35,7 @@ dependencyLicenses {
   mapping from: /bc.*/, to: 'bouncycastle'
 }
 
-utest {
+test {
   // TODO: find a way to add permissions for the tests in this module
   systemProperty 'tests.security.manager', 'false'
 }
diff --git a/libs/cli/build.gradle b/libs/cli/build.gradle
index 3595ada7101fb..91fbca19eca99 100644
--- a/libs/cli/build.gradle
+++ b/libs/cli/build.gradle
@@ -39,6 +39,7 @@ dependencies {
     compile "org.elasticsearch:elasticsearch-core:${version}"
 }
 
+test.enabled = false
 // Since CLI does not depend on :server, it cannot run the jarHell task
 jarHell.enabled = false
 
diff --git a/libs/plugin-classloader/build.gradle b/libs/plugin-classloader/build.gradle
index 18cd353bc0e67..d6af6600d3463 100644
--- a/libs/plugin-classloader/build.gradle
+++ b/libs/plugin-classloader/build.gradle
@@ -17,6 +17,8 @@
  * under the License.
  */
 
+test.enabled = false
+
 // test depend on ES core...
 forbiddenApisMain.enabled = false
 jarHell.enabled = false
diff --git a/modules/lang-painless/build.gradle b/modules/lang-painless/build.gradle
index ef8d80b01b39d..d287d7ee02378 100644
--- a/modules/lang-painless/build.gradle
+++ b/modules/lang-painless/build.gradle
@@ -38,7 +38,7 @@ dependencyLicenses {
   mapping from: /asm-.*/, to: 'asm'
 }
 
-utest {
+test {
   jvmArg '-XX:-OmitStackTraceInFastThrow'
 }
 
diff --git a/modules/lang-painless/spi/build.gradle b/modules/lang-painless/spi/build.gradle
index f67c8c86b1140..7e43a242a23a9 100644
--- a/modules/lang-painless/spi/build.gradle
+++ b/modules/lang-painless/spi/build.gradle
@@ -34,4 +34,7 @@ publishing {
 
 dependencies {
   compile "org.elasticsearch:elasticsearch:${version}"
-}
\ No newline at end of file
+}
+
+// no tests...yet?
+test.enabled = false
diff --git a/modules/reindex/build.gradle b/modules/reindex/build.gradle
index 39bc64063b4a5..8870e21858d18 100644
--- a/modules/reindex/build.gradle
+++ b/modules/reindex/build.gradle
@@ -45,7 +45,7 @@ run {
   setting 'reindex.remote.whitelist', '127.0.0.1:*'
 }
 
-utest {
+test {
   /*
    * We have to disable setting the number of available processors as tests in the
    * same JVM randomize processors and will step on each other if we allow them to
diff --git a/modules/transport-netty4/build.gradle b/modules/transport-netty4/build.gradle
index cf195a50dedb3..5d4bcd7c10a84 100644
--- a/modules/transport-netty4/build.gradle
+++ b/modules/transport-netty4/build.gradle
@@ -47,7 +47,7 @@ dependencyLicenses {
   mapping from: /netty-.*/, to: 'netty'
 }
 
-utest {
+test {
     /*
      * We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
      * other if we allow them to set the number of available processors as it's set-once in Netty.
diff --git a/plugins/discovery-ec2/build.gradle b/plugins/discovery-ec2/build.gradle
index ea41b57b02ae9..b1c3b62fd6edf 100644
--- a/plugins/discovery-ec2/build.gradle
+++ b/plugins/discovery-ec2/build.gradle
@@ -48,7 +48,7 @@ bundlePlugin {
   }
 }
 
-utest {
+test {
   // this is needed for insecure plugins, remove if possible!
   systemProperty 'tests.artifact', project.name
 }
diff --git a/plugins/discovery-gce/build.gradle b/plugins/discovery-gce/build.gradle
index 9df6de8f8dc9a..82de9ba031b25 100644
--- a/plugins/discovery-gce/build.gradle
+++ b/plugins/discovery-gce/build.gradle
@@ -56,7 +56,7 @@ dependencyLicenses {
   mapping from: /google-.*/, to: 'google'
 }
 
-utest {
+test {
   // this is needed for insecure plugins, remove if possible!
   systemProperty 'tests.artifact', project.name 
 }
diff --git a/plugins/examples/painless-whitelist/build.gradle b/plugins/examples/painless-whitelist/build.gradle
index 16f5fefc30ec7..12bbff8b0419e 100644
--- a/plugins/examples/painless-whitelist/build.gradle
+++ b/plugins/examples/painless-whitelist/build.gradle
@@ -32,4 +32,6 @@ dependencies {
 
 integTestCluster {
   distribution = 'zip'
-}
\ No newline at end of file
+}
+
+test.enabled = false
diff --git a/plugins/examples/rest-handler/build.gradle b/plugins/examples/rest-handler/build.gradle
index 042fa5254db74..cfe84e6a45a93 100644
--- a/plugins/examples/rest-handler/build.gradle
+++ b/plugins/examples/rest-handler/build.gradle
@@ -25,6 +25,9 @@ esplugin {
   classname 'org.elasticsearch.example.resthandler.ExampleRestHandlerPlugin'
 }
 
+// No unit tests in this example
+test.enabled = false
+
 task exampleFixture(type: org.elasticsearch.gradle.test.AntFixture) {
   dependsOn testClasses
   env 'CLASSPATH', "${ -> project.sourceSets.test.runtimeClasspath.asPath }"
diff --git a/plugins/examples/script-expert-scoring/build.gradle b/plugins/examples/script-expert-scoring/build.gradle
index 476c5b7593874..7c602d9bc027d 100644
--- a/plugins/examples/script-expert-scoring/build.gradle
+++ b/plugins/examples/script-expert-scoring/build.gradle
@@ -25,3 +25,4 @@ esplugin {
   classname 'org.elasticsearch.example.expertscript.ExpertScriptPlugin'
 }
 
+test.enabled = false
diff --git a/plugins/repository-s3/build.gradle b/plugins/repository-s3/build.gradle
index d3420b06cff91..8448b2ab9e1ac 100644
--- a/plugins/repository-s3/build.gradle
+++ b/plugins/repository-s3/build.gradle
@@ -59,7 +59,7 @@ additionalTest('testRepositoryCreds'){
   systemProperty 'es.allow_insecure_settings', 'true'
 }
 
-utest {
+test {
   // these are tested explicitly in separate test tasks
   exclude '**/*CredentialsTests.class'
 }
diff --git a/qa/die-with-dignity/build.gradle b/qa/die-with-dignity/build.gradle
index c0c0d82d731b0..49a4d3c50873e 100644
--- a/qa/die-with-dignity/build.gradle
+++ b/qa/die-with-dignity/build.gradle
@@ -32,4 +32,6 @@ integTestRunner {
     systemProperty 'runtime.java.home', "${project.runtimeJavaHome}"
 }
 
+test.enabled = false
+
 check.dependsOn integTest
diff --git a/qa/evil-tests/build.gradle b/qa/evil-tests/build.gradle
index 1fed511376232..472fc87261602 100644
--- a/qa/evil-tests/build.gradle
+++ b/qa/evil-tests/build.gradle
@@ -31,7 +31,7 @@ dependencies {
 
 // TODO: give each evil test its own fresh JVM for more isolation.
 
-integTest {
+test {
   systemProperty 'tests.security.manager', 'false'
 }
 
diff --git a/qa/full-cluster-restart/build.gradle b/qa/full-cluster-restart/build.gradle
index 053bb2d91df92..ca8371e30e7ac 100644
--- a/qa/full-cluster-restart/build.gradle
+++ b/qa/full-cluster-restart/build.gradle
@@ -99,9 +99,16 @@ for (Version version : bwcVersions.indexCompatible) {
   }
 }
 
-if (project.bwc_tests_enabled) {
-  check.dependsOn(bwcTest)
-}
+test.enabled = false // no unit tests for rolling upgrades, only the rest integration test
 
+// basic integ tests includes testing bwc against the most recent version
+task integTest {
+  if (project.bwc_tests_enabled) {
+    for (final def version : bwcVersions.snapshotsIndexCompatible) {
+      dependsOn "v${version}#bwcTest"
+    }
+  }
+}
 
+check.dependsOn(integTest)
 
diff --git a/qa/mixed-cluster/build.gradle b/qa/mixed-cluster/build.gradle
index 6abd49c12d3de..da99bbb4c8036 100644
--- a/qa/mixed-cluster/build.gradle
+++ b/qa/mixed-cluster/build.gradle
@@ -67,8 +67,15 @@ for (Version version : bwcVersions.wireCompatible) {
   }
 }
 
-if (project.bwc_tests_enabled) {
-  check.dependsOn(bwcTest)
-}
+test.enabled = false // no unit tests for rolling upgrades, only the rest integration test
 
+// basic integ tests includes testing bwc against the most recent version
+task integTest {
+  if (project.bwc_tests_enabled) {
+    for (final def version : bwcVersions.snapshotsWireCompatible) {
+      dependsOn "v${version}#bwcTest"
+    }
+  }
+}
 
+check.dependsOn(integTest)
diff --git a/qa/multi-cluster-search/build.gradle b/qa/multi-cluster-search/build.gradle
index 89710c126b466..782e83fbb34f2 100644
--- a/qa/multi-cluster-search/build.gradle
+++ b/qa/multi-cluster-search/build.gradle
@@ -17,7 +17,6 @@
  * under the License.
  */
 
-
 import org.elasticsearch.gradle.test.RestIntegTestTask
 
 apply plugin: 'elasticsearch.standalone-test'
@@ -50,4 +49,10 @@ mixedClusterTestRunner {
   finalizedBy 'remoteClusterTestCluster#node0.stop','remoteClusterTestCluster#node1.stop'
 }
 
-check.dependsOn(mixedClusterTest)
+task integTest {
+  dependsOn = [mixedClusterTest]
+}
+
+test.enabled = false // no unit tests for multi-cluster-search, only the rest integration test
+
+check.dependsOn(integTest)
diff --git a/qa/query-builder-bwc/build.gradle b/qa/query-builder-bwc/build.gradle
index ccb68b6a64a8a..c0144041e1a46 100644
--- a/qa/query-builder-bwc/build.gradle
+++ b/qa/query-builder-bwc/build.gradle
@@ -76,8 +76,14 @@ for (Version version : bwcVersions.indexCompatible) {
     }
 }
 
-if (project.bwc_tests_enabled) {
-  check.dependsOn(bwcTest)
-}
+test.enabled = false // no unit tests for rolling upgrades, only the rest integration test
 
+// basic integ tests includes testing bwc against the most recent version
+task integTest {
+  if (project.bwc_tests_enabled) {
+      final def version = bwcVersions.snapshotsIndexCompatible.first()
+      dependsOn "v${version}#bwcTest"
+  }
+}
 
+check.dependsOn(integTest)
diff --git a/qa/rolling-upgrade/build.gradle b/qa/rolling-upgrade/build.gradle
index 03e5deb1bf8f3..bfd37863cc246 100644
--- a/qa/rolling-upgrade/build.gradle
+++ b/qa/rolling-upgrade/build.gradle
@@ -140,9 +140,15 @@ for (Version version : bwcVersions.wireCompatible) {
   }
 }
 
-if (project.bwc_tests_enabled) {
-  check.dependsOn(bwcTest)
-}
-
+test.enabled = false // no unit tests for rolling upgrades, only the rest integration test
 
+// basic integ tests includes testing bwc against the most recent version
+task integTest {
+  if (project.bwc_tests_enabled) {
+    for (final def version : bwcVersions.snapshotsWireCompatible) {
+      dependsOn "v${version}#bwcTest"
+    }
+  }
+}
 
+check.dependsOn(integTest)
diff --git a/qa/vagrant/build.gradle b/qa/vagrant/build.gradle
index 447f145510b00..23d171f312512 100644
--- a/qa/vagrant/build.gradle
+++ b/qa/vagrant/build.gradle
@@ -67,6 +67,9 @@ forbiddenApisMain {
   ]
 }
 
+// we don't have additional tests for the tests themselves
+tasks.test.enabled = false
+
 // this project doesn't get published
 tasks.dependencyLicenses.enabled = false
 tasks.dependenciesInfo.enabled = false
diff --git a/qa/verify-version-constants/build.gradle b/qa/verify-version-constants/build.gradle
index f403b6594de14..30c879ec6146e 100644
--- a/qa/verify-version-constants/build.gradle
+++ b/qa/verify-version-constants/build.gradle
@@ -53,8 +53,13 @@ for (Version version : bwcVersions.indexCompatible) {
     bwcTest.dependsOn(versionBwcTest)
 }
 
-if (project.bwc_tests_enabled) {
-    check.dependsOn(bwcTest)
+test.enabled = false
+
+task integTest {
+  if (project.bwc_tests_enabled) {
+    final def version = bwcVersions.snapshotsIndexCompatible.first()
+    dependsOn "v${version}#bwcTest"
+  }
 }
 
 task verifyDocsLuceneVersion {
@@ -78,4 +83,5 @@ task verifyDocsLuceneVersion {
     }
   }
 }
-check.dependsOn verifyDocsLuceneVersion
+
+check.dependsOn integTest, verifyDocsLuceneVersion
diff --git a/qa/wildfly/build.gradle b/qa/wildfly/build.gradle
index 6adf34652596b..6c6bf5d9b31b9 100644
--- a/qa/wildfly/build.gradle
+++ b/qa/wildfly/build.gradle
@@ -212,6 +212,8 @@ if (!Os.isFamily(Os.FAMILY_WINDOWS)) {
 
 check.dependsOn(integTest)
 
+test.enabled = false
+
 dependencyLicenses.enabled = false
 dependenciesInfo.enabled = false
 
diff --git a/rest-api-spec/build.gradle b/rest-api-spec/build.gradle
index 0e48d3f8dbb12..cd49b9f192599 100644
--- a/rest-api-spec/build.gradle
+++ b/rest-api-spec/build.gradle
@@ -2,5 +2,6 @@ apply plugin: 'elasticsearch.build'
 apply plugin: 'nebula.maven-base-publish'
 apply plugin: 'nebula.maven-scm'
 
+test.enabled = false
 jarHell.enabled = false
 licenseHeaders.enabled = false
diff --git a/server/build.gradle b/server/build.gradle
index 556d0aaef6913..7e880e0dae4d2 100644
--- a/server/build.gradle
+++ b/server/build.gradle
@@ -329,12 +329,12 @@ if (isEclipse == false || project.path == ":server-tests") {
   task integTest(type: RandomizedTestingTask,
                  group: JavaBasePlugin.VERIFICATION_GROUP,
                  description: 'Multi-node tests',
-                 dependsOn: utest.dependsOn) {
+                 dependsOn: test.dependsOn) {
     configure(BuildPlugin.commonTestConfig(project))
-    classpath = project.utest.classpath
-    testClassesDir = project.utest.testClassesDir
+    classpath = project.test.classpath
+    testClassesDir = project.test.testClassesDir
     include '**/*IT.class'
   }
   check.dependsOn integTest
-  integTest.mustRunAfter utest
+  integTest.mustRunAfter test
 }
diff --git a/test/fixtures/hdfs-fixture/build.gradle b/test/fixtures/hdfs-fixture/build.gradle
index b88662e1e7ac8..70cb2b6bed2cb 100644
--- a/test/fixtures/hdfs-fixture/build.gradle
+++ b/test/fixtures/hdfs-fixture/build.gradle
@@ -39,3 +39,4 @@ task hdfs(type: JavaExec) {
 // just a test fixture: we aren't using jars in releases
 thirdPartyAudit.enabled = false
 // TODO: add a simple HDFS client test for this fixture
+test.enabled = false
diff --git a/test/fixtures/krb5kdc-fixture/build.gradle b/test/fixtures/krb5kdc-fixture/build.gradle
index 5e4466d735264..046ecc5fc0416 100644
--- a/test/fixtures/krb5kdc-fixture/build.gradle
+++ b/test/fixtures/krb5kdc-fixture/build.gradle
@@ -75,6 +75,7 @@ task destroy(type: org.elasticsearch.gradle.vagrant.VagrantCommandTask) {
 
 thirdPartyAudit.enabled = false
 licenseHeaders.enabled = false
+test.enabled = false
 
 // installKDC uses tabs in it for the Kerberos ACL file.
 // Ignore it for pattern checking.
diff --git a/test/fixtures/old-elasticsearch/build.gradle b/test/fixtures/old-elasticsearch/build.gradle
index 1bae4d863329c..5cfc02bbba3c6 100644
--- a/test/fixtures/old-elasticsearch/build.gradle
+++ b/test/fixtures/old-elasticsearch/build.gradle
@@ -24,6 +24,7 @@ a "ports" file with the port on which Elasticsearch is running.
 """
 
 apply plugin: 'elasticsearch.build'
+test.enabled = false
 
 dependencies {
   // Just for the constants....
diff --git a/test/framework/build.gradle b/test/framework/build.gradle
index 066e7fbd783c2..5f1bc524da599 100644
--- a/test/framework/build.gradle
+++ b/test/framework/build.gradle
@@ -71,7 +71,7 @@ task namingConventionsMain(type: org.elasticsearch.gradle.precommit.NamingConven
 }
 precommit.dependsOn namingConventionsMain
 
-utest {
+test.configure {
   systemProperty 'tests.gradle_index_compat_versions', bwcVersions.indexCompatible.join(',')
   systemProperty 'tests.gradle_wire_compat_versions', bwcVersions.wireCompatible.join(',')
 }
diff --git a/x-pack/plugin/core/build.gradle b/x-pack/plugin/core/build.gradle
index 98d170bffeef7..4bbe339a09b79 100644
--- a/x-pack/plugin/core/build.gradle
+++ b/x-pack/plugin/core/build.gradle
@@ -96,7 +96,7 @@ sourceSets.test.java {
     srcDir '../../license-tools/src/main/java'
 }
 
-utest {
+test {
     /*
      * We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
      * other if we allow them to set the number of available processors as it's set-once in Netty.
diff --git a/x-pack/plugin/ml/build.gradle b/x-pack/plugin/ml/build.gradle
index bd734581db155..8b991555c0670 100644
--- a/x-pack/plugin/ml/build.gradle
+++ b/x-pack/plugin/ml/build.gradle
@@ -96,15 +96,15 @@ integTest.enabled = false
 task internalClusterTest(type: RandomizedTestingTask,
                          group: JavaBasePlugin.VERIFICATION_GROUP,
                          description: 'Multi-node tests',
-                         dependsOn: utest.dependsOn) {
+                         dependsOn: test.dependsOn) {
   configure(BuildPlugin.commonTestConfig(project))
-  classpath = project.utest.classpath
-  testClassesDir = project.utest.testClassesDir
+  classpath = project.test.classpath
+  testClassesDir = project.test.testClassesDir
   include '**/*IT.class'
   systemProperty 'es.set.netty.runtime.available.processors', 'false'
 }
 check.dependsOn internalClusterTest
-internalClusterTest.mustRunAfter utest
+internalClusterTest.mustRunAfter test
 
 // also add an "alias" task to make typing on the command line easier
 task icTest {
diff --git a/x-pack/plugin/monitoring/build.gradle b/x-pack/plugin/monitoring/build.gradle
index 9f64625831adb..fbdb388e78e19 100644
--- a/x-pack/plugin/monitoring/build.gradle
+++ b/x-pack/plugin/monitoring/build.gradle
@@ -59,15 +59,15 @@ integTest.enabled = false
 task internalClusterTest(type: RandomizedTestingTask,
                          group: JavaBasePlugin.VERIFICATION_GROUP,
                          description: 'Multi-node tests',
-                         dependsOn: utest.dependsOn) {
+                         dependsOn: test.dependsOn) {
   configure(BuildPlugin.commonTestConfig(project))
-  classpath = project.utest.classpath
-  testClassesDir = project.utest.testClassesDir
+  classpath = project.test.classpath
+  testClassesDir = project.test.testClassesDir
   include '**/*IT.class'
   systemProperty 'es.set.netty.runtime.available.processors', 'false'
 }
 check.dependsOn internalClusterTest 
-internalClusterTest.mustRunAfter utest
+internalClusterTest.mustRunAfter test
 
 // also add an "alias" task to make typing on the command line easier task icTest {
 task icTest {
diff --git a/x-pack/plugin/rollup/build.gradle b/x-pack/plugin/rollup/build.gradle
index 3bb7f8f1cc62d..d8ce1ca304763 100644
--- a/x-pack/plugin/rollup/build.gradle
+++ b/x-pack/plugin/rollup/build.gradle
@@ -39,15 +39,15 @@ integTest.enabled = false
 task internalClusterTest(type: RandomizedTestingTask,
         group: JavaBasePlugin.VERIFICATION_GROUP,
         description: 'Multi-node tests',
-        dependsOn: utest.dependsOn) {
+        dependsOn: test.dependsOn) {
     configure(BuildPlugin.commonTestConfig(project))
-    classpath = project.utest.classpath
-    testClassesDir = project.utest.testClassesDir
+    classpath = project.test.classpath
+    testClassesDir = project.test.testClassesDir
     include '**/*IT.class'
     systemProperty 'es.set.netty.runtime.available.processors', 'false'
 }
 check.dependsOn internalClusterTest
-internalClusterTest.mustRunAfter utest
+internalClusterTest.mustRunAfter test
 
 // also add an "alias" task to make typing on the command line easier task icTest {
 task icTest {
diff --git a/x-pack/plugin/security/build.gradle b/x-pack/plugin/security/build.gradle
index 016e2ab35f187..12533a389b5f1 100644
--- a/x-pack/plugin/security/build.gradle
+++ b/x-pack/plugin/security/build.gradle
@@ -219,7 +219,7 @@ run {
     plugin xpackModule('core')
 }
 
-utest {
+test {
     /*
      * We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
      * other if we allow them to set the number of available processors as it's set-once in Netty.
diff --git a/x-pack/plugin/sql/jdbc/build.gradle b/x-pack/plugin/sql/jdbc/build.gradle
index b4944ea82bfd7..e383e71cd4c76 100644
--- a/x-pack/plugin/sql/jdbc/build.gradle
+++ b/x-pack/plugin/sql/jdbc/build.gradle
@@ -86,7 +86,7 @@ publishing {
 assemble.dependsOn shadowJar
 
 // Use the jar for testing so the tests are more "real"
-utest {
+test {
     classpath -= compileJava.outputs.files
     classpath -= configurations.compile
     classpath -= configurations.runtime
diff --git a/x-pack/plugin/sql/sql-cli/build.gradle b/x-pack/plugin/sql/sql-cli/build.gradle
index 4a8032896948a..06eb24c743ad8 100644
--- a/x-pack/plugin/sql/sql-cli/build.gradle
+++ b/x-pack/plugin/sql/sql-cli/build.gradle
@@ -133,7 +133,7 @@ task runcli {
 }
 
 // Use the jar for testing so we can get the proper version information
-utest {
+test {
     classpath -= compileJava.outputs.files
     classpath -= configurations.compile
     classpath -= configurations.runtime
diff --git a/x-pack/plugin/upgrade/build.gradle b/x-pack/plugin/upgrade/build.gradle
index af8563658ac30..5cead96ac7aa5 100644
--- a/x-pack/plugin/upgrade/build.gradle
+++ b/x-pack/plugin/upgrade/build.gradle
@@ -32,15 +32,15 @@ integTest.enabled = false
 task internalClusterTest(type: RandomizedTestingTask,
                          group: JavaBasePlugin.VERIFICATION_GROUP,
                          description: 'Multi-node tests',
-                         dependsOn: utest.dependsOn) {
+                         dependsOn: test.dependsOn) {
   configure(BuildPlugin.commonTestConfig(project))
-  classpath = project.utest.classpath
-  testClassesDir = project.utest.testClassesDir
+  classpath = project.test.classpath
+  testClassesDir = project.test.testClassesDir
   include '**/*IT.class'
   systemProperty 'es.set.netty.runtime.available.processors', 'false'
 }
 check.dependsOn internalClusterTest 
-internalClusterTest.mustRunAfter utest
+internalClusterTest.mustRunAfter test
 
 // also add an "alias" task to make typing on the command line easier
 task icTest {
diff --git a/x-pack/plugin/watcher/build.gradle b/x-pack/plugin/watcher/build.gradle
index f92b89db618ed..2b7b73d37962e 100644
--- a/x-pack/plugin/watcher/build.gradle
+++ b/x-pack/plugin/watcher/build.gradle
@@ -102,7 +102,7 @@ run {
     plugin xpackModule('core')
 }
 
-utest {
+test {
     /*
      * We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
      * other if we allow them to set the number of available processors as it's set-once in Netty.
diff --git a/x-pack/qa/full-cluster-restart/build.gradle b/x-pack/qa/full-cluster-restart/build.gradle
index baa080139a42d..b2bb7a63f6fb4 100644
--- a/x-pack/qa/full-cluster-restart/build.gradle
+++ b/x-pack/qa/full-cluster-restart/build.gradle
@@ -8,6 +8,7 @@ import java.util.regex.Matcher
 
 // Apply the java plugin to this project so the sources can be edited in an IDE
 apply plugin: 'elasticsearch.build'
+test.enabled = false
 
 dependencies {
     testCompile project(path: xpackModule('core'), configuration: 'runtime')
@@ -232,10 +233,19 @@ subprojects {
     }
   }
 
-  if (project.bwc_tests_enabled) {
-    check.dependsOn(bwcTest)
+  test.enabled = false // no unit tests for full cluster restarts, only the rest integration test
+
+  // basic integ tests includes testing bwc against the most recent version
+  task integTest {
+    if (project.bwc_tests_enabled) {
+      for (final def version : bwcVersions.snapshotsIndexCompatible) {
+        dependsOn "v${version}#bwcTest"
+      }
+    }
   }
 
+  check.dependsOn(integTest)
+
   dependencies {
       testCompile project(path: xpackModule('core'), configuration: 'runtime')
       testCompile project(path: xpackModule('watcher'), configuration: 'runtime')
diff --git a/x-pack/qa/multi-cluster-search-security/build.gradle b/x-pack/qa/multi-cluster-search-security/build.gradle
index ee771f0dc617c..f5265466965c1 100644
--- a/x-pack/qa/multi-cluster-search-security/build.gradle
+++ b/x-pack/qa/multi-cluster-search-security/build.gradle
@@ -69,4 +69,9 @@ mixedClusterTestRunner {
   finalizedBy 'remoteClusterTestCluster#node0.stop','remoteClusterTestCluster#node1.stop'
 }
 
-check.dependsOn(mixedClusterTest)
+task integTest {
+  dependsOn = [mixedClusterTest]
+}
+
+test.enabled = false // no unit tests for multi-cluster-search, only the rest integration test
+check.dependsOn(integTest)
diff --git a/x-pack/qa/openldap-tests/build.gradle b/x-pack/qa/openldap-tests/build.gradle
index 805bef80be889..24976ab6113ab 100644
--- a/x-pack/qa/openldap-tests/build.gradle
+++ b/x-pack/qa/openldap-tests/build.gradle
@@ -21,10 +21,10 @@ task copyIdpTrust(type: Copy) {
 }
 if (project.rootProject.vagrantSupported) {
   project.sourceSets.test.output.dir(outputDir, builtBy: copyIdpTrust)
-  integTest.dependsOn openLdapFixture
-  integTest.finalizedBy idpFixtureProject.halt
+  test.dependsOn openLdapFixture
+  test.finalizedBy idpFixtureProject.halt
 } else {
-  integTest.enabled = false
+  test.enabled = false
 }
 
 namingConventions {
diff --git a/x-pack/qa/rolling-upgrade-basic/build.gradle b/x-pack/qa/rolling-upgrade-basic/build.gradle
index 01eb0ef3ffdf8..6d5b250b460b7 100644
--- a/x-pack/qa/rolling-upgrade-basic/build.gradle
+++ b/x-pack/qa/rolling-upgrade-basic/build.gradle
@@ -119,9 +119,17 @@ for (Version version : bwcVersions.wireCompatible) {
     }
 }
 
-if (project.bwc_tests_enabled) {
-    check.dependsOn(bwcTest)
+test.enabled = false // no unit tests for rolling upgrades, only the rest integration test
+
+// basic integ tests includes testing bwc against the most recent version
+task integTest {
+    if (project.bwc_tests_enabled) {
+        for (final def version : bwcVersions.snapshotsWireCompatible) {
+            dependsOn "v${version}#bwcTest"
+        }
+    }
 }
+check.dependsOn(integTest)
 
 compileTestJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-rawtypes,-try,-unchecked"
 
diff --git a/x-pack/qa/rolling-upgrade/build.gradle b/x-pack/qa/rolling-upgrade/build.gradle
index e8d1bc1dee23d..351f33b941227 100644
--- a/x-pack/qa/rolling-upgrade/build.gradle
+++ b/x-pack/qa/rolling-upgrade/build.gradle
@@ -7,6 +7,7 @@ import java.util.regex.Matcher
 
 // Apply the java plugin to this project so the sources can be edited in an IDE
 apply plugin: 'elasticsearch.build'
+test.enabled = false
 
 dependencies {
   testCompile project(path: xpackModule('core'), configuration: 'runtime')
@@ -270,9 +271,17 @@ subprojects {
     }
   }
 
-  if (project.bwc_tests_enabled) {
-      check.dependsOn(bwcTest)
+  test.enabled = false // no unit tests for rolling upgrades, only the rest integration test
+
+  // basic integ tests includes testing bwc against the most recent version
+  task integTest {
+    if (project.bwc_tests_enabled) {
+      for (final def version : bwcVersions.snapshotsWireCompatible) {
+        dependsOn "v${version}#bwcTest"
+      }
+    }
   }
+  check.dependsOn(integTest)
 
   dependencies {
     testCompile project(path: xpackModule('core'), configuration: 'runtime')
diff --git a/x-pack/qa/sql/build.gradle b/x-pack/qa/sql/build.gradle
index 1640bfff8b3f1..0bea3a9364b71 100644
--- a/x-pack/qa/sql/build.gradle
+++ b/x-pack/qa/sql/build.gradle
@@ -17,6 +17,10 @@ dependencies {
   compile "org.jline:jline:3.6.0"
 }
 
+/* disable unit tests because these are all integration tests used
+ * other qa projects. */
+test.enabled = false
+
 dependencyLicenses.enabled = false
 dependenciesInfo.enabled = false
 
diff --git a/x-pack/qa/third-party/active-directory/build.gradle b/x-pack/qa/third-party/active-directory/build.gradle
index 3a72ebb98d636..c9fa55652108d 100644
--- a/x-pack/qa/third-party/active-directory/build.gradle
+++ b/x-pack/qa/third-party/active-directory/build.gradle
@@ -20,7 +20,7 @@ forbiddenPatterns {
   exclude '**/*.der'
 }
 
-integTest {
+test {
   /*
    * We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
    * other if we allow them to set the number of available processors as it's set-once in Netty.
@@ -39,9 +39,9 @@ task smbFixture {
 
 if (project.rootProject.vagrantSupported) {
   if (project.hasProperty('useExternalAD') == false) {
-    integTest.dependsOn smbFixture
-    integTest.finalizedBy smbFixtureProject.halt
+    test.dependsOn smbFixture
+    test.finalizedBy smbFixtureProject.halt
   }
 } else {
-  integTest.enabled = false
+  test.enabled = false
 }
diff --git a/x-pack/test/idp-fixture/build.gradle b/x-pack/test/idp-fixture/build.gradle
index 6442846e94029..c62ac0409ba95 100644
--- a/x-pack/test/idp-fixture/build.gradle
+++ b/x-pack/test/idp-fixture/build.gradle
@@ -39,4 +39,5 @@ task destroy(type: org.elasticsearch.gradle.vagrant.VagrantCommandTask) {
 
 thirdPartyAudit.enabled = false
 licenseHeaders.enabled = false
+test.enabled = false
 jarHell.enabled = false
diff --git a/x-pack/test/smb-fixture/build.gradle b/x-pack/test/smb-fixture/build.gradle
index b16e616daf6d2..233b289b295db 100644
--- a/x-pack/test/smb-fixture/build.gradle
+++ b/x-pack/test/smb-fixture/build.gradle
@@ -39,4 +39,5 @@ task destroy(type: org.elasticsearch.gradle.vagrant.VagrantCommandTask) {
 
 thirdPartyAudit.enabled = false
 licenseHeaders.enabled = false
+test.enabled = false
 jarHell.enabled = false

From 6ae2a7b125ebef8506f0f7d7ff199683568b574c Mon Sep 17 00:00:00 2001
From: Alpar Torok 
Date: Thu, 21 Jun 2018 09:55:51 +0300
Subject: [PATCH 21/28] Fix replacement of the test task

Based on information from gradle/gradle#5730 replace the task taking
into account the task providres.
Closes #31324.
---
 .../junit4/RandomizedTestingPlugin.groovy     | 42 ++++++++++++-------
 1 file changed, 26 insertions(+), 16 deletions(-)

diff --git a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
index 8682708686744..4cf887a795fec 100644
--- a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
+++ b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
@@ -3,11 +3,14 @@ package com.carrotsearch.gradle.junit4
 import com.carrotsearch.ant.tasks.junit4.JUnit4
 import org.gradle.api.AntBuilder
 import org.gradle.api.GradleException
+import org.gradle.api.InvalidUserDataException
 import org.gradle.api.Plugin
 import org.gradle.api.Project
 import org.gradle.api.Task
+import org.gradle.api.UnknownTaskException
 import org.gradle.api.plugins.JavaBasePlugin
 import org.gradle.api.tasks.TaskContainer
+import org.gradle.api.tasks.TaskProvider
 import org.gradle.api.tasks.testing.Test
 
 import java.util.concurrent.atomic.AtomicBoolean
@@ -68,29 +71,36 @@ class RandomizedTestingPlugin implements Plugin {
     }
 
     static void replaceTestTask(TaskContainer tasks) {
-        Test oldTestTask = tasks.findByPath('test')
-        if (oldTestTask == null) {
+        // Gradle 4.8 introduced lazy tasks, thus we deal both with the `test` task as well as it's provider
+        // https://github.com/gradle/gradle/issues/5730#issuecomment-398822153
+        // since we can't be sure if the task was ever realized, we remove both the provider and the task
+        TaskProvider oldTestProvider
+        try {
+            oldTestProvider = tasks.getByNameLater(Test, 'test')
+        }
+        catch (UnknownTaskException why) {
             // no test task, ok, user will use testing task on their own
             return
         }
+        Test oldTestTask = oldTestProvider.get()
         tasks.remove(oldTestTask)
+        // there's no way to remove the provider form the task collection, but since we realize the task above, this is
+        // sufficient.
 
-        Map properties = [
-            name: 'test',
-            type: RandomizedTestingTask,
-            dependsOn: oldTestTask.dependsOn,
-            group: JavaBasePlugin.VERIFICATION_GROUP,
-            description: 'Runs unit tests with the randomized testing framework'
-        ]
-        RandomizedTestingTask newTestTask = tasks.create(properties)
-        newTestTask.classpath = oldTestTask.classpath
-        newTestTask.testClassesDir = oldTestTask.project.sourceSets.test.output.classesDir
-        // since gradle 4.5, tasks immutable dependencies are "hidden" (do not show up in dependsOn)
-        // so we must explicitly add a dependency on generating the test classpath
-        newTestTask.dependsOn('testClasses')
+        // we still have to use replace here despite the remove above because the task container knows about the provider
+        // by the same name
+        RandomizedTestingTask newTestTask = tasks.replace('test', RandomizedTestingTask)
+        newTestTask.configure{
+            group =  JavaBasePlugin.VERIFICATION_GROUP
+            description = 'Runs unit tests with the randomized testing framework'
+            dependsOn oldTestTask.dependsOn, 'testClasses'
+            classpath = oldTestTask.classpath
+            testClassesDir = oldTestTask.project.sourceSets.test.output.classesDir
+        }
 
         // hack so check task depends on custom test
-        Task checkTask = tasks.findByPath('check')
+        Task checkTask = tasks.getByName('check')
+        checkTask.dependsOn.remove(oldTestProvider)
         checkTask.dependsOn.remove(oldTestTask)
         checkTask.dependsOn.add(newTestTask)
     }

From 05b966ce40b2864e171614d37603eec986d343ee Mon Sep 17 00:00:00 2001
From: Alpar Torok 
Date: Thu, 21 Jun 2018 10:00:08 +0300
Subject: [PATCH 22/28] Only apply build comapare plugin if needed

---
 build.gradle | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/build.gradle b/build.gradle
index dc67294f3d140..529d0e2926f9f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -576,9 +576,8 @@ gradle.projectsEvaluated {
   }
 }
 
-apply plugin: 'compare-gradle-builds'
-
 if (System.properties.get("build.compare") != null) {
+  apply plugin: 'compare-gradle-builds'
   compareGradleBuilds {
     ext.referenceProject = System.properties.get("build.compare")
     doFirst {

From ba43cc1cecb269ca4545ca59f9aabae9056a9feb Mon Sep 17 00:00:00 2001
From: Alpar Torok 
Date: Thu, 21 Jun 2018 10:13:00 +0300
Subject: [PATCH 23/28] Make sure test runs before integTest

---
 build.gradle | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/build.gradle b/build.gradle
index 529d0e2926f9f..3243af0807dc5 100644
--- a/build.gradle
+++ b/build.gradle
@@ -600,3 +600,10 @@ if (System.properties.get("build.compare") != null) {
     }
   }
 }
+
+// make sure integration tests run after unit tests
+allprojects {
+  if (tasks.findByPath('test') != null && tasks.findByPath('integTest') != null) {
+      integTest.mustRunAfter test
+  }
+}

From 505ab68d933979c7d35e226860b6d1dfc240edd9 Mon Sep 17 00:00:00 2001
From: Alpar Torok 
Date: Thu, 21 Jun 2018 15:04:41 +0300
Subject: [PATCH 24/28] Fix doclint aftter merge

---
 .../search/aggregations/bucket/DateHistogramIT.java             | 2 --
 1 file changed, 2 deletions(-)

diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramIT.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramIT.java
index 26e6f4c076553..c40e3b73c6606 100644
--- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramIT.java
+++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramIT.java
@@ -1345,8 +1345,6 @@ public void testExceptionOnNegativeInterval() {
      * https://github.com/elastic/elasticsearch/issues/31392 demonstrates an edge case where a date field mapping with
      * "format" = "epoch_millis" can lead for the date histogram aggregation to throw an error if a non-UTC time zone
      * with daylight savings time is used. This test was added to check this is working now
-     * @throws ExecutionException
-     * @throws InterruptedException
      */
     public void testRewriteTimeZone_EpochMillisFormat() throws InterruptedException, ExecutionException {
         String index = "test31392";

From f2edc18682e2b02fa4fff672408e276a7a580934 Mon Sep 17 00:00:00 2001
From: Alpar Torok 
Date: Mon, 25 Jun 2018 15:45:56 +0300
Subject: [PATCH 25/28] PR review comments

---
 .../gradle/junit4/RandomizedTestingPlugin.groovy    | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
index 4cf887a795fec..aab6b0ae0486e 100644
--- a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
+++ b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
@@ -1,13 +1,7 @@
 package com.carrotsearch.gradle.junit4
 
 import com.carrotsearch.ant.tasks.junit4.JUnit4
-import org.gradle.api.AntBuilder
-import org.gradle.api.GradleException
-import org.gradle.api.InvalidUserDataException
-import org.gradle.api.Plugin
-import org.gradle.api.Project
-import org.gradle.api.Task
-import org.gradle.api.UnknownTaskException
+import org.gradle.api.*
 import org.gradle.api.plugins.JavaBasePlugin
 import org.gradle.api.tasks.TaskContainer
 import org.gradle.api.tasks.TaskProvider
@@ -31,7 +25,7 @@ class RandomizedTestingPlugin implements Plugin {
         // https://github.com/elastic/elasticsearch/issues/31324
         if (sanityCheckConfigured.getAndSet(true) == false) {
             project.rootProject.getGradle().getTaskGraph().whenReady {
-                def nonConforming = project.getGradle().getTaskGraph().allTasks
+                List nonConforming = project.getGradle().getTaskGraph().allTasks
                         .findAll { it.name == "test" }
                         .findAll { (it instanceof RandomizedTestingTask) == false}
                         .collect { "${it.path} -> ${it.class}" }
@@ -83,9 +77,6 @@ class RandomizedTestingPlugin implements Plugin {
             return
         }
         Test oldTestTask = oldTestProvider.get()
-        tasks.remove(oldTestTask)
-        // there's no way to remove the provider form the task collection, but since we realize the task above, this is
-        // sufficient.
 
         // we still have to use replace here despite the remove above because the task container knows about the provider
         // by the same name

From e648dcedf43a6eb54dfc94175b600ec62edcd930 Mon Sep 17 00:00:00 2001
From: Alpar Torok 
Date: Fri, 22 Jun 2018 18:47:05 +0300
Subject: [PATCH 26/28] Switch to Gradle 4.8.1 and remove workaround

---
 .../elasticsearch/gradle/BuildPlugin.groovy   |   2 --
 gradle/wrapper/gradle-wrapper.jar             | Bin 54418 -> 54417 bytes
 gradle/wrapper/gradle-wrapper.properties      |   4 ++--
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy
index e69fc3821a768..3363c8534a40e 100644
--- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy
@@ -350,8 +350,6 @@ class BuildPlugin implements Plugin {
             }
             configuration.resolutionStrategy { 
                 failOnVersionConflict()
-                // work around https://github.com/gradle/gradle/issues/5692
-                preferProjectModules()
             }
         })
 
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index f5a7e5e1fcf56305fbcbf1dda36c9786b8a2ec3d..758de960ec7947253b058ff79c88ce51f3abe08a 100644
GIT binary patch
delta 771
zcmYk4T}YEr7{_;xu@BnX8)MDQr8X&Y;z(kCkl>~nBhd-2(2$yttEkEHrlKeUiLkJ3
z|B@`{(wp+4i?E;^QTvj8IJY&gipa}CD9Y=g<6-Guc;WYd{{M5H=Y4tn^JTvIGH;XY
z!^N}5tRj)

delta 736
zcmYk4T}V@59LD$ltxe01L!h(cR5T)-xTY|Z3>zg`lXRd-ltoZkLKE>KNxBidi0or$
z&j`$~5WHA)V?tR{**=`x+~%A_-dHygLKj)kt-Zb+=3Y4P`~9Ey9G>^^DxM6NC&PIx
z>)hXeO(!)PO}k=k*Z%I?>SG$GJoBc_TTo^DV%ejyH|sKUUMulJzNdgcF24bFzRKPA
zaL3oio@2pR%|7Cfua0eEuvw2&{t7ZMI79hpWirP6M(WTCbp|r=!(T(kbt$b4oTkw%
zRqJR|pGtlPth8Pzv|-Uk4@w12E;iE9auv0%U_BLA3A0z_VIm+wZ<4ZkS#{}5BK%;{
z!4s^ZhZa?HupKl~;;c~XQZ3zR7WjCnm3q#rnBxkW`T43tSJ(iahAvS@Cr=D;cILvC
zkZ?FGv+J;i?aT`$e1dHu7QRaNZzHekAetgAROUcp*nrCpJ;D(qz3ma&87ak)-t?CG
zUJ-OJ*Rm44SiV5}`uX4xz7On$y+0q@Q3;JvnI;F+@d4;pB}_+U=Eg#_o4yW;pe5Ey
z_l5+%A2MJgW~A9+t_^s}>t2k@H1kBH8zWkb$E`H2r1X~}i9CNWdsSS>mdYXHt
zYBtta%rrhC)RZ_wcgF;dBqj;6
Date: Tue, 26 Jun 2018 17:22:30 +0300
Subject: [PATCH 27/28] PR review comments

---
 .../gradle/junit4/RandomizedTestingPlugin.groovy         | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
index aab6b0ae0486e..809aa4fb57ea4 100644
--- a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
+++ b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
@@ -1,7 +1,11 @@
 package com.carrotsearch.gradle.junit4
 
 import com.carrotsearch.ant.tasks.junit4.JUnit4
-import org.gradle.api.*
+import org.gradle.api.GradleException
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.Task
+import org.gradle.api.UnknownTaskException
 import org.gradle.api.plugins.JavaBasePlugin
 import org.gradle.api.tasks.TaskContainer
 import org.gradle.api.tasks.TaskProvider
@@ -71,8 +75,7 @@ class RandomizedTestingPlugin implements Plugin {
         TaskProvider oldTestProvider
         try {
             oldTestProvider = tasks.getByNameLater(Test, 'test')
-        }
-        catch (UnknownTaskException why) {
+        } catch (UnknownTaskException unused) {
             // no test task, ok, user will use testing task on their own
             return
         }

From ca887890bbe96ef71e87916e4ff93af810c19bb7 Mon Sep 17 00:00:00 2001
From: Alpar Torok 
Date: Wed, 27 Jun 2018 11:13:39 +0300
Subject: [PATCH 28/28] Consolidate task ordering

---
 build.gradle | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/build.gradle b/build.gradle
index 3243af0807dc5..862943b50f5eb 100644
--- a/build.gradle
+++ b/build.gradle
@@ -326,6 +326,9 @@ gradle.projectsEvaluated {
       // :test:framework:test cannot run before and after :server:test
       return
     }
+    if (tasks.findByPath('test') != null && tasks.findByPath('integTest') != null) {
+      integTest.mustRunAfter test
+    }
     configurations.all { Configuration configuration ->
       /*
        * The featureAwarePlugin configuration has a dependency on x-pack:plugin:core and x-pack:plugin:core has a dependency on the
@@ -600,10 +603,3 @@ if (System.properties.get("build.compare") != null) {
     }
   }
 }
-
-// make sure integration tests run after unit tests
-allprojects {
-  if (tasks.findByPath('test') != null && tasks.findByPath('integTest') != null) {
-      integTest.mustRunAfter test
-  }
-}