|
1 | 1 | package datadog.smoketest |
2 | 2 |
|
3 | | - |
4 | 3 | import datadog.trace.api.Config |
5 | 4 | import datadog.trace.api.Platform |
6 | 5 | import datadog.trace.api.config.CiVisibilityConfig |
7 | 6 | import datadog.trace.api.config.GeneralConfig |
| 7 | +import datadog.trace.api.config.TraceInstrumentationConfig |
8 | 8 | import datadog.trace.util.Strings |
9 | 9 | import org.gradle.testkit.runner.BuildResult |
10 | 10 | import org.gradle.testkit.runner.GradleRunner |
11 | 11 | import org.gradle.testkit.runner.TaskOutcome |
12 | 12 | import org.gradle.util.DistributionLocator |
13 | 13 | import org.gradle.util.GradleVersion |
14 | | -import org.gradle.wrapper.Download |
15 | | -import org.gradle.wrapper.Install |
16 | | -import org.gradle.wrapper.PathAssembler |
17 | | -import org.gradle.wrapper.WrapperConfiguration |
| 14 | +import org.gradle.wrapper.* |
18 | 15 | import spock.lang.IgnoreIf |
19 | 16 | import spock.lang.Shared |
20 | 17 | import spock.lang.TempDir |
@@ -49,34 +46,35 @@ class GradleDaemonSmokeTest extends AbstractGradleTest { |
49 | 46 | runGradleTest(gradleVersion, projectName, false, successExpected, false, expectedTraces, expectedCoverages) |
50 | 47 |
|
51 | 48 | where: |
52 | | - gradleVersion | projectName | successExpected | expectedTraces | expectedCoverages |
53 | | - "3.0" | "test-succeed-old-gradle" | true | 5 | 1 |
54 | | - "7.6.4" | "test-succeed-legacy-instrumentation" | true | 5 | 1 |
55 | | - "7.6.4" | "test-succeed-multi-module-legacy-instrumentation" | true | 7 | 2 |
56 | | - "7.6.4" | "test-succeed-multi-forks-legacy-instrumentation" | true | 6 | 2 |
57 | | - "7.6.4" | "test-skip-legacy-instrumentation" | true | 2 | 0 |
58 | | - "7.6.4" | "test-failed-legacy-instrumentation" | false | 4 | 0 |
59 | | - "7.6.4" | "test-corrupted-config-legacy-instrumentation" | false | 1 | 0 |
| 49 | + gradleVersion | projectName | successExpected | expectedTraces | expectedCoverages |
| 50 | + "3.0" | "test-succeed-old-gradle" | true | 5 | 1 |
| 51 | + "7.6.4" | "test-succeed-legacy-instrumentation" | true | 5 | 1 |
| 52 | + "7.6.4" | "test-succeed-multi-module-legacy-instrumentation" | true | 7 | 2 |
| 53 | + "7.6.4" | "test-succeed-multi-forks-legacy-instrumentation" | true | 6 | 2 |
| 54 | + "7.6.4" | "test-skip-legacy-instrumentation" | true | 2 | 0 |
| 55 | + "7.6.4" | "test-failed-legacy-instrumentation" | false | 4 | 0 |
| 56 | + "7.6.4" | "test-corrupted-config-legacy-instrumentation" | false | 1 | 0 |
60 | 57 | } |
61 | 58 |
|
62 | 59 | def "test #projectName, v#gradleVersion, configCache: #configurationCache"() { |
63 | 60 | runGradleTest(gradleVersion, projectName, configurationCache, successExpected, flakyRetries, expectedTraces, expectedCoverages) |
64 | 61 |
|
65 | 62 | where: |
66 | | - gradleVersion | projectName | configurationCache | successExpected | flakyRetries | expectedTraces | expectedCoverages |
67 | | - "8.3" | "test-succeed-new-instrumentation" | false | true | false | 5 | 1 |
68 | | - "8.9" | "test-succeed-new-instrumentation" | false | true | false | 5 | 1 |
69 | | - LATEST_GRADLE_VERSION | "test-succeed-new-instrumentation" | false | true | false | 5 | 1 |
70 | | - "8.3" | "test-succeed-new-instrumentation" | true | true | false | 5 | 1 |
71 | | - "8.9" | "test-succeed-new-instrumentation" | true | true | false | 5 | 1 |
72 | | - LATEST_GRADLE_VERSION | "test-succeed-new-instrumentation" | true | true | false | 5 | 1 |
73 | | - LATEST_GRADLE_VERSION | "test-succeed-multi-module-new-instrumentation" | false | true | false | 7 | 2 |
74 | | - LATEST_GRADLE_VERSION | "test-succeed-multi-forks-new-instrumentation" | false | true | false | 6 | 2 |
75 | | - LATEST_GRADLE_VERSION | "test-skip-new-instrumentation" | false | true | false | 2 | 0 |
76 | | - LATEST_GRADLE_VERSION | "test-failed-new-instrumentation" | false | false | false | 4 | 0 |
77 | | - LATEST_GRADLE_VERSION | "test-corrupted-config-new-instrumentation" | false | false | false | 1 | 0 |
78 | | - LATEST_GRADLE_VERSION | "test-succeed-junit-5" | false | true | false | 5 | 1 |
79 | | - LATEST_GRADLE_VERSION | "test-failed-flaky-retries" | false | false | true | 8 | 0 |
| 63 | + gradleVersion | projectName | configurationCache | successExpected | flakyRetries | expectedTraces | expectedCoverages |
| 64 | + "8.3" | "test-succeed-new-instrumentation" | false | true | false | 5 | 1 |
| 65 | + "8.9" | "test-succeed-new-instrumentation" | false | true | false | 5 | 1 |
| 66 | + LATEST_GRADLE_VERSION | "test-succeed-new-instrumentation" | false | true | false | 5 | 1 |
| 67 | + "8.3" | "test-succeed-new-instrumentation" | true | true | false | 5 | 1 |
| 68 | + "8.9" | "test-succeed-new-instrumentation" | true | true | false | 5 | 1 |
| 69 | + LATEST_GRADLE_VERSION | "test-succeed-new-instrumentation" | true | true | false | 5 | 1 |
| 70 | + LATEST_GRADLE_VERSION | "test-succeed-multi-module-new-instrumentation" | false | true | false | 7 | 2 |
| 71 | + LATEST_GRADLE_VERSION | "test-succeed-multi-forks-new-instrumentation" | false | true | false | 6 | 2 |
| 72 | + LATEST_GRADLE_VERSION | "test-skip-new-instrumentation" | false | true | false | 2 | 0 |
| 73 | + LATEST_GRADLE_VERSION | "test-failed-new-instrumentation" | false | false | false | 4 | 0 |
| 74 | + LATEST_GRADLE_VERSION | "test-corrupted-config-new-instrumentation" | false | false | false | 1 | 0 |
| 75 | + LATEST_GRADLE_VERSION | "test-succeed-junit-5" | false | true | false | 5 | 1 |
| 76 | + LATEST_GRADLE_VERSION | "test-failed-flaky-retries" | false | false | true | 8 | 0 |
| 77 | + LATEST_GRADLE_VERSION | "test-succeed-gradle-plugin-test" | false | true | false | 5 | 0 |
80 | 78 | } |
81 | 79 |
|
82 | 80 | private runGradleTest(String gradleVersion, String projectName, boolean configurationCache, boolean successExpected, boolean flakyRetries, int expectedTraces, int expectedCoverages) { |
@@ -131,6 +129,16 @@ class GradleDaemonSmokeTest extends AbstractGradleTest { |
131 | 129 | "${Strings.propertyNameToSystemPropertyName(CiVisibilityConfig.CIVISIBILITY_AGENTLESS_ENABLED)}=true," + |
132 | 130 | "${Strings.propertyNameToSystemPropertyName(CiVisibilityConfig.CIVISIBILITY_GIT_UPLOAD_ENABLED)}=false," + |
133 | 131 | "${Strings.propertyNameToSystemPropertyName(CiVisibilityConfig.CIVISIBILITY_CIPROVIDER_INTEGRATION_ENABLED)}=false," + |
| 132 | + /* |
| 133 | + * Some of the smoke tests (in particular the one with the Gradle plugin), are using Gradle Test Kit for their tests. |
| 134 | + * Gradle Test Kit needs to do a "chmod" when starting a Gradle Daemon. |
| 135 | + * This "chmod" operation is traced by datadog.trace.instrumentation.java.lang.ProcessImplInstrumentation and is reported as a span. |
| 136 | + * The problem is that the "chmod" only happens when running in CI (could be due to differences in OS or FS permissions), |
| 137 | + * so when running the tests locally, the "chmod" span is not there. |
| 138 | + * This causes the tests to fail because the number of reported traces is different. |
| 139 | + * To avoid this discrepancy between local and CI runs, we disable tracing instrumentations. |
| 140 | + */ |
| 141 | + "${Strings.propertyNameToSystemPropertyName(TraceInstrumentationConfig.TRACE_ENABLED)}=false," + |
134 | 142 | "${Strings.propertyNameToSystemPropertyName(CiVisibilityConfig.CIVISIBILITY_JACOCO_PLUGIN_VERSION)}=$JACOCO_PLUGIN_VERSION," + |
135 | 143 | "${Strings.propertyNameToSystemPropertyName(CiVisibilityConfig.CIVISIBILITY_AGENTLESS_URL)}=${mockBackend.intakeUrl}" |
136 | 144 |
|
|
0 commit comments