use of org.eclipse.che.api.workspace.server.wsplugins.model.ChePlugin in project che-server by eclipse-che.
the class KubernetesPluginsToolingApplierTest method addToolingInitContainerToAPod.
@Test
public void addToolingInitContainerToAPod() throws Exception {
lenient().when(podSpec.getInitContainers()).thenReturn(new ArrayList<>());
ChePlugin chePlugin = createChePlugin();
chePlugin.setInitContainers(singletonList(createContainer()));
applier.apply(runtimeIdentity, internalEnvironment, singletonList(chePlugin));
verifyPodAndInitContainersNumber(1);
Container toolingInitContainer = getOnlyOneInitContainerFromPod(internalEnvironment);
verifyContainer(toolingInitContainer);
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.ChePlugin in project che-server by eclipse-che.
the class KubernetesPluginsToolingApplierTest method shouldNotFillInWarningIfChePluginDoesNotHaveAnyContainersAndThereAreNotRelatedCommands.
@Test
public void shouldNotFillInWarningIfChePluginDoesNotHaveAnyContainersAndThereAreNotRelatedCommands() throws Exception {
// given
ChePlugin chePlugin = createChePlugin();
// when
applier.apply(runtimeIdentity, internalEnvironment, singletonList(chePlugin));
// then
assertTrue(internalEnvironment.getWarnings().isEmpty());
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.ChePlugin in project che-server by eclipse-che.
the class KubernetesPluginsToolingApplierTest method createChePlugin.
private ChePlugin createChePlugin(String id, List<CheContainer> containers, List<CheContainer> initContainers) {
String[] splittedId = id.split("/");
ChePlugin plugin = new ChePlugin();
plugin.setPublisher(splittedId[0]);
plugin.setName(splittedId[1]);
plugin.setVersion(splittedId[2]);
plugin.setId(id);
plugin.setContainers(containers);
plugin.setInitContainers(initContainers);
internalEnvironment.getDevfile().getComponents().add(new ComponentImpl("chePlugin", id));
return plugin;
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.ChePlugin in project che-server by eclipse-che.
the class KubernetesPluginsToolingApplierTest method shouldNotFillInWarningIfChePluginHasMultiplyContainersAndThereAreNotRelatedCommands.
@Test
public void shouldNotFillInWarningIfChePluginHasMultiplyContainersAndThereAreNotRelatedCommands() throws Exception {
// given
ChePlugin chePlugin = createChePlugin(createContainer(), createContainer());
// when
applier.apply(runtimeIdentity, internalEnvironment, singletonList(chePlugin));
// then
assertTrue(internalEnvironment.getWarnings().isEmpty());
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.ChePlugin in project che-server by eclipse-che.
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);
}
Aggregations