Skip to content

Commit

Permalink
Assert init-script application does not log errors
Browse files Browse the repository at this point in the history
Several "successful" CCUD scenarios were logging errors from build scan publishing.
We now check that no exceptions are logged when applying the init-script.
  • Loading branch information
bigdaz committed Nov 8, 2024
1 parent 4778149 commit 392b4c3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/test/groovy/com/gradle/BaseInitScriptTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ abstract class BaseInitScriptTest extends Specification {
dvPlugin(GRADLE_ENTERPRISE, '3.17', true),
dvPlugin(GRADLE_ENTERPRISE, '3.16.2'), // Last version before DV
dvPlugin(GRADLE_ENTERPRISE, '3.11.1'), // Oldest version compatible with CCUD 2.0.2
dvPlugin(GRADLE_ENTERPRISE, '3.6.4'), // Oldest version supported for injection
dvPlugin(GRADLE_ENTERPRISE, '3.3.4'), // Introduced background build-scan upload
dvPlugin(GRADLE_ENTERPRISE, '3.2.1'), // Introduced 'gradleEnterprise.server' element
dvPlugin(GRADLE_ENTERPRISE, '3.0'), // Earliest version of `com.gradle.enterprise` plugin
Expand Down Expand Up @@ -213,6 +214,7 @@ abstract class BaseInitScriptTest extends Specification {
BuildResult run(List<String> args, TestGradleVersion testGradle, Map<String, String> envVars = [:]) {
def result = createRunner(args, testGradle.gradleVersion, envVars).build()
assertNoDeprecationWarning(result)
assertNoStackTraces(result)
}

GradleRunner createRunner(List<String> args, GradleVersion gradleVersion = GradleVersion.current(), Map<String, String> envVars = [:]) {
Expand Down Expand Up @@ -275,6 +277,11 @@ abstract class BaseInitScriptTest extends Specification {
return result
}

BuildResult assertNoStackTraces(BuildResult result) {
assert !result.output.contains("Exception:")
return result
}

static final class TestGradleVersion {
final GradleVersion gradleVersion
private final Integer jdkMin
Expand Down Expand Up @@ -399,11 +406,8 @@ abstract class BaseInitScriptTest extends Specification {
if (pluginVersionAtLeast('3.11')) {
return CCUD_PLUGIN_VERSION
}
if (pluginVersionAtLeast('3.2')) {
return '1.13'
}
if (pluginId == BUILD_SCAN && version == '1.16') {
return '1.13'
return CCUD_PLUGIN_VERSION
}
// No known compatible CCUD for older plugin versions
return null
Expand Down

0 comments on commit 392b4c3

Please sign in to comment.