use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class DefaultNamespaceEnricherTest method testNoNamespaceConfiguredInMetadataIfNoPropertyProvided.
@Test
public void testNoNamespaceConfiguredInMetadataIfNoPropertyProvided() {
// Given
setExpectations(new Properties(), new ResourceConfig());
final KubernetesListBuilder kubernetesListBuilder = getKubernetesListBuilder();
// When
new DefaultNamespaceEnricher(context).enrich(PlatformMode.kubernetes, kubernetesListBuilder);
// Then
assertThat(kubernetesListBuilder.build().getItems()).hasSize(2);
assertThat(kubernetesListBuilder.build().getItems().get(0).getMetadata().getNamespace()).isNull();
assertThat(kubernetesListBuilder.build().getItems().get(1).getMetadata().getNamespace()).isNull();
}
use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class DefaultNamespaceEnricherTest method enrichWithOpenShiftProjectFragmentWithNoStatus.
@Test
public void enrichWithOpenShiftProjectFragmentWithNoStatus() {
// Given
setExpectations(new Properties(), new ResourceConfig());
final KubernetesListBuilder kubernetesListBuilder = new KubernetesListBuilder();
kubernetesListBuilder.addToItems(new ProjectBuilder().withNewMetadata().withName("test-jkube").endMetadata().build());
// When
new DefaultNamespaceEnricher(context).enrich(PlatformMode.openshift, kubernetesListBuilder);
// Then
assertThat(kubernetesListBuilder.build().getItems()).hasSize(1);
assertThat(kubernetesListBuilder.build().getItems().iterator().next()).hasFieldOrPropertyWithValue("metadata.name", "test-jkube");
assertNull(kubernetesListBuilder.build().getItems().get(0).getMetadata().getNamespace());
}
use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class DefaultNamespaceEnricherTest method setNamespaceInResourceConfig.
private void setNamespaceInResourceConfig(String namespace) {
ResourceConfig resourceConfig = ResourceConfig.builder().namespace(namespace).build();
setExpectations(new Properties(), resourceConfig);
}
use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class ContainerHandlerTest method getVolumeMountWithoutNameTest.
@Test
public void getVolumeMountWithoutNameTest() {
ContainerHandler handler = createContainerHandler(project);
images.clear();
images.add(imageConfiguration1);
List<String> mounts = new ArrayList<>();
mounts.add("/path/etc");
// volume config without name but with mount
VolumeConfig volumeConfig2 = VolumeConfig.builder().mounts(mounts).build();
volumes1.clear();
volumes1.add(volumeConfig2);
ResourceConfig config2 = ResourceConfig.builder().volumes(volumes1).build();
containers = handler.getContainers(config2, images);
assertEquals(1, containers.get(0).getVolumeMounts().size());
assertNull(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 ContainerHandlerTest method getVolumeMountWithEmptyVolumeTest.
@Test
public void getVolumeMountWithEmptyVolumeTest() {
ContainerHandler handler = createContainerHandler(project);
images.clear();
images.add(imageConfiguration1);
// empty volume
ResourceConfig config5 = ResourceConfig.builder().volumes(volumes2).build();
containers = handler.getContainers(config5, images);
assertTrue(containers.get(0).getVolumeMounts().isEmpty());
}
Aggregations