use of org.eclipse.che.api.workspace.server.wsplugins.model.PluginFQN in project che-server by eclipse-che.
the class BrokerEnvironmentFactoryTest method shouldNameContainersAfterArtifactsPluginBrokerImage.
@Test
public void shouldNameContainersAfterArtifactsPluginBrokerImage() throws Exception {
// given
Collection<PluginFQN> pluginFQNs = singletonList(new PluginFQN(null, "id"));
ArgumentCaptor<BrokersConfigs> captor = ArgumentCaptor.forClass(BrokersConfigs.class);
// when
factory.createForArtifactsBroker(pluginFQNs, runtimeId, false);
// then
verify(factory).doCreate(captor.capture());
BrokersConfigs brokersConfigs = captor.getValue();
PodSpec brokerPodSpec = brokersConfigs.pods.values().iterator().next().getSpec();
List<Container> containers = brokerPodSpec.getContainers();
assertEquals(containers.size(), 1);
assertEquals(containers.get(0).getName(), "artifacts-image");
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.PluginFQN in project che-server by eclipse-che.
the class BrokerEnvironmentFactoryTest method shouldIncludePluginsVolumeInArtifactsBroker.
@Test
public void shouldIncludePluginsVolumeInArtifactsBroker() throws Exception {
// given
Collection<PluginFQN> pluginFQNs = singletonList(new PluginFQN(null, "id"));
ArgumentCaptor<BrokersConfigs> captor = ArgumentCaptor.forClass(BrokersConfigs.class);
// when
factory.createForArtifactsBroker(pluginFQNs, runtimeId, false);
// then
verify(factory).doCreate(captor.capture());
BrokersConfigs brokersConfigs = captor.getValue();
InternalMachineConfig machine = brokersConfigs.machines.values().iterator().next();
assertTrue(machine.getVolumes().containsKey(PLUGINS_VOLUME_NAME));
assertEquals(machine.getVolumes().get(PLUGINS_VOLUME_NAME).getPath(), "/plugins");
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.PluginFQN in project che-server by eclipse-che.
the class BrokerEnvironmentFactoryTest method testQuotasBroker.
@Test
public void testQuotasBroker() throws Exception {
// given
Collection<PluginFQN> pluginFQNs = singletonList(new PluginFQN(null, "id"));
ArgumentCaptor<BrokersConfigs> captor = ArgumentCaptor.forClass(BrokersConfigs.class);
// when
factory.createForMetadataBroker(pluginFQNs, runtimeId, false);
// then
verify(factory).doCreate(captor.capture());
BrokersConfigs brokersConfigs = captor.getValue();
List<Container> containers = brokersConfigs.pods.values().stream().flatMap(p -> p.getSpec().getContainers().stream()).collect(Collectors.toList());
assertEquals(containers.size(), 1);
Container container = containers.get(0);
assertEquals(container.getResources().getRequests().get("memory"), new Quantity("250Mi"));
assertEquals(container.getResources().getLimits().get("memory"), new Quantity("250Mi"));
assertEquals(container.getResources().getRequests().get("cpu"), new Quantity("300m"));
assertEquals(container.getResources().getLimits().get("cpu"), new Quantity("300m"));
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.PluginFQN in project devspaces-images by redhat-developer.
the class SidecarToolingProvisioner method provision.
@Traced
@Beta
public void provision(RuntimeIdentity identity, StartSynchronizer startSynchronizer, E environment, Map<String, String> startOptions) throws InfrastructureException {
Collection<PluginFQN> pluginFQNs = pluginFQNParser.parsePlugins(environment.getAttributes());
if (pluginFQNs.isEmpty()) {
return;
}
LOG.debug("Started sidecar tooling provisioning workspace '{}'", identity.getWorkspaceId());
String recipeType = environment.getType();
ChePluginsApplier pluginsApplier = workspaceNextAppliers.get(recipeType);
if (pluginsApplier == null) {
throw new InfrastructureException("Sidecar tooling configuration is not supported with environment type " + recipeType);
}
boolean isEphemeral = EphemeralWorkspaceUtility.isEphemeral(environment.getAttributes());
boolean mergePlugins = shouldMergePlugins(environment.getAttributes());
List<ChePlugin> chePlugins = pluginBrokerManager.getTooling(identity, startSynchronizer, pluginFQNs, isEphemeral, mergePlugins, startOptions);
pluginsApplier.apply(identity, environment, chePlugins);
artifactsBrokerApplier.apply(environment, identity, pluginFQNs, mergePlugins);
LOG.debug("Finished sidecar tooling provisioning workspace '{}'", identity.getWorkspaceId());
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.PluginFQN in project devspaces-images by redhat-developer.
the class BrokerEnvironmentFactoryTest method shouldNameContainersAfterArtifactsPluginBrokerImage.
@Test
public void shouldNameContainersAfterArtifactsPluginBrokerImage() throws Exception {
// given
Collection<PluginFQN> pluginFQNs = singletonList(new PluginFQN(null, "id"));
ArgumentCaptor<BrokersConfigs> captor = ArgumentCaptor.forClass(BrokersConfigs.class);
// when
factory.createForArtifactsBroker(pluginFQNs, runtimeId, false);
// then
verify(factory).doCreate(captor.capture());
BrokersConfigs brokersConfigs = captor.getValue();
PodSpec brokerPodSpec = brokersConfigs.pods.values().iterator().next().getSpec();
List<Container> containers = brokerPodSpec.getContainers();
assertEquals(containers.size(), 1);
assertEquals(containers.get(0).getName(), "artifacts-image");
}
Aggregations