Skip to content

Commit 9b9ee8e

Browse files
authored
[Tests] Simplify classpath for analytics javaRestTests (#124274) (#124494)
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 521ebfa commit 9b9ee8e

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
@@ -14,11 +14,10 @@ base {
1414
archivesName = 'x-pack-analytics'
1515
}
1616

17-
tasks.named('javaRestTest') {
18-
usesDefaultDistribution()
19-
}
20-
2117
dependencies {
18+
clusterModules project(':modules:aggregations')
19+
clusterPlugins project(':x-pack:plugin:analytics')
20+
2221
api 'org.apache.commons:commons-math3:3.6.1'
2322
compileOnly project(path: xpackModule('core'))
2423
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)