Search in sources :

Example 61 with InternalMachineConfig

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);
}
Also used : InternalMachineConfig(org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig) Test(org.testng.annotations.Test)

Example 62 with InternalMachineConfig

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());
}
Also used : InternalMachineConfig(org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig) VolumeImpl(org.eclipse.che.api.workspace.server.model.impl.VolumeImpl) Test(org.testng.annotations.Test)

Example 63 with InternalMachineConfig

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);
}
Also used : InternalMachineConfig(org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig) Test(org.testng.annotations.Test)

Example 64 with InternalMachineConfig

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());
}
Also used : InternalMachineConfig(org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig) ChePlugin(org.eclipse.che.api.workspace.server.wsplugins.model.ChePlugin) Test(org.testng.annotations.Test)

Example 65 with InternalMachineConfig

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"));
}
Also used : InternalMachineConfig(org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig) ChePlugin(org.eclipse.che.api.workspace.server.wsplugins.model.ChePlugin) Test(org.testng.annotations.Test)

Aggregations

InternalMachineConfig (org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig)88 Test (org.testng.annotations.Test)64 Container (io.fabric8.kubernetes.api.model.Container)36 ChePlugin (org.eclipse.che.api.workspace.server.wsplugins.model.ChePlugin)18 PodData (org.eclipse.che.workspace.infrastructure.kubernetes.environment.KubernetesEnvironment.PodData)16 DevfileImpl (org.eclipse.che.api.workspace.server.model.impl.devfile.DevfileImpl)14 EnvVar (io.fabric8.kubernetes.api.model.EnvVar)12 PodSpec (io.fabric8.kubernetes.api.model.PodSpec)12 ComponentImpl (org.eclipse.che.api.workspace.server.model.impl.devfile.ComponentImpl)12 ContainerBuilder (io.fabric8.kubernetes.api.model.ContainerBuilder)10 ObjectMetaBuilder (io.fabric8.kubernetes.api.model.ObjectMetaBuilder)10 Pod (io.fabric8.kubernetes.api.model.Pod)10 Secret (io.fabric8.kubernetes.api.model.Secret)10 SecretBuilder (io.fabric8.kubernetes.api.model.SecretBuilder)10 InfrastructureException (org.eclipse.che.api.workspace.server.spi.InfrastructureException)10 HashMap (java.util.HashMap)8 CheContainer (org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer)8 Traced (org.eclipse.che.commons.annotation.Traced)8 ConfigMap (io.fabric8.kubernetes.api.model.ConfigMap)6 PodSpecBuilder (io.fabric8.kubernetes.api.model.PodSpecBuilder)6