mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +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");
|
return this.actual.extractingJsonPathArrayValue("$.buildpacks[*].id");
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbstractObjectAssert<?, Object> processOfType(String type) {
|
@SuppressWarnings("unchecked")
|
||||||
return this.actual.extractingJsonPathArrayValue("$.processes[?(@.type=='%s')]", type).singleElement();
|
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.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
@ -92,10 +91,9 @@ class PaketoBuilderTests {
|
|||||||
metadata.buildpacks().contains("paketo-buildpacks/ca-certificates",
|
metadata.buildpacks().contains("paketo-buildpacks/ca-certificates",
|
||||||
"paketo-buildpacks/bellsoft-liberica", "paketo-buildpacks/executable-jar",
|
"paketo-buildpacks/bellsoft-liberica", "paketo-buildpacks/executable-jar",
|
||||||
"paketo-buildpacks/dist-zip", "paketo-buildpacks/spring-boot");
|
"paketo-buildpacks/dist-zip", "paketo-buildpacks/spring-boot");
|
||||||
metadata.processOfType("web").extracting("command", "args").containsExactly("java",
|
metadata.processOfType("web").containsExactly("java", "org.springframework.boot.loader.JarLauncher");
|
||||||
Collections.singletonList("org.springframework.boot.loader.JarLauncher"));
|
metadata.processOfType("executable-jar").containsExactly("java",
|
||||||
metadata.processOfType("executable-jar").extracting("command", "args").containsExactly("java",
|
"org.springframework.boot.loader.JarLauncher");
|
||||||
Collections.singletonList("org.springframework.boot.loader.JarLauncher"));
|
|
||||||
});
|
});
|
||||||
assertImageHasJvmSbomLayer(imageReference, config);
|
assertImageHasJvmSbomLayer(imageReference, config);
|
||||||
assertImageHasDependenciesSbomLayer(imageReference, config, "executable-jar");
|
assertImageHasDependenciesSbomLayer(imageReference, config, "executable-jar");
|
||||||
@ -163,10 +161,9 @@ class PaketoBuilderTests {
|
|||||||
metadata.buildpacks().contains("paketo-buildpacks/ca-certificates",
|
metadata.buildpacks().contains("paketo-buildpacks/ca-certificates",
|
||||||
"paketo-buildpacks/bellsoft-liberica", "paketo-buildpacks/dist-zip",
|
"paketo-buildpacks/bellsoft-liberica", "paketo-buildpacks/dist-zip",
|
||||||
"paketo-buildpacks/spring-boot");
|
"paketo-buildpacks/spring-boot");
|
||||||
metadata.processOfType("web").extracting("command", "args").containsExactly(
|
String launcher = "/workspace/" + projectName + "-boot/bin/" + projectName;
|
||||||
"/workspace/" + projectName + "-boot/bin/" + projectName, Collections.emptyList());
|
metadata.processOfType("web").containsExactly(launcher);
|
||||||
metadata.processOfType("dist-zip").extracting("command", "args").containsExactly(
|
metadata.processOfType("dist-zip").containsExactly(launcher);
|
||||||
"/workspace/" + projectName + "-boot/bin/" + projectName, Collections.emptyList());
|
|
||||||
});
|
});
|
||||||
assertImageHasJvmSbomLayer(imageReference, config);
|
assertImageHasJvmSbomLayer(imageReference, config);
|
||||||
assertImageHasDependenciesSbomLayer(imageReference, config, "dist-zip");
|
assertImageHasDependenciesSbomLayer(imageReference, config, "dist-zip");
|
||||||
@ -198,10 +195,9 @@ class PaketoBuilderTests {
|
|||||||
metadata.buildpacks().contains("paketo-buildpacks/ca-certificates",
|
metadata.buildpacks().contains("paketo-buildpacks/ca-certificates",
|
||||||
"paketo-buildpacks/bellsoft-liberica", "paketo-buildpacks/dist-zip",
|
"paketo-buildpacks/bellsoft-liberica", "paketo-buildpacks/dist-zip",
|
||||||
"paketo-buildpacks/spring-boot");
|
"paketo-buildpacks/spring-boot");
|
||||||
metadata.processOfType("web").extracting("command", "args")
|
String launcher = "/workspace/" + projectName + "/bin/" + projectName;
|
||||||
.containsExactly("/workspace/" + projectName + "/bin/" + projectName, Collections.emptyList());
|
metadata.processOfType("web").containsExactly(launcher);
|
||||||
metadata.processOfType("dist-zip").extracting("command", "args")
|
metadata.processOfType("dist-zip").containsExactly(launcher);
|
||||||
.containsExactly("/workspace/" + projectName + "/bin/" + projectName, Collections.emptyList());
|
|
||||||
});
|
});
|
||||||
assertImageHasJvmSbomLayer(imageReference, config);
|
assertImageHasJvmSbomLayer(imageReference, config);
|
||||||
assertImageHasDependenciesSbomLayer(imageReference, config, "dist-zip");
|
assertImageHasDependenciesSbomLayer(imageReference, config, "dist-zip");
|
||||||
@ -236,10 +232,9 @@ class PaketoBuilderTests {
|
|||||||
metadata.buildpacks().contains("paketo-buildpacks/ca-certificates",
|
metadata.buildpacks().contains("paketo-buildpacks/ca-certificates",
|
||||||
"paketo-buildpacks/bellsoft-liberica", "paketo-buildpacks/executable-jar",
|
"paketo-buildpacks/bellsoft-liberica", "paketo-buildpacks/executable-jar",
|
||||||
"paketo-buildpacks/dist-zip", "paketo-buildpacks/spring-boot");
|
"paketo-buildpacks/dist-zip", "paketo-buildpacks/spring-boot");
|
||||||
metadata.processOfType("web").extracting("command", "args").containsExactly("java",
|
metadata.processOfType("web").containsExactly("java", "org.springframework.boot.loader.WarLauncher");
|
||||||
Collections.singletonList("org.springframework.boot.loader.WarLauncher"));
|
metadata.processOfType("executable-jar").containsExactly("java",
|
||||||
metadata.processOfType("executable-jar").extracting("command", "args").containsExactly("java",
|
"org.springframework.boot.loader.WarLauncher");
|
||||||
Collections.singletonList("org.springframework.boot.loader.WarLauncher"));
|
|
||||||
});
|
});
|
||||||
assertImageHasJvmSbomLayer(imageReference, config);
|
assertImageHasJvmSbomLayer(imageReference, config);
|
||||||
assertImageHasDependenciesSbomLayer(imageReference, config, "executable-jar");
|
assertImageHasDependenciesSbomLayer(imageReference, config, "executable-jar");
|
||||||
@ -266,10 +261,8 @@ class PaketoBuilderTests {
|
|||||||
metadata.buildpacks().contains("paketo-buildpacks/ca-certificates",
|
metadata.buildpacks().contains("paketo-buildpacks/ca-certificates",
|
||||||
"paketo-buildpacks/bellsoft-liberica", "paketo-buildpacks/apache-tomcat",
|
"paketo-buildpacks/bellsoft-liberica", "paketo-buildpacks/apache-tomcat",
|
||||||
"paketo-buildpacks/dist-zip", "paketo-buildpacks/spring-boot");
|
"paketo-buildpacks/dist-zip", "paketo-buildpacks/spring-boot");
|
||||||
metadata.processOfType("web").extracting("command", "args").containsExactly("bash",
|
metadata.processOfType("web").containsExactly("bash", "catalina.sh", "run");
|
||||||
Arrays.asList("catalina.sh", "run"));
|
metadata.processOfType("tomcat").containsExactly("bash", "catalina.sh", "run");
|
||||||
metadata.processOfType("tomcat").extracting("command", "args").containsExactly("bash",
|
|
||||||
Arrays.asList("catalina.sh", "run"));
|
|
||||||
});
|
});
|
||||||
assertImageHasJvmSbomLayer(imageReference, config);
|
assertImageHasJvmSbomLayer(imageReference, config);
|
||||||
assertImageHasDependenciesSbomLayer(imageReference, config, "apache-tomcat");
|
assertImageHasDependenciesSbomLayer(imageReference, config, "apache-tomcat");
|
||||||
@ -306,9 +299,10 @@ class PaketoBuilderTests {
|
|||||||
metadata.buildpacks().contains("paketo-buildpacks/ca-certificates",
|
metadata.buildpacks().contains("paketo-buildpacks/ca-certificates",
|
||||||
"paketo-buildpacks/bellsoft-liberica", "paketo-buildpacks/executable-jar",
|
"paketo-buildpacks/bellsoft-liberica", "paketo-buildpacks/executable-jar",
|
||||||
"paketo-buildpacks/spring-boot", "paketo-buildpacks/native-image");
|
"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")
|
metadata.processOfType("native-image").extracting("command")
|
||||||
.isEqualTo("/workspace/example.ExampleApplication");
|
.isEqualTo(Collections.singletonList("/workspace/example.ExampleApplication"));
|
||||||
});
|
});
|
||||||
assertImageHasDependenciesSbomLayer(imageReference, config, "native-image");
|
assertImageHasDependenciesSbomLayer(imageReference, config, "native-image");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user