Search in sources :

Example 1 with Version

use of io.quarkus.builder.Version in project quarkus by quarkusio.

the class KubernetesWithQuarkusAppNameTest method assertGeneratedResources.

@Test
public void assertGeneratedResources() throws IOException {
    Path kubernetesDir = prodModeTestResults.getBuildDir().resolve("kubernetes");
    assertThat(kubernetesDir).isDirectoryContaining(p -> p.getFileName().endsWith("kubernetes.json")).isDirectoryContaining(p -> p.getFileName().endsWith("kubernetes.yml"));
    List<HasMetadata> kubernetesList = DeserializationUtil.deserializeAsList(kubernetesDir.resolve("kubernetes.yml"));
    assertThat(kubernetesList.get(0)).isInstanceOfSatisfying(Deployment.class, d -> {
        assertThat(d.getMetadata()).satisfies(m -> {
            assertThat(m.getName()).isEqualTo("foo");
            assertThat(m.getLabels()).contains(entry("app.kubernetes.io/name", "foo"), entry("app.kubernetes.io/version", "1.0-kube"));
        });
    });
    List<HasMetadata> openshiftList = DeserializationUtil.deserializeAsList(kubernetesDir.resolve("openshift.yml"));
    assertThat(openshiftList).allSatisfy(h -> {
        assertThat(h.getMetadata().getName()).isIn("ofoo", "foo", "openjdk-11");
        assertThat(h.getMetadata().getLabels()).contains(entry("app.kubernetes.io/name", "ofoo"), entry("app.kubernetes.io/version", "1.0-openshift"));
    });
}
Also used : Path(java.nio.file.Path) Arrays(java.util.Arrays) AppArtifact(io.quarkus.bootstrap.model.AppArtifact) QuarkusProdModeTest(io.quarkus.test.QuarkusProdModeTest) Version(io.quarkus.builder.Version) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) IOException(java.io.IOException) Assertions.entry(org.assertj.core.api.Assertions.entry) HasMetadata(io.fabric8.kubernetes.api.model.HasMetadata) Test(org.junit.jupiter.api.Test) List(java.util.List) RegisterExtension(org.junit.jupiter.api.extension.RegisterExtension) ProdBuildResults(io.quarkus.test.ProdBuildResults) ProdModeTestResults(io.quarkus.test.ProdModeTestResults) Path(java.nio.file.Path) Deployment(io.fabric8.kubernetes.api.model.apps.Deployment) HasMetadata(io.fabric8.kubernetes.api.model.HasMetadata) QuarkusProdModeTest(io.quarkus.test.QuarkusProdModeTest) Test(org.junit.jupiter.api.Test)

Aggregations

HasMetadata (io.fabric8.kubernetes.api.model.HasMetadata)1 Deployment (io.fabric8.kubernetes.api.model.apps.Deployment)1 AppArtifact (io.quarkus.bootstrap.model.AppArtifact)1 Version (io.quarkus.builder.Version)1 ProdBuildResults (io.quarkus.test.ProdBuildResults)1 ProdModeTestResults (io.quarkus.test.ProdModeTestResults)1 QuarkusProdModeTest (io.quarkus.test.QuarkusProdModeTest)1 IOException (java.io.IOException)1 Path (java.nio.file.Path)1 Arrays (java.util.Arrays)1 List (java.util.List)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Assertions.entry (org.assertj.core.api.Assertions.entry)1 Test (org.junit.jupiter.api.Test)1 RegisterExtension (org.junit.jupiter.api.extension.RegisterExtension)1