use of org.eclipse.che.api.workspace.server.model.impl.ServerConfigImpl in project che-server by eclipse-che.
the class KubernetesServerExposerTest method shouldExposeContainerPortsAndCreateServiceForServerWhenTwoServersHasDifferentPorts.
@Test
public void shouldExposeContainerPortsAndCreateServiceForServerWhenTwoServersHasDifferentPorts() throws Exception {
// given
ServerConfigImpl httpServerConfig = new ServerConfigImpl("8080/tcp", "http", "/api", ATTRIBUTES_MAP);
ServerConfigImpl wsServerConfig = new ServerConfigImpl("8081/tcp", "ws", "/connect", ATTRIBUTES_MAP);
Map<String, ServerConfigImpl> serversToExpose = ImmutableMap.of("http-server", httpServerConfig, "ws-server", wsServerConfig);
// when
serverExposer.expose(serversToExpose);
// then
assertEquals(kubernetesEnvironment.getServices().size(), 1);
assertThatExternalServerIsExposed(MACHINE_NAME, "tcp", 8080, "http-server", new ServerConfigImpl(httpServerConfig).withAttributes(ATTRIBUTES_MAP));
assertThatExternalServerIsExposed(MACHINE_NAME, "tcp", 8081, "ws-server", new ServerConfigImpl(wsServerConfig).withAttributes(ATTRIBUTES_MAP));
}
use of org.eclipse.che.api.workspace.server.model.impl.ServerConfigImpl in project che-server by eclipse-che.
the class KubernetesServerExposerTest method shouldExposeContainerPortAndCreateServiceForInternalServer.
@Test
public void shouldExposeContainerPortAndCreateServiceForInternalServer() throws Exception {
// given
ServerConfigImpl httpServerConfig = new ServerConfigImpl("8080/tcp", "http", "/api", INTERNAL_SERVER_ATTRIBUTE_MAP);
Map<String, ServerConfigImpl> serversToExpose = ImmutableMap.of("http-server", httpServerConfig);
// when
serverExposer.expose(serversToExpose);
// then
assertThatInternalServerIsExposed(MACHINE_NAME, "http-server", "tcp", 8080, new ServerConfigImpl(httpServerConfig).withAttributes(INTERNAL_SERVER_ATTRIBUTE_MAP));
}
use of org.eclipse.che.api.workspace.server.model.impl.ServerConfigImpl in project che-server by eclipse-che.
the class KubernetesServerExposerTest method shouldCreateIngressPerUniqueServerWithTheSamePort.
@Test
public void shouldCreateIngressPerUniqueServerWithTheSamePort() throws Exception {
// given
ServerConfigImpl httpServerConfig = new ServerConfigImpl("8080/tcp", "http", "/api", UNIQUE_SERVER_ATTRIBUTES);
ServerConfigImpl wsServerConfig = new ServerConfigImpl("8080/tcp", "ws", "/connect", UNIQUE_SERVER_ATTRIBUTES);
ServicePort servicePort = new ServicePortBuilder().withName("server-8080").withPort(8080).withProtocol("TCP").withTargetPort(new IntOrString(8080)).build();
Map<String, ServerConfig> serversToExpose = ImmutableMap.of("http-server", httpServerConfig, "ws-server", wsServerConfig);
// when
serverExposer.expose(serversToExpose);
// then
assertThatExternalServerIsExposed(MACHINE_NAME, "tcp", 8080, "http-server", new ServerConfigImpl(httpServerConfig).withAttributes(UNIQUE_SERVER_ATTRIBUTES));
assertThatExternalServerIsExposed(MACHINE_NAME, "tcp", 8080, "ws-server", new ServerConfigImpl(wsServerConfig).withAttributes(UNIQUE_SERVER_ATTRIBUTES));
}
use of org.eclipse.che.api.workspace.server.model.impl.ServerConfigImpl in project che-server by eclipse-che.
the class KubernetesServerExposerTest method shouldExposeContainerPortAndCreateServiceForServer.
@Test
public void shouldExposeContainerPortAndCreateServiceForServer() throws Exception {
// given
ServerConfigImpl httpServerConfig = new ServerConfigImpl("8080/tcp", "http", "/api", ATTRIBUTES_MAP);
Map<String, ServerConfigImpl> serversToExpose = ImmutableMap.of("http-server", httpServerConfig);
// when
serverExposer.expose(serversToExpose);
// then
assertThatExternalServerIsExposed(MACHINE_NAME, "tcp", 8080, "http-server", new ServerConfigImpl(httpServerConfig).withAttributes(ATTRIBUTES_MAP));
}
use of org.eclipse.che.api.workspace.server.model.impl.ServerConfigImpl in project che-server by eclipse-che.
the class KubernetesServerExposerTest method testDiscoverableServerConfigWithoutNameAttributeIsNotProvisioned.
@Test
public void testDiscoverableServerConfigWithoutNameAttributeIsNotProvisioned() throws InfrastructureException {
// given
ServerConfigImpl httpServerConfig = new ServerConfigImpl("8080/tcp", "http", "/api", ImmutableMap.of(DISCOVERABLE_SERVER_ATTRIBUTE, "true"));
Map<String, ServerConfigImpl> serversToExpose = ImmutableMap.of("http-server", httpServerConfig);
// when
serverExposer.expose(serversToExpose);
assertEquals(kubernetesEnvironment.getServices().size(), 1);
assertFalse(kubernetesEnvironment.getServices().containsKey("hello"));
}
Aggregations