Search in sources :

Example 36 with CheContainer

use of org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer in project devspaces-images by redhat-developer.

the class KubernetesPluginsToolingApplierTest method addToolingContainerWithCommand.

@Test
public void addToolingContainerWithCommand() throws InfrastructureException {
    List<String> command = Arrays.asList("tail", "-f", "/dev/null");
    lenient().when(podSpec.getContainers()).thenReturn(new ArrayList<>());
    ChePlugin chePlugin = createChePlugin();
    List<CheContainer> containers = singletonList(createContainer(command, null));
    chePlugin.setContainers(containers);
    applier.apply(runtimeIdentity, internalEnvironment, singletonList(chePlugin));
    verifyPodAndContainersNumber(1);
    Container toolingContainer = getOneAndOnlyNonUserContainer(internalEnvironment);
    verifyContainer(toolingContainer);
    assertEquals(toolingContainer.getCommand(), command);
}
Also used : CheContainer(org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer) Container(io.fabric8.kubernetes.api.model.Container) CheContainer(org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer) ChePlugin(org.eclipse.che.api.workspace.server.wsplugins.model.ChePlugin) Test(org.testng.annotations.Test)

Example 37 with CheContainer

use of org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer in project devspaces-images by redhat-developer.

the class KubernetesPluginsToolingApplierTest method addToolingInitContainerWithCommandAndArgs.

@Test
public void addToolingInitContainerWithCommandAndArgs() throws InfrastructureException {
    List<String> command = singletonList("cp");
    List<String> args = Arrays.asList("-rf", "test-file", "/some-volume/test");
    lenient().when(podSpec.getInitContainers()).thenReturn(new ArrayList<>());
    ChePlugin chePlugin = createChePlugin();
    List<CheContainer> initContainers = singletonList(createContainer(command, args));
    chePlugin.setInitContainers(initContainers);
    applier.apply(runtimeIdentity, internalEnvironment, singletonList(chePlugin));
    verifyPodAndInitContainersNumber(1);
    Container toolingInitContainer = getOnlyOneInitContainerFromPod(internalEnvironment);
    verifyContainer(toolingInitContainer);
    assertEquals(toolingInitContainer.getCommand(), command);
    assertEquals(toolingInitContainer.getArgs(), args);
}
Also used : CheContainer(org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer) Container(io.fabric8.kubernetes.api.model.Container) CheContainer(org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer) ChePlugin(org.eclipse.che.api.workspace.server.wsplugins.model.ChePlugin) Test(org.testng.annotations.Test)

Example 38 with CheContainer

use of org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer in project devspaces-images by redhat-developer.

the class MachineResolverTest method setUp.

@BeforeMethod
public void setUp() {
    endpoints = new ArrayList<>();
    cheContainer = new CheContainer();
    container = new Container();
    component = new ComponentImpl("chePlugin", PLUGIN_ID);
    resolver = new MachineResolver(new Pair<>(PROJECTS_ENV_VAR, PROJECTS_MOUNT_PATH), container, cheContainer, DEFAULT_MEM_LIMIT, DEFAULT_MEM_REQUEST, DEFAULT_CPU_LIMIT, DEFAULT_CPU_REQUEST, endpoints, component);
}
Also used : CheContainer(org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer) Container(io.fabric8.kubernetes.api.model.Container) CheContainer(org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer) ComponentImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.ComponentImpl) Pair(org.eclipse.che.commons.lang.Pair) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

CheContainer (org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer)38 Container (io.fabric8.kubernetes.api.model.Container)28 ChePlugin (org.eclipse.che.api.workspace.server.wsplugins.model.ChePlugin)26 Test (org.testng.annotations.Test)22 PodData (org.eclipse.che.workspace.infrastructure.kubernetes.environment.KubernetesEnvironment.PodData)10 ComponentImpl (org.eclipse.che.api.workspace.server.model.impl.devfile.ComponentImpl)8 InternalMachineConfig (org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig)6 ChePluginEndpoint (org.eclipse.che.api.workspace.server.wsplugins.model.ChePluginEndpoint)6 Beta (com.google.common.annotations.Beta)4 ArrayListMultimap (com.google.common.collect.ArrayListMultimap)4 Sets (com.google.common.collect.Sets)4 EnvVar (io.fabric8.kubernetes.api.model.EnvVar)4 Pod (io.fabric8.kubernetes.api.model.Pod)4 PodBuilder (io.fabric8.kubernetes.api.model.PodBuilder)4 Service (io.fabric8.kubernetes.api.model.Service)4 String.format (java.lang.String.format)4 Collection (java.util.Collection)4 Collections.emptyList (java.util.Collections.emptyList)4 List (java.util.List)4 Map (java.util.Map)4