diff --git a/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-build-and-deploy/invoker.properties b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-build-and-deploy/invoker.properties new file mode 100644 index 00000000000000..30fa8f402eb680 --- /dev/null +++ b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-build-and-deploy/invoker.properties @@ -0,0 +1,4 @@ +# invoker.goals=clean package -Dquarkus.container.build=true -Dquarkus.package.type=native +invoker.goals=clean package -Dquarkus.kubernetes.deploy=true +# expect a failure since there is no Kubernetes cluster to deploy to +invoker.buildResult = failure diff --git a/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-build-and-deploy/pom.xml b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-build-and-deploy/pom.xml new file mode 100644 index 00000000000000..8376d3f76ea64b --- /dev/null +++ b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-build-and-deploy/pom.xml @@ -0,0 +1,124 @@ + + + 4.0.0 + org.acme + openshift-docker-build-and-deploy + 0.1-SNAPSHOT + + UTF-8 + 3.0.0-M5 + 1.8 + UTF-8 + 1.8 + + + + + io.quarkus + quarkus-bom + @project.version@ + pom + import + + + + + + io.quarkus + quarkus-resteasy + + + io.quarkus + quarkus-openshift + + + io.quarkus + quarkus-container-image-docker + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + + + + io.quarkus + quarkus-maven-plugin + @project.version@ + + + + build + + + + + + maven-surefire-plugin + ${surefire-plugin.version} + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + native + + + native + + + + + + io.quarkus + quarkus-maven-plugin + @project.version@ + + + + native-image + + + true + + + + + + maven-failsafe-plugin + ${surefire-plugin.version} + + + + integration-test + verify + + + + ${project.build.directory}/${project.build.finalName}-runner + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + + + diff --git a/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-build-and-deploy/src/main/docker/Dockerfile.jvm b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-build-and-deploy/src/main/docker/Dockerfile.jvm new file mode 100644 index 00000000000000..fa97e4b1172001 --- /dev/null +++ b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-build-and-deploy/src/main/docker/Dockerfile.jvm @@ -0,0 +1,22 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the docker image run: +# +# mvn package +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/getting-started-jvm . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/getting-started-jvm +# +### +FROM fabric8/java-alpine-openjdk8-jre +ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV AB_ENABLED=jmx_exporter +COPY target/lib/* /deployments/lib/ +COPY target/*-runner.jar /deployments/app.jar +ENTRYPOINT [ "/deployments/run-java.sh" ] \ No newline at end of file diff --git a/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-build-and-deploy/src/main/java/org/acme/Hello.java b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-build-and-deploy/src/main/java/org/acme/Hello.java new file mode 100644 index 00000000000000..ad80766a17747a --- /dev/null +++ b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-build-and-deploy/src/main/java/org/acme/Hello.java @@ -0,0 +1,16 @@ +package org.acme; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +@Path("/hello") +public class Hello { + + @GET + @Produces(MediaType.TEXT_PLAIN) + public String hello() { + return "hello"; + } +} \ No newline at end of file diff --git a/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-build-and-deploy/src/main/resources/application.properties b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-build-and-deploy/src/main/resources/application.properties new file mode 100644 index 00000000000000..7db3b55b441e49 --- /dev/null +++ b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-build-and-deploy/src/main/resources/application.properties @@ -0,0 +1,7 @@ +# Configuration file +# key = value +quarkus.container-image.builder=docker +quarkus.container-image.registry=docker.io +quarkus.container-image.group=test +quarkus.kubernetes.deployment-target=openshift +quarkus.kubernetes-client.trust-certs=true diff --git a/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-build-and-deploy/verify.groovy b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-build-and-deploy/verify.groovy new file mode 100644 index 00000000000000..ed888136013925 --- /dev/null +++ b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-build-and-deploy/verify.groovy @@ -0,0 +1,19 @@ +import io.dekorate.utils.Serialization +import io.dekorate.deps.kubernetes.api.model.KubernetesList +import io.dekorate.deps.kubernetes.api.model.apps.Deployment; +import io.dekorate.deps.openshift.api.model.* + +//Check that file exits +String base = basedir +File openshiftYml = new File(base, "target/kubernetes/openshift.yml") +assert openshiftYml.exists() +openshiftYml.withInputStream { stream -> + //Check that its parse-able + KubernetesList list = Serialization.unmarshalAsList(stream) + assert list != null + + ImageStream imageStream = list.items.find{r -> r.kind == "ImageStream"} + + assert imageStream != null + assert imageStream.spec.dockerImageRepository == "docker.io/test/openshift-docker-build-and-deploy" +} diff --git a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/BasicOpenshiftTest.java b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/BasicOpenshiftTest.java index a0e7b410e3581e..42c229ac4143e4 100644 --- a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/BasicOpenshiftTest.java +++ b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/BasicOpenshiftTest.java @@ -1,7 +1,6 @@ package io.quarkus.it.kubernetes; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; import java.io.IOException; import java.nio.file.Path; @@ -13,7 +12,6 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.fabric8.kubernetes.api.model.HasMetadata; -import io.fabric8.kubernetes.api.model.PodSpec; import io.fabric8.kubernetes.api.model.Service; import io.quarkus.test.ProdBuildResults; import io.quarkus.test.ProdModeTestResults; @@ -48,14 +46,6 @@ public void assertGeneratedResources() throws IOException { assertThat(m.getNamespace()).isNull(); }); assertThat(h).extracting("spec").extracting("replicas").isEqualTo(1); - assertThat(h).extracting("spec").extracting("template").extracting("spec").isInstanceOfSatisfying(PodSpec.class, - podSpec -> { - assertThat(podSpec.getContainers()).hasOnlyOneElementSatisfying(container -> { - assertThat(container.getEnv()).extracting("name", "value") - .contains(tuple("JAVA_APP_JAR", - "/deployments/basic-openshift-runner.jar")); - }); - }); }); assertThat(openshiftList).filteredOn(h -> "Service".equals(h.getKind())).hasOnlyOneElementSatisfying(h -> {