use of org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig in project che-server by eclipse-che.
the class MachineResolverTest method shouldSetCPULimitOfASidecarIfCorrespondingComponentFieldIsSet.
@Test(dataProvider = "cpuAttributeLimitProvider")
public void shouldSetCPULimitOfASidecarIfCorrespondingComponentFieldIsSet(String cpuLimit, String expectedCpuLimit) throws InfrastructureException {
component.setCpuLimit(cpuLimit);
InternalMachineConfig machineConfig = resolver.resolve();
assertEquals(machineConfig.getAttributes().get(CPU_LIMIT_ATTRIBUTE), expectedCpuLimit);
}
use of org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig in project che-server by eclipse-che.
the class MachineResolverTest method shouldAddVolumesFromDevfileComponent.
@Test
public void shouldAddVolumesFromDevfileComponent() throws InfrastructureException {
component.setVolumes(asList(new org.eclipse.che.api.workspace.server.model.impl.devfile.VolumeImpl("foo", "/bar"), new org.eclipse.che.api.workspace.server.model.impl.devfile.VolumeImpl("test", "/foo/test")));
InternalMachineConfig config = resolver.resolve();
assertEquals(2, config.getVolumes().size());
assertEquals("/bar", config.getVolumes().get("foo").getPath());
assertEquals("/foo/test", config.getVolumes().get("test").getPath());
}
use of org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig in project che-server by eclipse-che.
the class MachineResolverTest method shouldSetDefaultMemLimitAndRequestIfSidecarDoesNotHaveOne.
@Test
public void shouldSetDefaultMemLimitAndRequestIfSidecarDoesNotHaveOne() throws InfrastructureException {
InternalMachineConfig machineConfig = resolver.resolve();
assertEquals(machineConfig.getAttributes().get(MEMORY_LIMIT_ATTRIBUTE), DEFAULT_MEM_LIMIT);
assertEquals(machineConfig.getAttributes().get(MEMORY_REQUEST_ATTRIBUTE), DEFAULT_MEM_REQUEST);
}
use of org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig in project che-server by eclipse-che.
the class KubernetesPluginsToolingApplierTest method setsSourceAndPluginAttributeForMachineAssociatedWithSidecar.
@Test
public void setsSourceAndPluginAttributeForMachineAssociatedWithSidecar() throws Exception {
ChePlugin chePlugin = createChePlugin();
applier.apply(runtimeIdentity, internalEnvironment, singletonList(chePlugin));
InternalMachineConfig machineConfig = getOneAndOnlyNonUserMachine(internalEnvironment);
Map<String, String> attributes = machineConfig.getAttributes();
assertEquals(attributes.get(CONTAINER_SOURCE_ATTRIBUTE), TOOL_CONTAINER_SOURCE);
assertEquals(attributes.get(PLUGIN_MACHINE_ATTRIBUTE), chePlugin.getId());
}
use of org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig in project che-server by eclipse-che.
the class KubernetesPluginsToolingApplierTest method addsMachineWithServersThatSetProtocolAndPath.
@Test
public void addsMachineWithServersThatSetProtocolAndPath() throws Exception {
// given
ChePlugin chePlugin = createChePlugin();
addPortToSingleContainerPlugin(chePlugin, 443, "test-port", ImmutableMap.of("path", "/path/1", "protocol", "https", "attr1", "value1"), true);
// when
applier.apply(runtimeIdentity, internalEnvironment, singletonList(chePlugin));
// then
InternalMachineConfig machineConfig = getOneAndOnlyNonUserMachine(internalEnvironment);
assertEquals(machineConfig.getServers(), expectedSingleServer(443, "test-port", singletonMap("attr1", "value1"), true, "https", "/path/1"));
}
Aggregations