Skip to content

Commit 3853c65

Browse files
Fix flaky Gradle Daemon instrumentation smoke test (#8955)
1 parent f2ab30b commit 3853c65

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

dd-smoke-tests/gradle/src/test/groovy/datadog/smoketest/GradleDaemonSmokeTest.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class GradleDaemonSmokeTest extends AbstractGradleTest {
5050

5151
where:
5252
gradleVersion | projectName | successExpected | expectedTraces | expectedCoverages
53-
"3.0" | "test-succeed-old-gradle" | true | 5 | 1
53+
"3.5" | "test-succeed-old-gradle" | true | 5 | 1
5454
"7.6.4" | "test-succeed-legacy-instrumentation" | true | 5 | 1
5555
"7.6.4" | "test-succeed-multi-module-legacy-instrumentation" | true | 7 | 2
5656
"7.6.4" | "test-succeed-multi-forks-legacy-instrumentation" | true | 6 | 2
@@ -244,6 +244,7 @@ class GradleDaemonSmokeTest extends AbstractGradleTest {
244244
.withProjectDir(projectFolder.toFile())
245245
.withGradleVersion(gradleVersion)
246246
.withArguments(arguments)
247+
.withEnvironment(["GRADLE_VERSION": gradleVersion])
247248
.forwardOutput()
248249

249250
println "${new Date()}: $specificationContext.currentIteration.displayName - Starting Gradle run"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[ {
22
"files" : [ {
3-
"bitmap" : "AAAAx98=",
3+
"bitmap" : "AAAAx+EN",
44
"filename" : "src/test/java/datadog/smoke/HelloPluginFunctionalTest.java"
55
} ],
66
"span_id" : ${content_span_id_4},
77
"test_session_id" : ${content_test_session_id},
88
"test_suite_id" : ${content_test_suite_id}
9-
} ]
9+
} ]

dd-smoke-tests/gradle/src/test/resources/test-succeed-gradle-plugin-test/events.ftl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@
215215
"_dd.profiling.enabled" : 0,
216216
"_dd.trace_span_attribute_schema" : 0,
217217
"process_id" : ${content_metrics_process_id_2},
218-
"test.source.end" : 40,
218+
"test.source.end" : 44,
219219
"test.source.start" : 16
220220
},
221221
"name" : "junit5.test_suite",
@@ -273,7 +273,7 @@
273273
"_dd.profiling.enabled" : 0,
274274
"_dd.trace_span_attribute_schema" : 0,
275275
"process_id" : ${content_metrics_process_id_2},
276-
"test.source.end" : 39,
276+
"test.source.end" : 43,
277277
"test.source.start" : 30
278278
},
279279
"name" : "junit5.test",
@@ -464,4 +464,4 @@
464464
},
465465
"type" : "span",
466466
"version" : 1
467-
} ]
467+
} ]

dd-smoke-tests/gradle/src/test/resources/test-succeed-gradle-plugin-test/src/test/java/datadog/smoke/HelloPluginFunctionalTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ void pluginPrintsHelloMessageOnGradle85() {
3030
BuildResult result = GradleRunner.create()
3131
.withProjectDir(testProjectDir.toFile())
3232
.withPluginClasspath()
33-
.withGradleVersion("8.5")
33+
// Use the same Gradle version as of the actual smoke test that builds this project.
34+
// This is to ensure Gradle is already downloaded and available in the environment.
35+
// Gradle Test Kit can download a Gradle distribution by itself,
36+
// but sometimes these downloads fail, making the test flaky.
37+
.withGradleVersion(System.getenv("GRADLE_VERSION"))
3438
.withArguments("hello", "--stacktrace")
3539
.forwardOutput()
3640
.build();

0 commit comments

Comments
 (0)