Search in sources :

Example 41 with DeploymentConfig

use of io.fabric8.openshift.api.model.DeploymentConfig in project fabric8 by fabric8io.

the class KubernetesAssert method deployment.

/**
 * Asserts that there is a deployment of the given name
 *
 * @return the assertion object for the deployment
 */
public HasPodSelectionAssert deployment(String deploymentName) {
    String namespace = namespace();
    String qualifiedName = namespace + "." + deploymentName;
    OpenShiftClient openShiftClient = new Controller(client).getOpenShiftClientOrNull();
    if (openShiftClient != null && openShiftClient.supportsOpenShiftAPIGroup(OpenShiftAPIGroups.APPS)) {
        DeploymentConfig deployment = openShiftClient.deploymentConfigs().inNamespace(namespace).withName(deploymentName).get();
        assertThat(deployment).describedAs("DeploymentConfig: " + qualifiedName).isNotNull().metadata().name().isEqualTo(deploymentName);
        return new DeploymentConfigPodsAssert(client, deployment);
    } else {
        Deployment deployment = client.extensions().deployments().inNamespace(namespace).withName(deploymentName).get();
        assertThat(deployment).describedAs("Deployment: " + qualifiedName).isNotNull().metadata().name().isEqualTo(deploymentName);
        return new DeploymentPodsAssert(client, deployment);
    }
}
Also used : OpenShiftClient(io.fabric8.openshift.client.OpenShiftClient) Deployment(io.fabric8.kubernetes.api.model.extensions.Deployment) Controller(io.fabric8.kubernetes.api.Controller) ReplicationController(io.fabric8.kubernetes.api.model.ReplicationController) DeploymentConfig(io.fabric8.openshift.api.model.DeploymentConfig)

Aggregations

DeploymentConfig (io.fabric8.openshift.api.model.DeploymentConfig)30 Deployment (io.fabric8.kubernetes.api.model.extensions.Deployment)11 HasMetadata (io.fabric8.kubernetes.api.model.HasMetadata)10 OpenShiftClient (io.fabric8.openshift.client.OpenShiftClient)10 Test (org.junit.Test)9 ReplicationController (io.fabric8.kubernetes.api.model.ReplicationController)8 Service (io.fabric8.kubernetes.api.model.Service)8 ConfigMap (io.fabric8.kubernetes.api.model.ConfigMap)7 IntOrString (io.fabric8.kubernetes.api.model.IntOrString)7 ReplicaSet (io.fabric8.kubernetes.api.model.extensions.ReplicaSet)7 BuildConfig (io.fabric8.openshift.api.model.BuildConfig)7 DeploymentConfigSpec (io.fabric8.openshift.api.model.DeploymentConfigSpec)6 ImageStream (io.fabric8.openshift.api.model.ImageStream)6 IOException (java.io.IOException)6 Controller (io.fabric8.kubernetes.api.Controller)5 Pod (io.fabric8.kubernetes.api.model.Pod)5 DeploymentSpec (io.fabric8.kubernetes.api.model.extensions.DeploymentSpec)5 ReplicationControllerSpec (io.fabric8.kubernetes.api.model.ReplicationControllerSpec)4 ReplicaSetSpec (io.fabric8.kubernetes.api.model.extensions.ReplicaSetSpec)4 Route (io.fabric8.openshift.api.model.Route)4