use of org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer in project devspaces-images by redhat-developer.
the class KubernetesPluginsToolingValidator method validatePluginNames.
public void validatePluginNames(List<? extends ChePlugin> plugins) throws ValidationException {
for (ChePlugin plugin : plugins) {
if (plugin.getName() != null) {
final String formattedPluginName = plugin.getName().toLowerCase();
checkValid(formattedPluginName, "Plugin name `%s` contains unacceptable symbols and cannot be used as part of container naming.");
}
for (CheContainer container : plugin.getContainers()) {
if (container.getName() != null) {
final String formattedContainerName = container.getName().toLowerCase();
checkValid(formattedContainerName, "Container name `%s` contains unacceptable symbols and cannot be used as part of container naming.");
}
}
}
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer in project devspaces-images by redhat-developer.
the class KubernetesPluginsToolingApplierTest method createContainer.
private CheContainer createContainer(List<String> command, List<String> args) {
CheContainer container = createContainer();
container.setCommand(command);
container.setArgs(args);
return container;
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer in project devspaces-images by redhat-developer.
the class KubernetesPluginsToolingApplierTest method addToolingInitContainerWithCommand.
@Test
public void addToolingInitContainerWithCommand() throws InfrastructureException {
List<String> command = Arrays.asList("cp", "-rf", "test-file", "/some-volume/test");
lenient().when(podSpec.getInitContainers()).thenReturn(new ArrayList<>());
ChePlugin chePlugin = createChePlugin();
List<CheContainer> initContainers = singletonList(createContainer(command, null));
chePlugin.setInitContainers(initContainers);
applier.apply(runtimeIdentity, internalEnvironment, singletonList(chePlugin));
verifyPodAndInitContainersNumber(1);
Container toolingInitContainer = getOnlyOneInitContainerFromPod(internalEnvironment);
verifyContainer(toolingInitContainer);
assertEquals(toolingInitContainer.getCommand(), command);
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer in project devspaces-images by redhat-developer.
the class KubernetesPluginsToolingApplierTest method addToolingContainerWithArgs.
@Test
public void addToolingContainerWithArgs() throws InfrastructureException {
List<String> args = Arrays.asList("tail", "-f", "/dev/null");
lenient().when(podSpec.getContainers()).thenReturn(new ArrayList<>());
ChePlugin chePlugin = createChePlugin();
List<CheContainer> containers = singletonList(createContainer(null, args));
chePlugin.setContainers(containers);
applier.apply(runtimeIdentity, internalEnvironment, singletonList(chePlugin));
verifyPodAndContainersNumber(1);
Container toolingContainer = getOneAndOnlyNonUserContainer(internalEnvironment);
verifyContainer(toolingContainer);
assertEquals(toolingContainer.getArgs(), args);
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer in project devspaces-images by redhat-developer.
the class KubernetesPluginsToolingApplierTest method createContainer.
private CheContainer createContainer(String name, Command... commands) {
CheContainer cheContainer = new CheContainer();
cheContainer.setImage(TEST_IMAGE);
cheContainer.setName(name);
cheContainer.setEnv(singletonList(new EnvVar().name(ENV_VAR).value(ENV_VAR_VALUE)));
cheContainer.setVolumes(singletonList(new Volume().name(VOLUME_NAME).mountPath(VOLUME_MOUNT_PATH)));
cheContainer.setCommands(Arrays.asList(commands));
return cheContainer;
}
Aggregations