use of org.gradle.testkit.runner.BuildResult in project spring-boot by spring-projects.
the class PackagingDocumentationTests method bootBuildImageWithBuildpacks.
@TestTemplate
void bootBuildImageWithBuildpacks() {
BuildResult result = this.gradleBuild.script("src/docs/gradle/packaging/boot-build-image-buildpacks").build("bootBuildImageBuildpacks");
assertThat(result.getOutput()).contains("file:///path/to/example-buildpack.tgz").contains("urn:cnb:builder:paketo-buildpacks/java");
}
use of org.gradle.testkit.runner.BuildResult in project spring-boot by spring-projects.
the class PackagingDocumentationTests method bootBuildImagePublish.
@TestTemplate
void bootBuildImagePublish() {
BuildResult result = this.gradleBuild.script("src/docs/gradle/packaging/boot-build-image-publish").build("bootBuildImagePublish");
assertThat(result.getOutput()).contains("true");
}
use of org.gradle.testkit.runner.BuildResult in project spring-boot by spring-projects.
the class PackagingDocumentationTests method bootBuildImageWithCustomProxySettings.
@TestTemplate
void bootBuildImageWithCustomProxySettings() {
BuildResult result = this.gradleBuild.script("src/docs/gradle/packaging/boot-build-image-env-proxy").build("bootBuildImageEnvironment");
assertThat(result.getOutput()).contains("HTTP_PROXY=http://proxy.example.com").contains("HTTPS_PROXY=https://proxy.example.com");
}
use of org.gradle.testkit.runner.BuildResult in project spring-boot by spring-projects.
the class PaketoBuilderTests method executableJarApp.
@Test
void executableJarApp() throws Exception {
writeMainClass();
String imageName = "paketo-integration/" + this.gradleBuild.getProjectDir().getName();
ImageReference imageReference = ImageReference.of(ImageName.of(imageName));
BuildResult result = buildImage(imageName);
assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
try (GenericContainer<?> container = new GenericContainer<>(imageName).withExposedPorts(8080)) {
container.waitingFor(Wait.forHttp("/test")).start();
ContainerConfig config = container.getContainerInfo().getConfig();
assertLabelsMatchManifestAttributes(config);
ImageAssertions.assertThat(config).buildMetadata((metadata) -> {
metadata.buildpacks().contains("paketo-buildpacks/ca-certificates", "paketo-buildpacks/bellsoft-liberica", "paketo-buildpacks/executable-jar", "paketo-buildpacks/dist-zip", "paketo-buildpacks/spring-boot");
metadata.processOfType("web").extracting("command", "args").containsExactly("java", Collections.singletonList("org.springframework.boot.loader.JarLauncher"));
metadata.processOfType("executable-jar").extracting("command", "args").containsExactly("java", Collections.singletonList("org.springframework.boot.loader.JarLauncher"));
});
assertImageHasSbomLayer(imageReference, config, "executable-jar");
assertImageLayersMatchLayersIndex(imageReference, config);
} finally {
removeImage(imageReference);
}
}
use of org.gradle.testkit.runner.BuildResult in project spring-boot by spring-projects.
the class PaketoBuilderTests method executableJarAppBuiltTwiceWithCaching.
@Test
void executableJarAppBuiltTwiceWithCaching() throws Exception {
writeMainClass();
String imageName = "paketo-integration/" + this.gradleBuild.getProjectDir().getName();
ImageReference imageReference = ImageReference.of(ImageName.of(imageName));
BuildResult result = buildImage(imageName);
assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
try (GenericContainer<?> container = new GenericContainer<>(imageName).withExposedPorts(8080)) {
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)) {
container.waitingFor(Wait.forHttp("/test")).start();
} finally {
removeImage(imageReference);
}
}
Aggregations