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 b53d86f commit ede45fc
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/test/groovy/com/gradle/BaseInitScriptTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,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 +276,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,10 +405,10 @@ 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 CCUD_PLUGIN_VERSION
}
if (pluginVersionAtLeast('3.6')) {
return '1.13'
}
// No known compatible CCUD for older plugin versions
Expand Down

0 comments on commit ede45fc

Please sign in to comment.