use of org.gradle.testkit.runner.BuildResult in project spring-boot by spring-projects.
the class BootBuildImageIntegrationTests method buildsImageWithDefaultBuilder.
@TestTemplate
void buildsImageWithDefaultBuilder() throws IOException {
writeMainClass();
writeLongNameResource();
BuildResult result = this.gradleBuild.build("bootBuildImage", "--pullPolicy=IF_NOT_PRESENT");
String projectName = this.gradleBuild.getProjectDir().getName();
assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(result.getOutput()).contains("docker.io/library/" + projectName);
assertThat(result.getOutput()).contains("---> Test Info buildpack building");
assertThat(result.getOutput()).contains("env: BP_JVM_VERSION=8.*");
assertThat(result.getOutput()).contains("Network status: HTTP/2 200");
assertThat(result.getOutput()).contains("---> Test Info buildpack done");
removeImages(projectName);
}
use of org.gradle.testkit.runner.BuildResult in project spring-boot by spring-projects.
the class BootBuildImageIntegrationTests method buildsImageWithBuildpackFromDirectory.
@TestTemplate
@DisabledOnOs(OS.WINDOWS)
void buildsImageWithBuildpackFromDirectory() throws IOException {
writeMainClass();
writeLongNameResource();
writeBuildpackContent();
BuildResult result = this.gradleBuild.build("bootBuildImage", "--pullPolicy=IF_NOT_PRESENT");
String projectName = this.gradleBuild.getProjectDir().getName();
assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(result.getOutput()).contains("docker.io/library/" + projectName);
assertThat(result.getOutput()).contains("---> Hello World buildpack");
removeImages(projectName);
}
use of org.gradle.testkit.runner.BuildResult in project spring-boot by spring-projects.
the class BootBuildImageIntegrationTests method buildsImageWithWarPackagingAndJarConfiguration.
@TestTemplate
void buildsImageWithWarPackagingAndJarConfiguration() throws IOException {
writeMainClass();
writeLongNameResource();
BuildResult result = this.gradleBuild.build("bootBuildImage", "--pullPolicy=IF_NOT_PRESENT");
String projectName = this.gradleBuild.getProjectDir().getName();
assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(result.getOutput()).contains("docker.io/library/" + projectName);
assertThat(result.getOutput()).contains("---> Test Info buildpack building");
assertThat(result.getOutput()).contains("---> Test Info buildpack done");
File buildLibs = new File(this.gradleBuild.getProjectDir(), "build/libs");
assertThat(buildLibs.listFiles()).containsExactly(new File(buildLibs, this.gradleBuild.getProjectDir().getName() + ".war"));
removeImages(projectName);
}
use of org.gradle.testkit.runner.BuildResult in project spring-boot by spring-projects.
the class BootBuildImageIntegrationTests method buildsImageWithPullPolicy.
@TestTemplate
void buildsImageWithPullPolicy() throws IOException {
writeMainClass();
writeLongNameResource();
String projectName = this.gradleBuild.getProjectDir().getName();
BuildResult result = this.gradleBuild.build("bootBuildImage", "--pullPolicy=ALWAYS");
assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(result.getOutput()).contains("Pulled builder image").contains("Pulled run image");
result = this.gradleBuild.build("bootBuildImage", "--pullPolicy=IF_NOT_PRESENT");
assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(result.getOutput()).doesNotContain("Pulled builder image").doesNotContain("Pulled run image");
removeImages(projectName);
}
use of org.gradle.testkit.runner.BuildResult in project spring-boot by spring-projects.
the class BootBuildImageIntegrationTests method failsWhenCachesAreConfiguredTwice.
@TestTemplate
void failsWhenCachesAreConfiguredTwice() throws IOException {
writeMainClass();
writeLongNameResource();
BuildResult result = this.gradleBuild.buildAndFail("bootBuildImage");
assertThat(result.getOutput()).containsPattern("Each image building cache can be configured only once");
}
Aggregations