use of io.fabric8.kubernetes.api.model.Context in project fabric8-maven-plugin by fabric8io.
the class MavenProjectEnricherTest method testGeneratedResources.
@Test
public void testGeneratedResources() {
ProjectEnricher projectEnricher = new ProjectEnricher(context);
KubernetesListBuilder builder = createListWithDeploymentConfig();
projectEnricher.adapt(builder);
KubernetesList list = builder.build();
Map<String, String> labels = list.getItems().get(0).getMetadata().getLabels();
assertNotNull(labels);
assertEquals("groupId", labels.get("group"));
assertEquals("artifactId", labels.get("app"));
assertEquals("version", labels.get("version"));
assertNull(labels.get("project"));
Map<String, String> selectors = projectEnricher.getSelector(Kind.DEPLOYMENT_CONFIG);
assertEquals("groupId", selectors.get("group"));
assertEquals("artifactId", selectors.get("app"));
assertNull(selectors.get("version"));
assertNull(selectors.get("project"));
}
use of io.fabric8.kubernetes.api.model.Context in project fabric8-maven-plugin by fabric8io.
the class RevisionHistoryEnricherTest method testDefaultRevisionHistoryLimit.
@Test
public void testDefaultRevisionHistoryLimit() throws JsonProcessingException {
// Given
KubernetesListBuilder builder = new KubernetesListBuilder().addNewDeploymentItem().endDeploymentItem();
RevisionHistoryEnricher enricher = new RevisionHistoryEnricher(context);
// When
enricher.addMissingResources(builder);
// Then
assertRevisionHistory(builder.build(), Configs.asInt(RevisionHistoryEnricher.Config.limit.def()));
}
use of io.fabric8.kubernetes.api.model.Context in project fabric8-maven-plugin by fabric8io.
the class RevisionHistoryEnricherTest method testCustomRevisionHistoryLimit.
@Test
public void testCustomRevisionHistoryLimit() throws JsonProcessingException {
// Setup mock behaviour
final String revisionNumber = "10";
new Expectations() {
{
context.getConfig();
result = prepareEnricherConfig(revisionNumber);
}
};
// Given
KubernetesListBuilder builder = new KubernetesListBuilder().addNewDeploymentItem().endDeploymentItem();
RevisionHistoryEnricher enricher = new RevisionHistoryEnricher(context);
// When
enricher.addMissingResources(builder);
// Then
assertRevisionHistory(builder.build(), Integer.parseInt(revisionNumber));
}
use of io.fabric8.kubernetes.api.model.Context in project fabric8-maven-plugin by fabric8io.
the class PrometheusEnricherTest method testNoDefinedPrometheusPort.
@Test
public void testNoDefinedPrometheusPort() throws Exception {
final ProcessorConfig config = new ProcessorConfig(null, null, Collections.singletonMap(PrometheusEnricher.ENRICHER_NAME, new TreeMap()));
final BuildImageConfiguration imageConfig = new BuildImageConfiguration.Builder().build();
// Setup mock behaviour
new Expectations() {
{
context.getConfig();
result = config;
imageConfiguration.getBuildConfiguration();
result = imageConfig;
context.getImages();
result = Arrays.asList(imageConfiguration);
}
};
PrometheusEnricher enricher = new PrometheusEnricher(context);
Map<String, String> annotations = enricher.getAnnotations(Kind.SERVICE);
assertNull(annotations);
}
use of io.fabric8.kubernetes.api.model.Context in project fabric8-maven-plugin by fabric8io.
the class DockerRegistrySecretEnricherTest method testDockerRegistryWithBadAnnotation.
@Test
public void testDockerRegistryWithBadAnnotation() {
DockerRegistrySecretEnricher enricher = new DockerRegistrySecretEnricher(context);
new Expectations() {
{
{
context.getSettings();
returns(new Settings());
}
}
};
KubernetesListBuilder builder = new KubernetesListBuilder();
Secret secret = createBaseSecret(true);
secret.getMetadata().getAnnotations().put(annotation, "docker1.io");
builder.addToSecretItems(createBaseSecret(true));
KubernetesList expected = builder.build();
enricher.addMissingResources(builder);
assertEquals(expected, builder.build());
}
Aggregations