use of org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig in project che-server by eclipse-che.
the class KubernetesPluginsToolingApplierTest method createsPodAndAddToolingIfNoPodIsPresent.
@Test
public void createsPodAndAddToolingIfNoPodIsPresent() throws Exception {
internalEnvironment = spy(KubernetesEnvironment.builder().build());
internalEnvironment.setDevfile(new DevfileImpl());
Map<String, InternalMachineConfig> machines = new HashMap<>();
machines.put(USER_MACHINE_NAME, userMachineConfig);
internalEnvironment.getMachines().putAll(machines);
applier.apply(runtimeIdentity, internalEnvironment, singletonList(createChePlugin()));
verifyPodAndContainersNumber(1);
Container toolingContainer = getOneAndOnlyNonUserContainer(internalEnvironment);
verifyContainer(toolingContainer);
}
use of org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig in project che-server by eclipse-che.
the class KubernetesPluginsToolingApplierTest method addsMachineWithServersThatUseSamePortButDifferentNames.
@Test
public void addsMachineWithServersThatUseSamePortButDifferentNames() throws Exception {
// given
ChePlugin chePlugin = createChePlugin();
addPortToSingleContainerPlugin(chePlugin, 80, "test-port/http", emptyMap(), true);
addPortToSingleContainerPlugin(chePlugin, 80, "test-port/ws", emptyMap(), true);
// when
applier.apply(runtimeIdentity, internalEnvironment, singletonList(chePlugin));
// then
InternalMachineConfig machineConfig = getOneAndOnlyNonUserMachine(internalEnvironment);
assertEquals(machineConfig.getServers(), expectedTwoServers(80, "test-port/http", emptyMap(), true, 80, "test-port/ws", emptyMap(), true));
}
use of org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig in project che-server by eclipse-che.
the class KubernetesPluginsToolingApplierTest method addsMachineWithServersForContainer.
@Test
public void addsMachineWithServersForContainer() throws Exception {
// given
ChePlugin chePlugin = createChePlugin();
addPortToSingleContainerPlugin(chePlugin, 80, "test-port", emptyMap(), true);
// when
applier.apply(runtimeIdentity, internalEnvironment, singletonList(chePlugin));
// then
InternalMachineConfig machineConfig = getOneAndOnlyNonUserMachine(internalEnvironment);
assertEquals(machineConfig.getServers(), expectedSingleServer(80, "test-port", emptyMap(), true));
}
use of org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig in project che-server by eclipse-che.
the class KubernetesPluginsToolingApplierTest method addsTwoServersForContainers.
@Test
public void addsTwoServersForContainers() throws Exception {
// given
ChePlugin chePlugin = createChePlugin();
addPortToSingleContainerPlugin(chePlugin, 80, "test-port", emptyMap(), true);
addPortToSingleContainerPlugin(chePlugin, 8090, "another-test-port", emptyMap(), false);
// when
applier.apply(runtimeIdentity, internalEnvironment, singletonList(chePlugin));
// then
InternalMachineConfig machineConfig = getOneAndOnlyNonUserMachine(internalEnvironment);
assertEquals(machineConfig.getServers(), expectedTwoServers(80, "test-port", emptyMap(), true, 8090, "another-test-port", emptyMap(), false));
}
use of org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig in project che-server by eclipse-che.
the class KubernetesPluginsToolingApplierTest method setUp.
@BeforeMethod
public void setUp() {
internalEnvironment = spy(KubernetesEnvironment.builder().build());
internalEnvironment.setDevfile(new DevfileImpl());
applier = new KubernetesPluginsToolingApplier(TEST_IMAGE_POLICY, MEMORY_LIMIT_MB, MEMORY_REQUEST_MB, CPU_LIMIT, CPU_REQUEST, false, projectsRootEnvVariableProvider, chePluginsVolumeApplier, envVars);
Map<String, InternalMachineConfig> machines = new HashMap<>();
List<Container> containers = new ArrayList<>();
containers.add(userContainer);
machines.put(USER_MACHINE_NAME, userMachineConfig);
when(pod.getSpec()).thenReturn(podSpec);
lenient().when(podSpec.getContainers()).thenReturn(containers);
lenient().when(pod.getMetadata()).thenReturn(meta);
lenient().when(meta.getName()).thenReturn(POD_NAME);
internalEnvironment.addPod(pod);
internalEnvironment.getMachines().putAll(machines);
lenient().when(projectsRootEnvVariableProvider.get(any())).thenReturn(new Pair<>("projects_root", "/somewhere/over/the/rainbow"));
}
Aggregations