-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Introdcue 3.x and 4.x style of openshift manifests.
- Loading branch information
Showing
5 changed files
with
108 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
...bernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/OpenshiftV3Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package io.quarkus.it.kubernetes; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.entry; | ||
|
||
import java.io.IOException; | ||
import java.nio.file.Path; | ||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import org.assertj.core.api.AbstractObjectAssert; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.fabric8.kubernetes.api.model.HasMetadata; | ||
import io.fabric8.kubernetes.api.model.Service; | ||
import io.quarkus.test.ProdBuildResults; | ||
import io.quarkus.test.ProdModeTestResults; | ||
import io.quarkus.test.QuarkusProdModeTest; | ||
|
||
public class OpenshiftV3Test { | ||
|
||
@RegisterExtension | ||
static final QuarkusProdModeTest config = new QuarkusProdModeTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class).addClasses(GreetingResource.class)) | ||
.setApplicationName("openshift-v3") | ||
.setApplicationVersion("0.1-SNAPSHOT") | ||
.withConfigurationResource("openshift-v3.properties"); | ||
|
||
@ProdBuildResults | ||
private ProdModeTestResults prodModeTestResults; | ||
|
||
@Test | ||
public void assertGeneratedResources() throws IOException { | ||
Path kubernetesDir = prodModeTestResults.getBuildDir().resolve("kubernetes"); | ||
assertThat(kubernetesDir) | ||
.isDirectoryContaining(p -> p.getFileName().endsWith("openshift.json")) | ||
.isDirectoryContaining(p -> p.getFileName().endsWith("openshift.yml")) | ||
.satisfies(p -> assertThat(p.toFile().listFiles()).hasSize(2)); | ||
List<HasMetadata> openshiftList = DeserializationUtil | ||
.deserializeAsList(kubernetesDir.resolve("openshift.yml")); | ||
|
||
assertThat(openshiftList).filteredOn(h -> "DeploymentConfig".equals(h.getKind())).singleElement().satisfies(h -> { | ||
assertThat(h.getMetadata()).satisfies(m -> { | ||
assertThat(m.getName()).isEqualTo("openshift-v3"); | ||
assertThat(m.getLabels().get("app.openshift.io/runtime")).isEqualTo("quarkus"); | ||
assertThat(m.getLabels().get("app")).isEqualTo("openshift-v3"); | ||
assertThat(m.getNamespace()).isNull(); | ||
}); | ||
AbstractObjectAssert<?, ?> specAssert = assertThat(h).extracting("spec"); | ||
specAssert.extracting("replicas").isEqualTo(1); | ||
specAssert.extracting("triggers").isInstanceOfSatisfying(Collection.class, c -> { | ||
assertThat(c).isEmpty(); | ||
}); | ||
specAssert.extracting("selector").isInstanceOfSatisfying(Map.class, selectorsMap -> { | ||
assertThat(selectorsMap).containsOnly(entry("app.kubernetes.io/name", "openshift-v3"), | ||
entry("app.kubernetes.io/version", "0.1-SNAPSHOT")); | ||
}); | ||
}); | ||
|
||
assertThat(openshiftList).filteredOn(h -> "Service".equals(h.getKind())).singleElement().satisfies(h -> { | ||
assertThat(h).isInstanceOfSatisfying(Service.class, s -> { | ||
assertThat(s.getMetadata()).satisfies(m -> { | ||
assertThat(m.getNamespace()).isNull(); | ||
assertThat(m.getLabels().get("app")).isEqualTo("openshift-v3"); | ||
}); | ||
|
||
assertThat(s.getSpec()).satisfies(spec -> { | ||
assertThat(spec.getSelector()).containsOnly(entry("app.kubernetes.io/name", "openshift-v3"), | ||
entry("app.kubernetes.io/version", "0.1-SNAPSHOT")); | ||
}); | ||
}); | ||
}); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
integration-tests/kubernetes/quarkus-standard-way/src/test/resources/openshift-v3.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
quarkus.kubernetes.deployment-target=openshift | ||
quarkus.openshift.flavor=v3 |