use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class DefaultNamespaceEnricherTest method createWithPropertiesAndConfigInKubernetesShouldAddConfigNamespace.
@Test
public void createWithPropertiesAndConfigInKubernetesShouldAddConfigNamespace() {
// Given
Properties properties = new Properties();
properties.put("jkube.enricher.jkube-namespace.namespace", "config-example");
setExpectations(properties, new ResourceConfig());
final KubernetesListBuilder klb = new KubernetesListBuilder();
// When
new DefaultNamespaceEnricher(context).create(PlatformMode.kubernetes, klb);
// Then
assertThat(klb.build().getItems()).hasSize(1);
assertThat(klb.build().getItems().iterator().next()).isInstanceOf(Namespace.class).hasFieldOrPropertyWithValue("metadata.name", "config-example").hasFieldOrPropertyWithValue("status.phase", "Active");
}
use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class DefaultNamespaceEnricherTest method noNameShouldReturnEmpty.
@Test
public void noNameShouldReturnEmpty() {
// Given
setExpectations(new 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 createWithPropertiesInKubernetesShouldAddNamespace.
@Test
public void createWithPropertiesInKubernetesShouldAddNamespace() {
// 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.kubernetes, klb);
// Then
assertThat(klb.build().getItems()).hasSize(1);
assertThat(klb.build().getItems().iterator().next()).isInstanceOf(Namespace.class).hasFieldOrPropertyWithValue("metadata.name", "example").hasFieldOrPropertyWithValue("status.phase", "Active");
}
use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class DefaultNamespaceEnricherTest method enrichWithPropertiesInKubernetesShouldAddProjectWithStatus.
@Test
public void enrichWithPropertiesInKubernetesShouldAddProjectWithStatus() {
// Given
setExpectations(new Properties(), new ResourceConfig());
final KubernetesListBuilder klb = new KubernetesListBuilder();
klb.addToItems(new ProjectBuilder().withNewMetadata().withName("name").endMetadata().withNewStatus().withPhase("active").endStatus().build());
// When
new DefaultNamespaceEnricher(context).enrich(PlatformMode.openshift, klb);
// Then
assertThat(klb.build().getItems()).hasSize(1);
assertThat(klb.build().getItems().iterator().next()).hasFieldOrPropertyWithValue("metadata.namespace", null);
}
use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class ReplicaSetHandlerTest method replicaSetHandlerWithoutControllerTest.
@Test(expected = IllegalArgumentException.class)
public void replicaSetHandlerWithoutControllerTest() {
// without controller name
ResourceConfig config = ResourceConfig.builder().imagePullPolicy("IfNotPresent").serviceAccount("test-account").replicas(5).volumes(volumes1).build();
replicaSetHandler.get(config, images);
}
Aggregations