use of org.eclipse.che.workspace.infrastructure.kubernetes.wsplugins.brokerphases.BrokerEnvironmentFactory.BrokersConfigs 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.workspace.infrastructure.kubernetes.wsplugins.brokerphases.BrokerEnvironmentFactory.BrokersConfigs 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.workspace.infrastructure.kubernetes.wsplugins.brokerphases.BrokerEnvironmentFactory.BrokersConfigs 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.workspace.infrastructure.kubernetes.wsplugins.brokerphases.BrokerEnvironmentFactory.BrokersConfigs 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");
}
use of org.eclipse.che.workspace.infrastructure.kubernetes.wsplugins.brokerphases.BrokerEnvironmentFactory.BrokersConfigs in project devspaces-images by redhat-developer.
the class BrokerEnvironmentFactoryTest method testMetadataBrokerSelfSignedCertificate.
@Test
public void testMetadataBrokerSelfSignedCertificate() throws Exception {
when(certProvisioner.isConfigured()).thenReturn(true);
when(certProvisioner.getCertPath()).thenReturn("/tmp/che/cacert");
// 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.getArgs().toArray(), new String[] { "--push-endpoint", PUSH_ENDPOINT, "--runtime-id", String.format("%s:%s:%s", runtimeId.getWorkspaceId(), runtimeId.getEnvName(), runtimeId.getOwnerId()), "--cacert", "/tmp/che/cacert", "--registry-address", DEFAULT_REGISTRY, "--metas", "/broker-config/config.json" });
}
Aggregations