mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Update Paketo tests for Platform API 0.10
When CNB Platform API 0.10 is used, buildpacks will set the process command as a list of strings instead of a single string. See gh-32949
This commit is contained in:
parent
0bdf7e8af7
commit
b97324493c
@ -100,8 +100,11 @@ public class ContainerConfigAssert extends AbstractAssert<ContainerConfigAssert,
|
||||
return this.actual.extractingJsonPathArrayValue("$.buildpacks[*].id");
|
||||
}
|
||||
|
||||
public AbstractObjectAssert<?, Object> processOfType(String type) {
|
||||
return this.actual.extractingJsonPathArrayValue("$.processes[?(@.type=='%s')]", type).singleElement();
|
||||
@SuppressWarnings("unchecked")
|
||||
public AbstractListAssert<?, List<? extends String>, String, ObjectAssert<String>> processOfType(String type) {
|
||||
return this.actual.extractingJsonPathArrayValue("$.processes[?(@.type=='%s')]", type).singleElement()
|
||||
.extracting("command", "args").flatExtracting((list) -> (List<String>) list);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ 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;
|
||||
@ -92,10 +91,9 @@ class PaketoBuilderTests {
|
||||
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"));
|
||||
metadata.processOfType("web").containsExactly("java", "org.springframework.boot.loader.JarLauncher");
|
||||
metadata.processOfType("executable-jar").containsExactly("java",
|
||||
"org.springframework.boot.loader.JarLauncher");
|
||||
});
|
||||
assertImageHasJvmSbomLayer(imageReference, config);
|
||||
assertImageHasDependenciesSbomLayer(imageReference, config, "executable-jar");
|
||||
@ -163,10 +161,9 @@ class PaketoBuilderTests {
|
||||
metadata.buildpacks().contains("paketo-buildpacks/ca-certificates",
|
||||
"paketo-buildpacks/bellsoft-liberica", "paketo-buildpacks/dist-zip",
|
||||
"paketo-buildpacks/spring-boot");
|
||||
metadata.processOfType("web").extracting("command", "args").containsExactly(
|
||||
"/workspace/" + projectName + "-boot/bin/" + projectName, Collections.emptyList());
|
||||
metadata.processOfType("dist-zip").extracting("command", "args").containsExactly(
|
||||
"/workspace/" + projectName + "-boot/bin/" + projectName, Collections.emptyList());
|
||||
String launcher = "/workspace/" + projectName + "-boot/bin/" + projectName;
|
||||
metadata.processOfType("web").containsExactly(launcher);
|
||||
metadata.processOfType("dist-zip").containsExactly(launcher);
|
||||
});
|
||||
assertImageHasJvmSbomLayer(imageReference, config);
|
||||
assertImageHasDependenciesSbomLayer(imageReference, config, "dist-zip");
|
||||
@ -198,10 +195,9 @@ class PaketoBuilderTests {
|
||||
metadata.buildpacks().contains("paketo-buildpacks/ca-certificates",
|
||||
"paketo-buildpacks/bellsoft-liberica", "paketo-buildpacks/dist-zip",
|
||||
"paketo-buildpacks/spring-boot");
|
||||
metadata.processOfType("web").extracting("command", "args")
|
||||
.containsExactly("/workspace/" + projectName + "/bin/" + projectName, Collections.emptyList());
|
||||
metadata.processOfType("dist-zip").extracting("command", "args")
|
||||
.containsExactly("/workspace/" + projectName + "/bin/" + projectName, Collections.emptyList());
|
||||
String launcher = "/workspace/" + projectName + "/bin/" + projectName;
|
||||
metadata.processOfType("web").containsExactly(launcher);
|
||||
metadata.processOfType("dist-zip").containsExactly(launcher);
|
||||
});
|
||||
assertImageHasJvmSbomLayer(imageReference, config);
|
||||
assertImageHasDependenciesSbomLayer(imageReference, config, "dist-zip");
|
||||
@ -236,10 +232,9 @@ class PaketoBuilderTests {
|
||||
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.WarLauncher"));
|
||||
metadata.processOfType("executable-jar").extracting("command", "args").containsExactly("java",
|
||||
Collections.singletonList("org.springframework.boot.loader.WarLauncher"));
|
||||
metadata.processOfType("web").containsExactly("java", "org.springframework.boot.loader.WarLauncher");
|
||||
metadata.processOfType("executable-jar").containsExactly("java",
|
||||
"org.springframework.boot.loader.WarLauncher");
|
||||
});
|
||||
assertImageHasJvmSbomLayer(imageReference, config);
|
||||
assertImageHasDependenciesSbomLayer(imageReference, config, "executable-jar");
|
||||
@ -266,10 +261,8 @@ class PaketoBuilderTests {
|
||||
metadata.buildpacks().contains("paketo-buildpacks/ca-certificates",
|
||||
"paketo-buildpacks/bellsoft-liberica", "paketo-buildpacks/apache-tomcat",
|
||||
"paketo-buildpacks/dist-zip", "paketo-buildpacks/spring-boot");
|
||||
metadata.processOfType("web").extracting("command", "args").containsExactly("bash",
|
||||
Arrays.asList("catalina.sh", "run"));
|
||||
metadata.processOfType("tomcat").extracting("command", "args").containsExactly("bash",
|
||||
Arrays.asList("catalina.sh", "run"));
|
||||
metadata.processOfType("web").containsExactly("bash", "catalina.sh", "run");
|
||||
metadata.processOfType("tomcat").containsExactly("bash", "catalina.sh", "run");
|
||||
});
|
||||
assertImageHasJvmSbomLayer(imageReference, config);
|
||||
assertImageHasDependenciesSbomLayer(imageReference, config, "apache-tomcat");
|
||||
@ -306,9 +299,10 @@ class PaketoBuilderTests {
|
||||
metadata.buildpacks().contains("paketo-buildpacks/ca-certificates",
|
||||
"paketo-buildpacks/bellsoft-liberica", "paketo-buildpacks/executable-jar",
|
||||
"paketo-buildpacks/spring-boot", "paketo-buildpacks/native-image");
|
||||
metadata.processOfType("web").extracting("command").isEqualTo("/workspace/example.ExampleApplication");
|
||||
metadata.processOfType("web").extracting("command")
|
||||
.isEqualTo(Collections.singletonList("/workspace/example.ExampleApplication"));
|
||||
metadata.processOfType("native-image").extracting("command")
|
||||
.isEqualTo("/workspace/example.ExampleApplication");
|
||||
.isEqualTo(Collections.singletonList("/workspace/example.ExampleApplication"));
|
||||
});
|
||||
assertImageHasDependenciesSbomLayer(imageReference, config, "native-image");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user