use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class BaseEnricherGetReplicaCountTest method withNoListBuilderAndConfiguredResourceConfigShouldReturnResourceConfig.
@Test
public void withNoListBuilderAndConfiguredResourceConfigShouldReturnResourceConfig() {
// Given
final ResourceConfig resourceConfig = ResourceConfig.builder().replicas(313373).build();
// When
final int result = getReplicaCount(null, resourceConfig, 1337);
// Then
assertThat(result).isEqualTo(313373);
}
use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class BaseEnricherGetReplicaCountTest method withNoListBuilderAndEmptyResourceConfigShouldReturnDefault.
@Test
public void withNoListBuilderAndEmptyResourceConfigShouldReturnDefault() {
// When
final int result = getReplicaCount(null, new ResourceConfig(), 1337);
// Then
assertThat(result).isEqualTo(1337);
}
use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class ContainerHandlerTest method getVolumeMountWithNameAndMountTest.
@Test
public void getVolumeMountWithNameAndMountTest() {
ContainerHandler handler = createContainerHandler(project);
List<String> mounts = new ArrayList<>();
mounts.add("/path/etc");
images.clear();
images.add(imageConfiguration1);
// volume config with name and single mount
VolumeConfig volumeConfig3 = VolumeConfig.builder().name("third").mounts(mounts).build();
volumes1.clear();
volumes1.add(volumeConfig3);
ResourceConfig config3 = ResourceConfig.builder().volumes(volumes1).build();
containers = handler.getContainers(config3, images);
assertEquals(1, containers.get(0).getVolumeMounts().size());
assertEquals("third", containers.get(0).getVolumeMounts().get(0).getName());
assertEquals("/path/etc", containers.get(0).getVolumeMounts().get(0).getMountPath());
}
use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class DefaultNamespaceEnricherTest method createWithPropertiesAndUnknownTypeInKubernetesShouldAddNothing.
@Test
public void createWithPropertiesAndUnknownTypeInKubernetesShouldAddNothing() {
// Given
Properties properties = new Properties();
properties.put("jkube.enricher.jkube-namespace.type", "unknown");
properties.put("jkube.enricher.jkube-namespace.namespace", "example");
setExpectations(properties, new ResourceConfig());
final KubernetesListBuilder klb = new KubernetesListBuilder();
// When
new DefaultNamespaceEnricher(context).create(PlatformMode.kubernetes, klb);
// Then
assertThat(klb.build().getItems()).isEmpty();
}
use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class DefaultNamespaceEnricherTest method createWithPropertiesInOpenShiftShouldAddProject.
@Test
public void createWithPropertiesInOpenShiftShouldAddProject() {
// Given
Properties properties = new Properties();
properties.put("jkube.enricher.jkube-namespace.namespace", "example");
setExpectations(properties, new ResourceConfig());
final KubernetesListBuilder klb = new KubernetesListBuilder();
// When
new DefaultNamespaceEnricher(context).create(PlatformMode.openshift, klb);
// Then
assertThat(klb.build().getItems()).hasSize(1);
assertThat(klb.build().getItems().iterator().next()).isInstanceOf(Project.class).hasFieldOrPropertyWithValue("metadata.name", "example").hasFieldOrPropertyWithValue("status.phase", "Active");
}
Aggregations