use of io.fabric8.maven.docker.config.CopyConfiguration.Builder in project fabric8-maven-plugin by fabric8io.
the class InitContainerHandlerTest method existingDifferent.
@Test
public void existingDifferent() {
try {
PodTemplateSpecBuilder builder = getPodTemplateBuilder("blub", "foo/bla");
assertTrue(handler.hasInitContainer(builder, "blub"));
JSONObject initContainer = createInitContainer("blub", "foo/blub");
handler.appendInitContainer(builder, initContainer);
fail();
} catch (IllegalArgumentException exp) {
assertTrue(exp.getMessage().contains("blub"));
}
}
use of io.fabric8.maven.docker.config.CopyConfiguration.Builder in project fabric8-maven-plugin by fabric8io.
the class InitContainerHandlerTest method existingSame.
@Test
public void existingSame() {
new Expectations() {
{
log.warn(anyString, withSubstring("blub"));
}
};
PodTemplateSpecBuilder builder = getPodTemplateBuilder("blub", "foo/blub");
assertTrue(handler.hasInitContainer(builder, "blub"));
JSONObject initContainer = createInitContainer("blub", "foo/blub");
handler.appendInitContainer(builder, initContainer);
assertTrue(handler.hasInitContainer(builder, "blub"));
verifyBuilder(builder, initContainer);
}
use of io.fabric8.maven.docker.config.CopyConfiguration.Builder in project fabric8-maven-plugin by fabric8io.
the class InitContainerHandlerTest method verifyBuilder.
private void verifyBuilder(PodTemplateSpecBuilder builder, JSONObject... initContainers) {
PodTemplateSpec spec = builder.build();
String containers = spec.getMetadata().getAnnotations().get(InitContainerHandler.INIT_CONTAINER_ANNOTATION);
if (initContainers.length == 0) {
assertNull(containers);
} else {
JSONArray got = new JSONArray(containers);
assertEquals(got.length(), initContainers.length);
for (int i = 0; i < initContainers.length; i++) {
assertTrue(JSONUtil.equals(got.getJSONObject(i), initContainers[i]));
}
}
}
use of io.fabric8.maven.docker.config.CopyConfiguration.Builder in project fabric8-maven-plugin by fabric8io.
the class InitContainerHandlerTest method append.
@Test
public void append() {
PodTemplateSpecBuilder builder = getPodTemplateBuilder("bla", "foo/bla");
assertFalse(handler.hasInitContainer(builder, "blub"));
JSONObject initContainer = createInitContainer("blub", "foo/blub");
handler.appendInitContainer(builder, initContainer);
assertTrue(handler.hasInitContainer(builder, "blub"));
verifyBuilder(builder, createInitContainer("bla", "foo/bla"), initContainer);
}
use of io.fabric8.maven.docker.config.CopyConfiguration.Builder in project fabric8-maven-plugin by fabric8io.
the class InitContainerHandlerTest method simple.
@Test
public void simple() {
PodTemplateSpecBuilder builder = getPodTemplateBuilder();
assertFalse(handler.hasInitContainer(builder, "blub"));
JSONObject initContainer = createInitContainer("blub", "foo/blub");
handler.appendInitContainer(builder, initContainer);
assertTrue(handler.hasInitContainer(builder, "blub"));
verifyBuilder(builder, initContainer);
}
Aggregations