Skip to content

Commit

Permalink
Ignore buildpack deprecation warnings in Paketo system tests
Browse files Browse the repository at this point in the history
Fixes gh-29885
  • Loading branch information
scottfrederick committed Feb 23, 2022
1 parent acd1ba0 commit 59ffe28
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Expand Up @@ -80,6 +80,8 @@ public class GradleBuild {

private GradleVersion expectDeprecationWarnings;

private String[] expectedDeprecationMessages;

private boolean configurationCache = false;

private Map<String, String> scriptProperties = new HashMap<>();
Expand Down Expand Up @@ -152,6 +154,11 @@ public GradleBuild expectDeprecationWarningsWithAtLeastVersion(String gradleVers
return this;
}

public GradleBuild expectDeprecationMessages(String... messages) {
this.expectedDeprecationMessages = messages;
return this;
}

public GradleBuild configurationCache() {
this.configurationCache = true;
return this;
Expand All @@ -167,7 +174,13 @@ public BuildResult build(String... arguments) {
BuildResult result = prepareRunner(arguments).build();
if (this.expectDeprecationWarnings == null || (this.gradleVersion != null
&& this.expectDeprecationWarnings.compareTo(GradleVersion.version(this.gradleVersion)) > 0)) {
assertThat(result.getOutput()).doesNotContain("Deprecated").doesNotContain("deprecated");
String buildOutput = result.getOutput();
if (this.expectedDeprecationMessages != null) {
for (String message : this.expectedDeprecationMessages) {
buildOutput = buildOutput.replaceAll(message, "");
}
}
assertThat(buildOutput).doesNotContain("Deprecated").doesNotContain("deprecated");
}
return result;
}
Expand Down
Expand Up @@ -122,6 +122,7 @@ void executableJarAppBuiltTwiceWithCaching() throws Exception {
container.waitingFor(Wait.forHttp("/test")).start();
container.stop();
}
this.gradleBuild.expectDeprecationMessages("BOM table is deprecated in this buildpack api version");
result = buildImage(imageName);
assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
try (GenericContainer<?> container = new GenericContainer<>(imageName).withExposedPorts(8080)) {
Expand Down

0 comments on commit 59ffe28

Please sign in to comment.