use of org.testcontainers.utility.Base58 in project testcontainers-java by testcontainers.
the class GenericContainerRuleTest method createContainerCmdHookTest.
@Test
public void createContainerCmdHookTest() {
// Use random name to avoid the conflicts between the tests
String randomName = Base58.randomString(5);
try (GenericContainer container = new GenericContainer<>("redis:3.0.2").withCommand("redis-server", "--help").withCreateContainerCmdModifier(cmd -> cmd.withName("overrideMe")).withCreateContainerCmdModifier(cmd -> cmd.withName(randomName)).withCreateContainerCmdModifier(cmd -> cmd.withCmd("redis-server", "--port", "6379"))) {
container.start();
assertEquals("Name is configured", "/" + randomName, container.getContainerInfo().getName());
assertEquals("Command is configured", "[redis-server, --port, 6379]", Arrays.toString(container.getContainerInfo().getConfig().getCmd()));
}
}
Aggregations