Package org.wildfly.test.cloud.common
Class TestHelper
- java.lang.Object
-
- org.wildfly.test.cloud.common.TestHelper
-
public class TestHelper extends Object
Utility to interact with an application running in a container. It can be injected into your test, in which case it is pre-initialised with the container name for your application. Alternatively, you can call its static methods and specify the container and pod names.- Author:
- Kabir Khan
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static org.jboss.dmr.ModelNodecheckAndGetResult(org.jboss.dmr.ModelNode result)static voidcheckFailed(org.jboss.dmr.ModelNode result)<R> RdoWithWebPortForward(String path, ForwardedPortAction<R> action)static org.jboss.dmr.ModelNodeexecuteCLICommands(io.fabric8.kubernetes.client.KubernetesClient client, String podName, String containerName, String... commands)org.jboss.dmr.ModelNodeexecuteCLICommands(String... commands)Map<String,String>getAllPodLogs()StringgetContainerName()StringgetPodLog(String podName)static StringreadFile(io.fabric8.kubernetes.client.KubernetesClient client, String podName, String containerName, String filePath)StringreadFile(String filePath)static StringrunCommand(io.fabric8.kubernetes.client.KubernetesClient client, String podName, String containerName, String bashCommand, boolean expectOutput)StringrunCommand(String bashCommand, boolean expectOutput)booleanwaitUntilWildFlyIsReady(long delay)static booleanwaitUntilWildFlyIsReady(io.fabric8.kubernetes.client.KubernetesClient k8sClient, String podName, String containerName, long delay)
-
-
-
Method Detail
-
getContainerName
public String getContainerName()
-
waitUntilWildFlyIsReady
public boolean waitUntilWildFlyIsReady(long delay)
-
waitUntilWildFlyIsReady
public static boolean waitUntilWildFlyIsReady(io.fabric8.kubernetes.client.KubernetesClient k8sClient, String podName, String containerName, long delay)
-
executeCLICommands
public org.jboss.dmr.ModelNode executeCLICommands(String... commands)
-
executeCLICommands
public static org.jboss.dmr.ModelNode executeCLICommands(io.fabric8.kubernetes.client.KubernetesClient client, String podName, String containerName, String... commands)
-
readFile
public static String readFile(io.fabric8.kubernetes.client.KubernetesClient client, String podName, String containerName, String filePath)
-
runCommand
public static String runCommand(io.fabric8.kubernetes.client.KubernetesClient client, String podName, String containerName, String bashCommand, boolean expectOutput)
-
checkAndGetResult
public static org.jboss.dmr.ModelNode checkAndGetResult(org.jboss.dmr.ModelNode result)
-
checkFailed
public static void checkFailed(org.jboss.dmr.ModelNode result)
-
doWithWebPortForward
public <R> R doWithWebPortForward(String path, ForwardedPortAction<R> action) throws Exception
- Throws:
Exception
-
-