Search in sources :

Example 76 with InternalMachineConfig

use of org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig in project devspaces-images by redhat-developer.

the class KubernetesPluginsToolingApplierTest method addsMachineWithVolumeFromChePlugin.

@Test
public void addsMachineWithVolumeFromChePlugin() throws Exception {
    // given
    ChePlugin chePluginWithNoVolume = createChePlugin();
    chePluginWithNoVolume.getContainers().get(0).setVolumes(emptyList());
    // when
    applier.apply(runtimeIdentity, internalEnvironment, asList(createChePlugin(), chePluginWithNoVolume));
    // then
    Collection<InternalMachineConfig> machineConfigs = getNonUserMachines(internalEnvironment);
    assertEquals(machineConfigs.size(), 2);
    verifyNumberOfMachinesWithSpecificNumberOfVolumes(machineConfigs, 2, 0);
}
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 77 with InternalMachineConfig

use of org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig in project devspaces-images by redhat-developer.

the class MachineResolverTest method shouldSetDefaultCPULimitAndRequestIfSidecarDoesNotHaveOne.

@Test
public void shouldSetDefaultCPULimitAndRequestIfSidecarDoesNotHaveOne() throws InfrastructureException {
    InternalMachineConfig machineConfig = resolver.resolve();
    assertEquals(machineConfig.getAttributes().get(CPU_LIMIT_ATTRIBUTE), DEFAULT_CPU_LIMIT);
    assertEquals(machineConfig.getAttributes().get(CPU_REQUEST_ATTRIBUTE), DEFAULT_CPU_REQUEST);
}
Also used : InternalMachineConfig(org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig) Test(org.testng.annotations.Test)

Example 78 with InternalMachineConfig

use of org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig in project devspaces-images by redhat-developer.

the class MachineResolverTest method shouldSetMemoryRequestOfASidecarIfCorrespondingComponentFieldIsSet.

@Test(dataProvider = "memoryRequestAttributeProvider")
public void shouldSetMemoryRequestOfASidecarIfCorrespondingComponentFieldIsSet(String memoryRequest, String expectedMemRequest) throws InfrastructureException {
    component.setMemoryRequest(memoryRequest);
    InternalMachineConfig machineConfig = resolver.resolve();
    assertEquals(machineConfig.getAttributes().get(MEMORY_REQUEST_ATTRIBUTE), expectedMemRequest);
}
Also used : InternalMachineConfig(org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig) Test(org.testng.annotations.Test)

Example 79 with InternalMachineConfig

use of org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig in project devspaces-images by redhat-developer.

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

Example 80 with InternalMachineConfig

use of org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig in project devspaces-images by redhat-developer.

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)

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