use of io.fabric8.openshift.client.OpenShiftClient 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);
}
}
Aggregations