Update system tests for Paketo Java buildpack 6.0.0

Paketo Java buildpack version 6.0.0 adds a buildpack and removes
support for the SBOM in the format that the system tests attempt
to verify.

Fixes gh-28823
pull/28902/head
Scott Frederick 3 years ago
parent 4bd6327cac
commit 3b12a5efe9

@ -24,9 +24,7 @@ import org.assertj.core.api.AbstractAssert;
import org.assertj.core.api.AbstractListAssert;
import org.assertj.core.api.AbstractObjectAssert;
import org.assertj.core.api.AbstractStringAssert;
import org.assertj.core.api.Assertions;
import org.assertj.core.api.AssertionsForClassTypes;
import org.assertj.core.api.InstanceOfAssertFactories;
import org.assertj.core.api.ListAssert;
import org.assertj.core.api.ObjectAssert;
@ -91,16 +89,6 @@ public class ContainerConfigAssert extends AbstractAssert<ContainerConfigAssert,
return this.actual.extractingJsonPathArrayValue("$.buildpacks[*].id");
}
public ListAssert<Object> bomDependencies() {
return this.actual
.extractingJsonPathArrayValue("$.bom[?(@.name=='dependencies')].metadata.dependencies[*].name");
}
public AbstractStringAssert<?> bomJavaVersion(String javaType) {
return this.actual.extractingJsonPathArrayValue("$.bom[?(@.name=='%s')].metadata.version", javaType)
.singleElement(Assertions.as(InstanceOfAssertFactories.STRING));
}
public AbstractObjectAssert<?, Object> processOfType(String type) {
return this.actual.extractingJsonPathArrayValue("$.processes[?(@.type=='%s')]", type).singleElement();
}

