Skip to content

Commit e6ad4a2

Browse files
authored
[Tests] Simplify classpath for analytics javaRestTests (elastic#124274) (elastic#124493)
This replaces the usage of a defaultDistribution for javaRestTest by the integTestDistribution. This has a few advantages: 1. The overall dependencies on running the java rest tests are minimized. By using the default distribution we rely on building the whole default distribution (including all modules and plugins) before we can run these tests. This a) takes time and b) dramatically reduces the likelyhood of us avoiding test task execution at all as we basically declare the whole distro as an input. By using integTest distro we reduce the surface of the inputs dramatically which also results in faster execution of these tests 2. its more idiomatic as one pattern we see is that we e.g disable the security settings that we would not need once we use the integTest distro without the security plugin 3. it makes test setup and its dependencies more explicit. Point 3. might sound as like a downside at first, but for understanding what those tests are doing and what they are relying on I think its worth the 3 more lines of code. Here are two build scans task executions: - before the `javaRestTest` task requires `995 tasks, 2 transforms executed in 155 projects`: https://gradle-enterprise.elastic.co/s/drj5mfzsfx7ra/timeline - after we only rely on `275 tasks, 2 transforms executed in 56 projects`: https://gradle-enterprise.elastic.co/s/jr5sblhppn4fg/timeline?page=2
1 parent b098aca commit e6ad4a2

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

x-pack/plugin/analytics/build.gradle

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ base {
1919
archivesName = 'x-pack-analytics'
2020
}
2121

22-
tasks.named('javaRestTest') {
23-
usesDefaultDistribution()
24-
}
25-
2622
dependencies {
23+
clusterModules project(':modules:aggregations')
24+
clusterPlugins project(':x-pack:plugin:analytics')
25+
2726
api 'org.apache.commons:commons-math3:3.6.1'
2827
compileOnly project(path: xpackModule('core'))
2928
compileOnly project(":server")

x-pack/plugin/analytics/src/javaRestTest/java/org/elasticsearch/multiterms/AggsTimeoutIT.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,9 @@ public class AggsTimeoutIT extends ESRestTestCase {
5353

5454
@ClassRule
5555
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
56-
.distribution(DistributionType.DEFAULT)
57-
.setting("xpack.watcher.enabled", "false")
58-
.setting("xpack.ml.enabled", "false")
59-
.setting("xpack.security.enabled", "false")
60-
.setting("xpack.security.transport.ssl.enabled", "false")
61-
.setting("xpack.security.http.ssl.enabled", "false")
56+
.distribution(DistributionType.INTEG_TEST)
57+
.plugin("x-pack-analytics")
58+
.module("aggregations")
6259
.jvmArg("-Xmx1g")
6360
.build();
6461

0 commit comments

Comments
 (0)