use of org.eclipse.che.api.workspace.server.wsplugins.model.ChePluginEndpoint in project che-server by eclipse-che.
the class KubernetesPluginsToolingApplierTest method shouldExposeChePluginEndpointsPortsInToolingContainer.
@Test
public void shouldExposeChePluginEndpointsPortsInToolingContainer() 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
Container container = getOneAndOnlyNonUserContainer(internalEnvironment);
verifyPortsExposed(container, 101010, 2020);
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.ChePluginEndpoint in project devspaces-images by redhat-developer.
the class KubernetesPluginsToolingApplierTest method verifyK8sServices.
private void verifyK8sServices(KubernetesEnvironment internalEnvironment, ChePluginEndpoint... endpoints) {
Map<String, Service> services = internalEnvironment.getServices();
for (ChePluginEndpoint endpoint : endpoints) {
assertTrue(services.containsKey(endpoint.getName()));
Service service = services.get(endpoint.getName());
assertEquals(service.getMetadata().getName(), endpoint.getName());
assertEquals(service.getSpec().getSelector(), singletonMap(CHE_ORIGINAL_NAME_LABEL, POD_NAME));
assertEquals(service.getSpec().getPorts(), singletonList(createServicePort(endpoint.getTargetPort())));
}
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.ChePluginEndpoint in project devspaces-images by redhat-developer.
the class MachineResolverTest method shouldFailWhenEndpointNameAlreadyExist.
@Test(expectedExceptions = InfrastructureException.class)
public void shouldFailWhenEndpointNameAlreadyExist() throws InfrastructureException {
// given
ChePluginEndpoint pluginEndpoint = new ChePluginEndpoint();
pluginEndpoint.setName("test-endpoint");
endpoints.add(pluginEndpoint);
component.setEndpoints(Collections.singletonList(new EndpointImpl("test-endpoint", 8080, Collections.emptyMap())));
// when -> then exception
resolver.resolve();
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.ChePluginEndpoint in project devspaces-images by redhat-developer.
the class SidecarServicesProvisionerTest method shouldAddServiceForEachEndpoint.
@Test
public void shouldAddServiceForEachEndpoint() throws Exception {
List<ChePluginEndpoint> actualEndpoints = asList(new ChePluginEndpoint().name("testE1").targetPort(8080), new ChePluginEndpoint().name("testE2").targetPort(10000));
endpoints.addAll(actualEndpoints);
KubernetesEnvironment kubernetesEnvironment = KubernetesEnvironment.builder().build();
provisioner.provision(kubernetesEnvironment);
assertEquals(kubernetesEnvironment.getServices(), toK8sServices(actualEndpoints));
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.ChePluginEndpoint in project devspaces-images by redhat-developer.
the class SidecarServicesProvisionerTest method shouldNotAddServiceForNotdDiscoverableEndpoint.
@Test
public void shouldNotAddServiceForNotdDiscoverableEndpoint() throws Exception {
List<ChePluginEndpoint> actualEndpoints = asList(new ChePluginEndpoint().name("testE1").targetPort(8080), new ChePluginEndpoint().name("testE2").targetPort(10000).attributes(ImmutableMap.of("discoverable", "false")));
endpoints.addAll(actualEndpoints);
KubernetesEnvironment kubernetesEnvironment = KubernetesEnvironment.builder().build();
provisioner.provision(kubernetesEnvironment);
assertEquals(kubernetesEnvironment.getServices(), toK8sServices(ImmutableList.of(new ChePluginEndpoint().name("testE1").targetPort(8080))));
}
Aggregations