use of io.fabric8.kubernetes.api.model.Context in project fabric8-maven-plugin by fabric8io.
the class DockerRegistrySecretEnricherTest method testDockerRegistry.
@Test
public void testDockerRegistry() {
new Expectations() {
{
{
context.getSettings();
result = createSettings();
}
}
};
DockerRegistrySecretEnricher enricher = new DockerRegistrySecretEnricher(context);
KubernetesListBuilder builder = new KubernetesListBuilder();
builder.addToSecretItems(createBaseSecret(true));
enricher.addMissingResources(builder);
KubernetesListBuilder expectedBuilder = new KubernetesListBuilder();
Secret expectedSecret = createBaseSecret(false);
expectedSecret.getData().put(SecretConstants.DOCKER_DATA_KEY, "eyJkb2NrZXIuaW8iOnsicGFzc3dvcmQiOiJwYXNzd29yZCIsImVtYWlsIjoiZm9vQGZvby5jb20iLCJ1c2VybmFtZSI6InVzZXJuYW1lIn19");
expectedBuilder.addToSecretItems(expectedSecret);
assertEquals(expectedBuilder.build(), builder.build());
}
use of io.fabric8.kubernetes.api.model.Context in project fabric8-maven-plugin by fabric8io.
the class JavaRunGeneratorTest method fromSelector.
@Test
public void fromSelector() throws IOException {
Object[] data = { "3.1.123", PlatformMode.kubernetes, null, "java.upstream.docker", "3.1.redhat-101", PlatformMode.kubernetes, null, "java.redhat.docker", "3.1.123", PlatformMode.openshift, OpenShiftBuildStrategy.docker, "java.upstream.docker", "3.1.redhat-101", PlatformMode.openshift, OpenShiftBuildStrategy.docker, "java.redhat.docker", "3.1.123", PlatformMode.openshift, OpenShiftBuildStrategy.s2i, "java.upstream.s2i", "3.1.redhat-101", PlatformMode.openshift, OpenShiftBuildStrategy.s2i, "java.redhat.s2i" };
Properties imageProps = getDefaultImageProps();
for (int i = 0; i < data.length; i += 4) {
prepareExpectation((String) data[i], (PlatformMode) data[i + 1], (OpenShiftBuildStrategy) data[i + 2]);
final GeneratorContext context = ctx;
FromSelector selector = new FromSelector.Default(context, "java");
String from = selector.getFrom();
assertEquals(imageProps.getProperty((String) data[i + 3]), from);
}
}
use of io.fabric8.kubernetes.api.model.Context in project fabric8-maven-plugin by fabric8io.
the class EnricherManagerTest method enrichSimple.
@Test
public void enrichSimple() {
new Expectations() {
{
context.getConfig();
result = new ProcessorConfig(Arrays.asList("fmp-project"), null, new HashMap<String, TreeMap>());
}
};
EnricherManager manager = new EnricherManager(null, context);
KubernetesListBuilder builder = new KubernetesListBuilder();
builder.addNewReplicaSetItem().withNewSpec().withNewTemplate().withNewSpec().addNewContainer().withName("test").withImage("busybox").endContainer().endSpec().endTemplate().endSpec().endReplicaSetItem();
manager.enrich(builder);
KubernetesList list = builder.build();
assertEquals(1, list.getItems().size());
ReplicaSet pod = (ReplicaSet) list.getItems().get(0);
ObjectMeta metadata = pod.getMetadata();
assertNotNull(metadata);
Map<String, String> labels = metadata.getLabels();
assertNotNull(labels);
assertEquals("fabric8", labels.get("provider"));
}
use of io.fabric8.kubernetes.api.model.Context in project fabric8-maven-plugin by fabric8io.
the class EnricherManagerTest method createDefaultResources.
@Test
public void createDefaultResources() {
new Expectations() {
{
context.getConfig();
result = new ProcessorConfig(Arrays.asList("fmp-controller"), null, null);
context.getImages();
result = new ImageConfiguration.Builder().alias("img1").name("img1").build();
}
};
EnricherManager manager = new EnricherManager(null, context);
KubernetesListBuilder builder = new KubernetesListBuilder();
manager.createDefaultResources(builder);
assertTrue(builder.build().getItems().size() > 0);
}
use of io.fabric8.kubernetes.api.model.Context in project strimzi by strimzi.
the class KafkaAssemblyOperatorTest method testUpdateKafkaClusterScaleUp.
@Test
public void testUpdateKafkaClusterScaleUp(TestContext context) {
ConfigMap clusterCm = getConfigMap("bar");
clusterCm.getData().put(KafkaCluster.KEY_REPLICAS, "4");
updateCluster(context, getConfigMap("bar"), clusterCm, false, false);
}
Aggregations