@@ -2,13 +2,13 @@ package datadog.gradle.plugin.version
2
2
3
3
import org.assertj.core.api.Assertions.assertThat
4
4
import org.gradle.testkit.runner.GradleRunner
5
+ import org.junit.jupiter.api.Disabled
5
6
import org.junit.jupiter.api.Test
6
7
import org.junit.jupiter.api.io.CleanupMode
7
8
import org.junit.jupiter.api.io.TempDir
8
9
import java.io.File
9
10
import java.io.IOException
10
11
11
-
12
12
class TracerVersionIntegrationTest {
13
13
14
14
@Test
@@ -89,41 +89,25 @@ class TracerVersionIntegrationTest {
89
89
projectDir,
90
90
" 1.53.0-SNAPSHOT-DIRTY" ,
91
91
beforeGradle = {
92
- exec(projectDir, " git" , " init" , " --initial-branch" , " main" )
93
- exec(projectDir,
" git" ,
" config" ,
" user.email" ,
" [email protected] " )
94
- exec(projectDir, " git" , " config" , " user.name" , " Test" )
95
- exec(projectDir, " git" , " add" , " -A" )
96
- exec(projectDir, " git" , " commit" , " -m" , " A commit" )
97
- exec(projectDir, " git" , " tag" , " v1.52.0" , " -m" , " " )
98
-
99
- File (projectDir, " settings.gradle.kts" ).appendText("""
100
-
101
- // uncommitted change this file,
102
- """ .trimIndent())
103
- }
104
- )
105
- }
92
+ println (" Setting up git repository in $projectDir " )
93
+ File (projectDir, " gradle.properties" ).writeText(
94
+ """
95
+ tracerVersion.dirtiness=true
96
+ """ .trimIndent()
97
+ )
106
98
107
- @Test
108
- fun `should ignore dirtiness if CI env` (@TempDir projectDir : File ) { // CI patch some tracked files
109
- assertTracerVersion(
110
- projectDir,
111
- " 1.52.0" ,
112
- beforeGradle = {
113
99
exec(projectDir, " git" , " init" , " --initial-branch" , " main" )
114
100
exec(projectDir,
" git" ,
" config" ,
" user.email" ,
" [email protected] " )
115
101
exec(projectDir, " git" , " config" , " user.name" , " Test" )
116
102
exec(projectDir, " git" , " add" , " -A" )
117
103
exec(projectDir, " git" , " commit" , " -m" , " A commit" )
118
104
exec(projectDir, " git" , " tag" , " v1.52.0" , " -m" , " " )
119
105
120
- // dirty file ignored
121
106
File (projectDir, " settings.gradle.kts" ).appendText("""
122
107
123
108
// uncommitted change this file,
124
109
""" .trimIndent())
125
- },
126
- additionalEnv = mapOf (" CI" to " true" )
110
+ }
127
111
)
128
112
}
129
113
@@ -157,6 +141,12 @@ class TracerVersionIntegrationTest {
157
141
projectDir,
158
142
" 1.53.0-SNAPSHOT-DIRTY" ,
159
143
beforeGradle = {
144
+ File (projectDir, " gradle.properties" ).writeText(
145
+ """
146
+ tracerVersion.dirtiness=true
147
+ """ .trimIndent()
148
+ )
149
+
160
150
exec(projectDir, " git" , " init" , " --initial-branch" , " main" )
161
151
exec(projectDir,
" git" ,
" config" ,
" user.email" ,
" [email protected] " )
162
152
exec(projectDir, " git" , " config" , " user.name" , " Test" )
@@ -268,7 +258,6 @@ class TracerVersionIntegrationTest {
268
258
expectedVersion : String ,
269
259
beforeGradle : () -> Unit = {},
270
260
workingDirectory : File = projectDir,
271
- additionalEnv : Map <String , String > = mapOf("CI " to "false"),
272
261
) {
273
262
File (projectDir, " settings.gradle.kts" ).writeText(
274
263
"""
@@ -296,7 +285,6 @@ class TracerVersionIntegrationTest {
296
285
// .withGradleVersion(gradleVersion) // Use current gradle version
297
286
.withPluginClasspath()
298
287
.withArguments(" printVersion" , " --quiet" )
299
- .withEnvironment(System .getenv() + additionalEnv)
300
288
.withProjectDir(workingDirectory)
301
289
// .withDebug(true)
302
290
.build()
0 commit comments