Skip to content

Commit

Permalink
Rename test variables for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
bigdaz committed Nov 8, 2024
1 parent 97862bf commit 0ccb8ab
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 86 deletions.
8 changes: 4 additions & 4 deletions src/test/groovy/com/gradle/BaseInitScriptTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@ abstract class BaseInitScriptTest extends Specification {
buildFile << ''
}

void declareDvPluginApplication(GradleVersion gradleVersion, TestDvPluginVersion dvPlugin, String ccudPluginVersion = null, URI serverUri = mockScansServer.address) {
void declareDvPluginApplication(TestGradleVersion testGradle, TestDvPluginVersion dvPlugin, String ccudPluginVersion = null, URI serverUri = mockScansServer.address) {
if (dvPlugin.deprecated) {
allowDevelocityDeprecationWarning = true
}
if (gradleVersion < GRADLE_6) {
if (testGradle.gradleVersion < GRADLE_6) {
buildFile.text = configuredPlugin(dvPlugin, ccudPluginVersion, serverUri)
} else {
settingsFile.text = configuredPlugin(dvPlugin, ccudPluginVersion, serverUri)
Expand All @@ -200,8 +200,8 @@ abstract class BaseInitScriptTest extends Specification {
"""
}

BuildResult run(List<String> args, GradleVersion gradleVersion = GradleVersion.current(), Map<String, String> envVars = [:]) {
def result = createRunner(args, gradleVersion, envVars).build()
BuildResult run(List<String> args, TestGradleVersion testGradle, Map<String, String> envVars = [:]) {
def result = createRunner(args, testGradle.gradleVersion, envVars).build()
assertNoDeprecationWarning(result)
}

Expand Down
32 changes: 16 additions & 16 deletions src/test/groovy/com/gradle/TestBuildScanCapture.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -5,76 +5,76 @@ import spock.lang.Requires

class TestBuildScanCapture extends BaseInitScriptTest {

@Requires({data.testGradleVersion.compatibleWithCurrentJvm})
@Requires({data.testGradle.compatibleWithCurrentJvm})
def "does not capture build scan url when init-script not enabled"() {
given:
captureBuildScanLinks()

when:
def result = run(['help'], testGradleVersion.gradleVersion, [:])
def result = run(['help'], testGradle, [:])

then:
buildScanUrlIsNotCaptured(result)

where:
testGradleVersion << ALL_GRADLE_VERSIONS
testGradle << ALL_GRADLE_VERSIONS
}

@Requires({data.testGradleVersion.compatibleWithCurrentJvm})
@Requires({data.testGradle.compatibleWithCurrentJvm})
def "can capture build scan url with develocity injection"() {
given:
captureBuildScanLinks()

when:
def config = TestDevelocityInjection.createTestConfig(mockScansServer.address, testDvPluginVersion.version)
def result = run(['help'], testGradleVersion.gradleVersion, config.envVars)
def config = TestDevelocityInjection.createTestConfig(mockScansServer.address, testDvPlugin.version)
def result = run(['help'], testGradle, config.envVars)

then:
buildScanUrlIsCaptured(result)

where:
[testGradleVersion, testDvPluginVersion] << versionsToTestForPluginInjection
[testGradle, testDvPlugin] << versionsToTestForPluginInjection
}

@Requires({data.testGradleVersion.compatibleWithCurrentJvm})
@Requires({data.testGradle.compatibleWithCurrentJvm})
def "can capture build scan url without develocity injection"() {
given:
captureBuildScanLinks()
declareDvPluginApplication(testGradleVersion.gradleVersion, dvPlugin)
declareDvPluginApplication(testGradle, testDvPlugin)

when:
def config = new MinimalTestConfig()
def result = run(['help'], testGradleVersion.gradleVersion, config.envVars)
def result = run(['help'], testGradle, config.envVars)

then:
buildScanUrlIsCaptured(result)

where:
[testGradleVersion, dvPlugin] << getVersionsToTestForExistingDvPlugin()
[testGradle, testDvPlugin] << getVersionsToTestForExistingDvPlugin()
}


@Requires({data.testGradleVersion.compatibleWithCurrentJvm})
@Requires({data.testGradle.compatibleWithCurrentJvm})
def "can capture build scan url with config-cache enabled"() {
given:
captureBuildScanLinks()
declareDvPluginApplication(testGradleVersion.gradleVersion, dvPlugin)
declareDvPluginApplication(testGradle, testDvPlugin)

when:
def config = new MinimalTestConfig()
def result = run(['help', '--configuration-cache'], testGradleVersion.gradleVersion, config.envVars)
def result = run(['help', '--configuration-cache'], testGradle, config.envVars)

then:
buildScanUrlIsCaptured(result)

when:
result = run(['help', '--configuration-cache'], testGradleVersion.gradleVersion, config.envVars)
result = run(['help', '--configuration-cache'], testGradle, config.envVars)

then:
buildScanUrlIsCaptured(result)

where:
[testGradleVersion, dvPlugin] << getVersionsToTestForExistingDvPlugin(CONFIGURATION_CACHE_GRADLE_VERSIONS)
[testGradle, testDvPlugin] << getVersionsToTestForExistingDvPlugin(CONFIGURATION_CACHE_GRADLE_VERSIONS)
.findAll { gradleVersion, dvPlugin -> dvPlugin.isCompatibleWithConfigurationCache() }
}

Expand Down
Loading

0 comments on commit 0ccb8ab

Please sign in to comment.