Search in sources :

Example 1 with LogConfiguration

use of com.amazonaws.services.ecs.model.LogConfiguration in project gocd-ecs-elastic-agent by gocd.

the class ContainerDefinitionBuilderTest method shouldBuildContainerDefinition.

@Test
void shouldBuildContainerDefinition() {
    final LogConfiguration logConfiguration = new LogConfiguration().withLogDriver("awslog").withOptions(Collections.singletonMap("group", "foo"));
    when(elasticAgentProfileProperties.getImage()).thenReturn("alpine");
    when(elasticAgentProfileProperties.getMaxMemory()).thenReturn(2048);
    when(elasticAgentProfileProperties.getReservedMemory()).thenReturn(1024);
    when(elasticAgentProfileProperties.getCommand()).thenReturn(Arrays.asList("ping x.x.x.x", "-c", "160"));
    when(pluginSettings.logConfiguration()).thenReturn(logConfiguration);
    ContainerDefinitionBuilder builder = new ContainerDefinitionBuilder().withName("foo").pluginSettings(pluginSettings).createAgentRequest(createAgentRequest);
    final ContainerDefinition containerDefinition = builder.build();
    assertThat(containerDefinition.getName()).isEqualTo("foo");
    assertThat(containerDefinition.getImage()).isEqualTo("alpine:latest");
    assertThat(containerDefinition.getMemory()).isEqualTo(2048);
    assertThat(containerDefinition.getMemoryReservation()).isEqualTo(1024);
    assertThat(containerDefinition.getCommand()).contains("ping x.x.x.x", "-c", "160");
    assertThat(containerDefinition.getLogConfiguration()).isEqualTo(logConfiguration);
}
Also used : ContainerDefinition(com.amazonaws.services.ecs.model.ContainerDefinition) LogConfiguration(com.amazonaws.services.ecs.model.LogConfiguration) Test(org.junit.jupiter.api.Test)

Aggregations

ContainerDefinition (com.amazonaws.services.ecs.model.ContainerDefinition)1 LogConfiguration (com.amazonaws.services.ecs.model.LogConfiguration)1 Test (org.junit.jupiter.api.Test)1