-
Notifications
You must be signed in to change notification settings - Fork 445
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Webapp-Wildfly supports S2I source builds too
3 build modes: - Docker (Kubernetes) - OpenShift-Docker (S2I Binary) - OpenShift-S2I (S2I Source) Signed-off-by: Marc Nuri <marc@marcnuri.com>
- Loading branch information
Showing
11 changed files
with
215 additions
and
28 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
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
95 changes: 95 additions & 0 deletions
95
.../src/test/java/org/eclipse/jkube/generator/webapp/handler/WildFlyAppSeverHandlerTest.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,95 @@ | ||
/** | ||
* Copyright (c) 2019 Red Hat, Inc. | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at: | ||
* | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
package org.eclipse.jkube.generator.webapp.handler; | ||
|
||
|
||
import java.util.Collections; | ||
|
||
import org.eclipse.jkube.generator.api.GeneratorContext; | ||
import org.eclipse.jkube.kit.config.image.build.OpenShiftBuildStrategy; | ||
import org.eclipse.jkube.kit.config.resource.RuntimeMode; | ||
|
||
import mockit.Expectations; | ||
import mockit.Mocked; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
public class WildFlyAppSeverHandlerTest { | ||
|
||
@Mocked | ||
private GeneratorContext generatorContext; | ||
|
||
@Test | ||
public void kubernetes() { | ||
// Given | ||
// @formatter:off | ||
new Expectations() {{ | ||
generatorContext.getRuntimeMode(); result = RuntimeMode.kubernetes; | ||
// generatorContext.getStrategy(); result = OpenShiftBuildStrategy.docker; | ||
}}; | ||
// @formatter:on | ||
// When | ||
final WildFlyAppSeverHandler handler = new WildFlyAppSeverHandler(generatorContext); | ||
// Then | ||
assertCommonValues(handler); | ||
assertEquals("jboss/wildfly:19.0.0.Final", handler.getFrom()); | ||
assertTrue(handler.runCmds().isEmpty()); | ||
} | ||
|
||
@Test | ||
public void openShiftDockerStrategy() { | ||
// Given | ||
// @formatter:off | ||
new Expectations() {{ | ||
generatorContext.getRuntimeMode(); result = RuntimeMode.openshift; | ||
generatorContext.getStrategy(); result = OpenShiftBuildStrategy.docker; | ||
}}; | ||
// @formatter:on | ||
// When | ||
final WildFlyAppSeverHandler handler = new WildFlyAppSeverHandler(generatorContext); | ||
// Then | ||
assertCommonValues(handler); | ||
assertEquals("jboss/wildfly:19.0.0.Final", handler.getFrom()); | ||
assertEquals(Collections.singletonList("chmod -R a+rw /opt/jboss/wildfly/standalone/"), handler.runCmds()); | ||
} | ||
|
||
@Test | ||
public void openShiftSourceStrategy() { | ||
// Given | ||
// @formatter:off | ||
new Expectations() {{ | ||
generatorContext.getRuntimeMode(); result = RuntimeMode.openshift; | ||
generatorContext.getStrategy(); result = OpenShiftBuildStrategy.s2i; | ||
}}; | ||
// @formatter:on | ||
// When | ||
final WildFlyAppSeverHandler handler = new WildFlyAppSeverHandler(generatorContext); | ||
// Then | ||
assertCommonValues(handler); | ||
assertEquals("quay.io/wildfly/wildfly-centos7:19.0", handler.getFrom()); | ||
assertTrue(handler.runCmds().isEmpty()); | ||
} | ||
|
||
private static void assertCommonValues(WildFlyAppSeverHandler handler) { | ||
assertTrue(handler.supportsS2iBuild()); | ||
assertEquals("deployments", handler.getAssemblyName()); | ||
assertEquals("/opt/jboss/wildfly/standalone/deployments", handler.getDeploymentDir()); | ||
assertEquals("/opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0", handler.getCommand()); | ||
assertEquals("jboss:jboss:jboss", handler.getUser()); | ||
assertEquals(Collections.singletonMap("GALLEON_PROVISION_LAYERS", "cloud-server,web-clustering"), handler.getEnv()); | ||
assertEquals(Collections.singletonList("8080"), handler.exposedPorts()); | ||
} | ||
} |
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