@ -21,6 +21,7 @@ import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
@ -79,13 +80,9 @@ class PaketoBuilderTests {
container.waitingFor(Wait.forHttp("/test")).start();
ContainerConfig config = container.getContainerInfo().getConfig();
assertLabelsMatchManifestAttributes(config);
ImageAssertions.assertThat(config).buildMetadata().buildpacks().containsExactly(
ImageAssertions.assertThat(config).buildMetadata().buildpacks().contains(
"paketo-buildpacks/ca-certificates", "paketo-buildpacks/bellsoft-liberica",
"paketo-buildpacks/executable-jar", "paketo-buildpacks/dist-zip", "paketo-buildpacks/spring-boot");
ImageAssertions.assertThat(config).buildMetadata().bomDependencies().contains("spring-beans", "spring-boot",
"spring-boot-autoconfigure", "spring-boot-jarmode-layertools", "spring-context", "spring-core",
"spring-web");
ImageAssertions.assertThat(config).buildMetadata().bomJavaVersion("jre").startsWith(javaMajorVersion());
ImageAssertions.assertThat(config).buildMetadata().processOfType("web").extracting("command", "args")
.containsExactly("java", Collections.singletonList("org.springframework.boot.loader.JarLauncher"));
ImageAssertions.assertThat(config).buildMetadata().processOfType("executable-jar")
@ -146,10 +143,9 @@ class PaketoBuilderTests {
try (GenericContainer<?> container = new GenericContainer<>(imageName).withExposedPorts(8080)) {
container.waitingFor(Wait.forHttp("/test")).start();
ContainerConfig config = container.getContainerInfo().getConfig();
ImageAssertions.assertThat(config).buildMetadata().buildpacks().containsExactly(
ImageAssertions.assertThat(config).buildMetadata().buildpacks().contains(
"paketo-buildpacks/ca-certificates", "paketo-buildpacks/bellsoft-liberica",
"paketo-buildpacks/dist-zip", "paketo-buildpacks/spring-boot");
ImageAssertions.assertThat(config).buildMetadata().bomJavaVersion("jre").startsWith(javaMajorVersion());
ImageAssertions.assertThat(config).buildMetadata().processOfType("web").extracting("command", "args")
.containsExactly("/workspace/" + projectName + "-boot/bin/" + projectName, Collections.emptyList());
ImageAssertions.assertThat(config).buildMetadata().processOfType("dist-zip").extracting("command", "args")
@ -175,10 +171,9 @@ class PaketoBuilderTests {
try (GenericContainer<?> container = new GenericContainer<>(imageName).withExposedPorts(8080)) {
container.waitingFor(Wait.forHttp("/test")).start();
ContainerConfig config = container.getContainerInfo().getConfig();
ImageAssertions.assertThat(config).buildMetadata().buildpacks().containsExactly(
ImageAssertions.assertThat(config).buildMetadata().buildpacks().contains(
"paketo-buildpacks/ca-certificates", "paketo-buildpacks/bellsoft-liberica",
"paketo-buildpacks/dist-zip", "paketo-buildpacks/spring-boot");
ImageAssertions.assertThat(config).buildMetadata().bomJavaVersion("jre").startsWith(javaMajorVersion());
ImageAssertions.assertThat(config).buildMetadata().processOfType("web").extracting("command", "args")
.containsExactly("/workspace/" + projectName + "/bin/" + projectName, Collections.emptyList());
ImageAssertions.assertThat(config).buildMetadata().processOfType("dist-zip").extracting("command", "args")
@ -208,13 +203,9 @@ class PaketoBuilderTests {
container.waitingFor(Wait.forHttp("/test")).start();
ContainerConfig config = container.getContainerInfo().getConfig();
assertLabelsMatchManifestAttributes(config);
ImageAssertions.assertThat(config).buildMetadata().buildpacks().containsExactly(
ImageAssertions.assertThat(config).buildMetadata().buildpacks().contains(
"paketo-buildpacks/ca-certificates", "paketo-buildpacks/bellsoft-liberica",
"paketo-buildpacks/executable-jar", "paketo-buildpacks/dist-zip", "paketo-buildpacks/spring-boot");
ImageAssertions.assertThat(config).buildMetadata().bomDependencies().contains("spring-beans", "spring-boot",
"spring-boot-autoconfigure", "spring-boot-jarmode-layertools", "spring-context", "spring-core",
"spring-web");
ImageAssertions.assertThat(config).buildMetadata().bomJavaVersion("jre").startsWith(javaMajorVersion());
ImageAssertions.assertThat(config).buildMetadata().processOfType("web").extracting("command", "args")
.containsExactly("java", Collections.singletonList("org.springframework.boot.loader.WarLauncher"));
ImageAssertions.assertThat(config).buildMetadata().processOfType("executable-jar")
@ -238,14 +229,13 @@ class PaketoBuilderTests {
try (GenericContainer<?> container = new GenericContainer<>(imageName).withExposedPorts(8080)) {
container.waitingFor(Wait.forHttp("/test")).start();
ContainerConfig config = container.getContainerInfo().getConfig();
ImageAssertions.assertThat(config).buildMetadata().buildpacks().containsExactly(
ImageAssertions.assertThat(config).buildMetadata().buildpacks().contains(
"paketo-buildpacks/ca-certificates", "paketo-buildpacks/bellsoft-liberica",
"paketo-buildpacks/apache-tomcat", "paketo-buildpacks/dist-zip", "paketo-buildpacks/spring-boot");
ImageAssertions.assertThat(config).buildMetadata().bomJavaVersion("jre").startsWith(javaMajorVersion());
ImageAssertions.assertThat(config).buildMetadata().processOfType("web").extracting("command", "args")
.containsExactly("catalina.sh", Collections.singletonList("run"));
.containsExactly("bash", Arrays.asList("catalina.sh", "run"));
ImageAssertions.assertThat(config).buildMetadata().processOfType("tomcat").extracting("command", "args")
.containsExactly("catalina.sh", Collections.singletonList("run"));
.containsExactly("bash", Arrays.asList("catalina.sh", "run"));
DigestCapturingCondition digests = new DigestCapturingCondition();
ImageAssertions.assertThat(config).lifecycleMetadata().appLayerShas().haveExactly(1, digests);
ImageAssertions.assertThat(imageReference).hasLayer(digests.getDigest(0)).entries()

Loading…
Cancel
Save