11package io .quarkus .deployment .pkg .steps ;
22
3- import static io .quarkus .deployment .pkg .steps .AppCDSBuildStep .DOCKER_EXECUTABLE ;
3+ import static io .quarkus .deployment .pkg .steps .AppCDSBuildStep .CONTAINER_RUNTIME ;
44import static org .assertj .core .api .Assertions .assertThat ;
55
66import java .nio .file .Path ;
1111import org .junit .jupiter .api .condition .DisabledIfSystemProperty ;
1212
1313import io .quarkus .deployment .pkg .NativeConfig ;
14+ import io .quarkus .runtime .util .ContainerRuntimeUtil ;
1415
1516class NativeImageBuildContainerRunnerTest {
1617
1718 // This will default to false in the maven build and true in the IDE, so this will still run if invoked explicitly
1819 @ DisabledIfSystemProperty (named = "avoid-containers" , matches = "true" )
1920 @ Test
2021 void testBuilderImageBeingPickedUp () {
22+ if (CONTAINER_RUNTIME == ContainerRuntimeUtil .ContainerRuntime .UNAVAILABLE ) {
23+ throw new IllegalStateException ("No container runtime was found. "
24+ + "Make sure you have either Docker or Podman installed in your environment." );
25+ }
2126 NativeConfig nativeConfig = new NativeConfig ();
2227 nativeConfig .containerRuntime = Optional .empty ();
2328 boolean found ;
@@ -26,7 +31,8 @@ void testBuilderImageBeingPickedUp() {
2631
2732 nativeConfig .builderImage = "graalvm" ;
2833 localRunner = new NativeImageBuildLocalContainerRunner (nativeConfig , Path .of ("/tmp" ));
29- command = localRunner .buildCommand (DOCKER_EXECUTABLE , Collections .emptyList (), Collections .emptyList ());
34+ command = localRunner .buildCommand (CONTAINER_RUNTIME .getExecutableName (), Collections .emptyList (),
35+ Collections .emptyList ());
3036 found = false ;
3137 for (String part : command ) {
3238 if (part .contains ("ubi-quarkus-graalvmce-builder-image" )) {
@@ -38,7 +44,8 @@ void testBuilderImageBeingPickedUp() {
3844
3945 nativeConfig .builderImage = "mandrel" ;
4046 localRunner = new NativeImageBuildLocalContainerRunner (nativeConfig , Path .of ("/tmp" ));
41- command = localRunner .buildCommand (DOCKER_EXECUTABLE , Collections .emptyList (), Collections .emptyList ());
47+ command = localRunner .buildCommand (CONTAINER_RUNTIME .getExecutableName (), Collections .emptyList (),
48+ Collections .emptyList ());
4249 found = false ;
4350 for (String part : command ) {
4451 if (part .contains ("ubi-quarkus-mandrel-builder-image" )) {
@@ -50,7 +57,8 @@ void testBuilderImageBeingPickedUp() {
5057
5158 nativeConfig .builderImage = "RandomString" ;
5259 localRunner = new NativeImageBuildLocalContainerRunner (nativeConfig , Path .of ("/tmp" ));
53- command = localRunner .buildCommand (DOCKER_EXECUTABLE , Collections .emptyList (), Collections .emptyList ());
60+ command = localRunner .buildCommand (CONTAINER_RUNTIME .getExecutableName (), Collections .emptyList (),
61+ Collections .emptyList ());
5462 found = false ;
5563 for (String part : command ) {
5664 if (part .equals ("RandomString" )) {
0 commit comments