use of org.eclipse.che.api.workspace.server.wsplugins.model.PluginFQN in project che-server by eclipse-che.
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" });
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.PluginFQN in project che-server by eclipse-che.
the class BrokerEnvironmentFactoryTest method shouldNotIncludePluginsVolumeInMetadataBroker.
@Test
public void shouldNotIncludePluginsVolumeInMetadataBroker() 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();
InternalMachineConfig machine = brokersConfigs.machines.values().iterator().next();
assertFalse(machine.getVolumes().containsKey(PLUGINS_VOLUME_NAME));
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.PluginFQN in project che-server by eclipse-che.
the class BrokerEnvironmentFactoryTest method testAddsMergeArgToMetadataBroker.
@Test
public void testAddsMergeArgToMetadataBroker() throws Exception {
// given
Collection<PluginFQN> pluginFQNs = singletonList(new PluginFQN(null, "id"));
ArgumentCaptor<BrokersConfigs> captor = ArgumentCaptor.forClass(BrokersConfigs.class);
// when
factory.createForMetadataBroker(pluginFQNs, runtimeId, true);
// 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);
assertTrue(container.getArgs().stream().anyMatch(e -> "--merge-plugins".equals(e)));
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.PluginFQN in project che-server by eclipse-che.
the class BrokerEnvironmentFactoryTest method testArtifactsBrokerSelfSignedCertificate.
@Test
public void testArtifactsBrokerSelfSignedCertificate() 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.createForArtifactsBroker(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" });
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.PluginFQN in project che-server by eclipse-che.
the class BrokerEnvironmentFactoryTest method shouldNameContainersAfterMetadataPluginBrokerImage.
@Test
public void shouldNameContainersAfterMetadataPluginBrokerImage() 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();
PodSpec brokerPodSpec = brokersConfigs.pods.values().iterator().next().getSpec();
List<Container> containers = brokerPodSpec.getContainers();
assertEquals(containers.size(), 1);
assertEquals(containers.get(0).getName(), "metadata-image");
}
Aggregations