use of org.eclipse.che.api.workspace.server.wsplugins.model.ChePluginEndpoint in project devspaces-images by redhat-developer.
the class SidecarServicesProvisionerTest method shouldNotDuplicateServicesWhenThereIsConflictingServiceInK8sEnv.
@Test(expectedExceptions = InfrastructureException.class, expectedExceptionsMessageRegExp = "Applying of sidecar tooling failed. Kubernetes service with name '" + CONFLICTING_SERVICE_NAME + "' already exists in the workspace environment.")
public void shouldNotDuplicateServicesWhenThereIsConflictingServiceInK8sEnv() throws Exception {
List<ChePluginEndpoint> actualEndpoints = singletonList(new ChePluginEndpoint().name(CONFLICTING_SERVICE_NAME).targetPort(8080));
endpoints.addAll(actualEndpoints);
KubernetesEnvironment kubernetesEnvironment = KubernetesEnvironment.builder().setServices(singletonMap(CONFLICTING_SERVICE_NAME, new Service())).build();
provisioner.provision(kubernetesEnvironment);
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.ChePluginEndpoint in project devspaces-images by redhat-developer.
the class KubernetesPluginsToolingApplierTest method shouldNotExposeChePluginPortIfThereIsNoEndpoint.
@Test
public void shouldNotExposeChePluginPortIfThereIsNoEndpoint() throws Exception {
// given
ChePluginEndpoint endpoint1 = new ChePluginEndpoint().name(CHE_PLUGIN_ENDPOINT_NAME).targetPort(101010).setPublic(true);
CheContainerPort cheContainerPort1 = new CheContainerPort().exposedPort(101010);
CheContainerPort cheContainerPort2 = new CheContainerPort().exposedPort(2020);
ChePlugin chePlugin = createChePlugin();
chePlugin.setEndpoints(singletonList(endpoint1));
chePlugin.getContainers().get(0).setPorts(asList(cheContainerPort1, cheContainerPort2));
// when
applier.apply(runtimeIdentity, internalEnvironment, singletonList(chePlugin));
// then
Container container = getOneAndOnlyNonUserContainer(internalEnvironment);
verifyPortsExposed(container, 101010);
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.ChePluginEndpoint in project devspaces-images by redhat-developer.
the class KubernetesPluginsToolingApplierTest method shouldAddK8sServicesForChePluginEndpoints.
@Test
public void shouldAddK8sServicesForChePluginEndpoints() throws Exception {
// given
ChePluginEndpoint endpoint1 = new ChePluginEndpoint().name(CHE_PLUGIN_ENDPOINT_NAME).targetPort(101010).setPublic(true);
ChePluginEndpoint endpoint2 = new ChePluginEndpoint().name("test-endpoint-2").targetPort(2020).setPublic(false);
CheContainerPort cheContainerPort1 = new CheContainerPort().exposedPort(101010);
CheContainerPort cheContainerPort2 = new CheContainerPort().exposedPort(2020);
ChePlugin chePlugin = createChePlugin();
chePlugin.setEndpoints(asList(endpoint1, endpoint2));
chePlugin.getContainers().get(0).setPorts(asList(cheContainerPort1, cheContainerPort2));
// when
applier.apply(runtimeIdentity, internalEnvironment, singletonList(chePlugin));
// then
verifyK8sServices(internalEnvironment, endpoint1, endpoint2);
}
Aggregations