-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[issue 80] - Adding WildFly Jakarta EE 8/EAP 7.z template based provi…
…sioner
- Loading branch information
Showing
12 changed files
with
563 additions
and
8 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
4 changes: 2 additions & 2 deletions
4
...ava/org/jboss/intersmash/testsuite/junit5/categories/NotForCommunityExecutionProfile.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
94 changes: 94 additions & 0 deletions
94
...a/org/jboss/intersmash/testsuite/provision/openshift/Eap7TemplateProvisionerTestCase.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,94 @@ | ||
package org.jboss.intersmash.testsuite.provision.openshift; | ||
|
||
import java.util.Optional; | ||
|
||
import org.assertj.core.api.Assertions; | ||
import org.assertj.core.api.SoftAssertions; | ||
import org.jboss.intersmash.testsuite.junit5.categories.NotForCommunityExecutionProfile; | ||
import org.jboss.intersmash.tools.application.openshift.Eap7TemplateOpenShiftApplication; | ||
import org.jboss.intersmash.tools.provision.openshift.Eap7TemplateOpenShiftProvisioner; | ||
import org.junit.jupiter.api.AfterAll; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import cz.xtf.core.openshift.OpenShift; | ||
import cz.xtf.core.openshift.OpenShifts; | ||
import cz.xtf.core.openshift.PodShell; | ||
import cz.xtf.core.openshift.PodShellOutput; | ||
import cz.xtf.junit5.annotations.CleanBeforeAll; | ||
import io.fabric8.openshift.api.model.BuildConfig; | ||
import io.fabric8.openshift.api.model.GitBuildSource; | ||
|
||
@CleanBeforeAll | ||
@NotForCommunityExecutionProfile | ||
public class Eap7TemplateProvisionerTestCase { | ||
private static final OpenShift openShift = OpenShifts.master(); | ||
private static final Eap7TemplateOpenShiftApplication application = OpenShiftProvisionerTestBase | ||
.getEap7OpenShiftTemplateApplication(); | ||
private static final Eap7TemplateOpenShiftProvisioner provisioner = new Eap7TemplateOpenShiftProvisioner(application); | ||
|
||
@BeforeAll | ||
public static void deploy() { | ||
provisioner.preDeploy(); | ||
provisioner.deploy(); | ||
} | ||
|
||
@AfterAll | ||
public static void undeploy() { | ||
provisioner.undeploy(); | ||
provisioner.postUndeploy(); | ||
} | ||
|
||
@Test | ||
public void verifyEapConfiguration() { | ||
SoftAssertions softAssertions = new SoftAssertions(); | ||
// verify system property added via cli | ||
PodShell rsh = new PodShell(openShift, openShift.getAnyPod(application.getName())); | ||
PodShellOutput output = rsh | ||
.executeWithBash(String.format("$JBOSS_HOME/bin/jboss-cli.sh -c /system-property=%s:read-resource", | ||
OpenShiftProvisionerTestBase.WILDFLY_TEST_PROPERTY)); | ||
softAssertions.assertThat(output.getError()).as("CLI configuration check: Error should be empty").isEmpty(); | ||
softAssertions.assertThat(output.getOutput()).as("CLI configuration check: Test property was not set by CLI") | ||
.contains("success", OpenShiftProvisionerTestBase.WILDFLY_TEST_PROPERTY); | ||
|
||
// verify application git | ||
Optional<BuildConfig> gitBuildConfig = openShift.buildConfigs().list().getItems().stream() | ||
.filter(buildConfig -> buildConfig.getSpec().getSource().getType().equals("Git")) | ||
.findFirst(); | ||
softAssertions.assertThat(gitBuildConfig.isPresent()).as("Cannot find a Git build config").isTrue(); | ||
if (gitBuildConfig.isPresent()) { | ||
softAssertions.assertThat(gitBuildConfig.get().getMetadata().getName()).contains(application.getName()); | ||
GitBuildSource git = gitBuildConfig.get().getSpec().getSource().getGit(); | ||
softAssertions.assertThat(git.getUri()).as("Git repository check") | ||
.isEqualTo(OpenShiftProvisionerTestBase.EAP7_TEST_APP_REPO); | ||
softAssertions.assertThat(git.getRef()).as("Git repository reference check") | ||
.isEqualTo(OpenShiftProvisionerTestBase.EAP7_TEST_APP_REF); | ||
} | ||
softAssertions.assertAll(); | ||
} | ||
|
||
/** | ||
* Any {@code Secret} or {@code ConfigMap} should be created as a preDeploy() operation by a provisioner. | ||
*/ | ||
@Test | ||
public void verifyDeployHooks() { | ||
Assertions.assertThat(openShift.getSecret(OpenShiftProvisionerTestBase.TEST_SECRET.getMetadata().getName())) | ||
.isNotNull(); | ||
} | ||
|
||
@Test | ||
public void scale() { | ||
provisioner.scale(1, true); | ||
openShift.waiters().areExactlyNPodsReady(1, application.getName()).waitFor(); | ||
provisioner.scale(2, true); | ||
openShift.waiters().areExactlyNPodsReady(2, application.getName()).waitFor(); | ||
} | ||
|
||
@Test | ||
public void pods() { | ||
provisioner.scale(2, true); | ||
Assertions.assertThat(provisioner.getPods().size()).isEqualTo(2); | ||
provisioner.scale(3, true); | ||
Assertions.assertThat(provisioner.getPods().size()).isEqualTo(3); | ||
} | ||
} |
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
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
20 changes: 20 additions & 0 deletions
20
...va/org/jboss/intersmash/tools/application/openshift/Eap7TemplateOpenShiftApplication.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,20 @@ | ||
package org.jboss.intersmash.tools.application.openshift; | ||
|
||
import org.jboss.intersmash.tools.application.openshift.template.Eap7Template; | ||
import org.jboss.intersmash.tools.provision.openshift.Eap7TemplateOpenShiftProvisioner; | ||
|
||
/** | ||
* End user Application descriptor interface which presents EAP 7 template application on OpenShift Container Platform. | ||
* | ||
* See {@link Eap7Template} for available templates the | ||
* application can represent. | ||
* | ||
* The application will be deployed by: | ||
* <ul> | ||
* <li>{@link Eap7TemplateOpenShiftProvisioner}</li> | ||
* </ul> | ||
*/ | ||
public interface Eap7TemplateOpenShiftApplication | ||
extends WildflyOpenShiftApplication, TemplateApplication<Eap7Template> { | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
...src/main/java/org/jboss/intersmash/tools/application/openshift/template/Eap7Template.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,27 @@ | ||
package org.jboss.intersmash.tools.application.openshift.template; | ||
|
||
import org.jboss.intersmash.tools.provision.openshift.template.OpenShiftTemplate; | ||
|
||
/** | ||
* OpenShift template for EAP 7.z (i.e. WildFly Jakarta EE 8 <= 26.1.2) applications. | ||
* <p> | ||
* See e.g.: https://github.com/jboss-container-images/jboss-eap-7-openshift-image | ||
*/ | ||
public enum Eap7Template implements OpenShiftTemplate { | ||
AMQ_PERSISTENT("amq-persistent"), | ||
AMQ("amq"), | ||
BASIC("basic"), | ||
HTTPS("https"), | ||
SSO("sso"); | ||
|
||
private String name; | ||
|
||
Eap7Template(String name) { | ||
this.name = name; | ||
} | ||
|
||
@Override | ||
public String getLabel() { | ||
return name; | ||
} | ||
} |
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
Oops, something went wrong.