use of org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig in project che-server by eclipse-che.
the class KubernetesPluginsToolingApplierTest method addsMachinesWithVolumesToAllToolingContainer.
@Test
public void addsMachinesWithVolumesToAllToolingContainer() throws Exception {
// given
ChePlugin chePluginWithNonDefaultVolume = createChePlugin();
String anotherVolumeName = VOLUME_NAME + "1";
String anotherVolumeMountPath = VOLUME_MOUNT_PATH + "/something";
List<Volume> volumes = singletonList(new Volume().name(anotherVolumeName).mountPath(anotherVolumeMountPath));
CheContainer toolingContainer = chePluginWithNonDefaultVolume.getContainers().get(0);
toolingContainer.setVolumes(volumes);
ChePlugin chePlugin = createChePlugin();
// when
applier.apply(runtimeIdentity, internalEnvironment, asList(chePlugin, chePluginWithNonDefaultVolume));
// then
Collection<InternalMachineConfig> machineConfigs = getNonUserMachines(internalEnvironment);
assertEquals(machineConfigs.size(), 2);
verify(chePluginsVolumeApplier).applyVolumes(any(PodData.class), any(Container.class), eq(chePlugin.getContainers().get(0).getVolumes()), eq(internalEnvironment));
}
use of org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig in project che-server by eclipse-che.
the class KubernetesPluginsToolingApplierTest method setsDefaultMemoryLimitForMachineAssociatedWithContainer.
@Test
public void setsDefaultMemoryLimitForMachineAssociatedWithContainer() throws Exception {
applier.apply(runtimeIdentity, internalEnvironment, singletonList(createChePlugin()));
InternalMachineConfig machineConfig = getOneAndOnlyNonUserMachine(internalEnvironment);
String memoryLimitAttribute = machineConfig.getAttributes().get(MEMORY_LIMIT_ATTRIBUTE);
assertEquals(memoryLimitAttribute, Integer.toString(MEMORY_LIMIT_MB * 1024 * 1024));
}
use of org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig in project che-server by eclipse-che.
the class MachineResolverTest method shouldSetCPURequestOfASidecarIfCorrespondingComponentFieldIsSet.
@Test(dataProvider = "cpuAttributeRequestProvider")
public void shouldSetCPURequestOfASidecarIfCorrespondingComponentFieldIsSet(String cpuRequest, String expectedCpuRequest) throws InfrastructureException {
component.setCpuRequest(cpuRequest);
InternalMachineConfig machineConfig = resolver.resolve();
assertEquals(machineConfig.getAttributes().get(CPU_REQUEST_ATTRIBUTE), expectedCpuRequest);
}
use of org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig in project che-server by eclipse-che.
the class MachineResolverTest method shouldAddEndpointsFromDevfileComponent.
@Test
public void shouldAddEndpointsFromDevfileComponent() throws InfrastructureException {
component.setEndpoints(asList(new EndpointImpl("endpoint8080", 8080, Collections.emptyMap()), new EndpointImpl("endpoint9999", 9999, ImmutableMap.of("secure", "true"))));
InternalMachineConfig config = resolver.resolve();
assertEquals(config.getServers().size(), 2);
assertEquals(config.getServers().get("endpoint8080").getPort(), "8080");
assertEquals(config.getServers().get("endpoint9999").getPort(), "9999");
assertEquals(config.getServers().get("endpoint9999").getAttributes().get("secure"), "true");
}
use of org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig in project che-server by eclipse-che.
the class MachineResolverTest method shouldNotSetMemLimitAttributeIfLimitIsInContainer.
@Test
public void shouldNotSetMemLimitAttributeIfLimitIsInContainer() throws InfrastructureException {
Containers.addRamLimit(container, 123456789);
InternalMachineConfig machineConfig = resolver.resolve();
assertNull(machineConfig.getAttributes().get(MEMORY_LIMIT_ATTRIBUTE));
}
Aggregations