Polish "Add network option for image building"

See gh-27486
This commit is contained in:
Scott Frederick
2021-08-12 17:07:49 -05:00
parent 8e6d03b221
commit 2178c281e9
13 changed files with 145 additions and 23 deletions

View File

@@ -71,6 +71,7 @@ class BootBuildImageIntegrationTests {
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");
removeImage(projectName);
}
@@ -247,6 +248,20 @@ class BootBuildImageIntegrationTests {
removeImage(projectName);
}
@TestTemplate
void buildsImageWithNetworkModeNone() 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("Network status: curl failed");
assertThat(result.getOutput()).contains("---> Test Info buildpack done");
removeImage(projectName);
}
@TestTemplate
void failsWithBuilderError() throws IOException {
writeMainClass();

View File

@@ -0,0 +1,16 @@
plugins {
id 'java'
id 'org.springframework.boot' version '{version}'
}
if (project.hasProperty('applyWarPlugin')) {
apply plugin: 'war'
}
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
bootBuildImage {
builder = "projects.registry.vmware.com/springboot/spring-boot-cnb-builder:0.0.1"
network = "none"
}