Module
None
Problem
Will request here at with the ministack. Below is my current implementation using generic containers but would like to see an official module for java/springboot ideally with the ServiceConnection support.
Solution
Another localstack that has a testcontainers module but lacking ServiceConnection
@Bean
@Profile("ministack")
public GenericContainer<?> miniStackContainer(){
log.info("About to request Testcontainers for MiniStack (Dynamodb)");
GenericContainer<?> miniStack = new GenericContainer<>(
DockerImageName.parse("ministackorg/ministack:latest"))
.withExposedPorts(4566)
.waitingFor(Wait.forLogMessage(".*running on.*", 1));
miniStack.start();
log.info("Testcontainers for MiniStack - STARTED");
return miniStack;
}
@Bean
@Profile("ministack")
public DynamicPropertyRegistrar miniStackPropertiesRegistrar(@Qualifier("miniStackContainer") GenericContainer<?> miniStackContainer) {
return registry -> {
var url = String.format("http://%s:%s", miniStackContainer.getHost(),miniStackContainer.getMappedPort(4566));
registry.add("spring.cloud.aws.region.static", () -> "us-east-1");
registry.add("spring.cloud.aws.credentials.access-key",() -> "test");
registry.add("spring.cloud.aws.credentials.secret-key", () -> "test");
registry.add("spring.cloud.aws.dynamodb.endpoint",()-> url);
};
}
Benefit
Given localstack is removing the free account model looking for a drop in alternates to keep existing testcontainers tests and local development support working.
Alternatives
@Bean
@Profile("floci")
public FlociContainer flociContainer(){
log.info("About to request Testcontainers for Floci (Dynamodb)");
var floci = new FlociContainer();
floci.start();
log.info("Testcontainers for Floci - STARTED");
return floci;
}
@Bean
@Profile("floci")
public DynamicPropertyRegistrar flociPropertiesRegistrar(FlociContainer floci) {
return registry -> {
registry.add("spring.cloud.aws.region.static", floci::getRegion);
registry.add("spring.cloud.aws.credentials.access-key", floci::getAccessKey);
registry.add("spring.cloud.aws.credentials.secret-key", floci::getSecretKey);
registry.add("spring.cloud.aws.dynamodb.endpoint", floci::getEndpoint);
};
}
Would you like to help contributing this feature?
Yes
Module
None
Problem
Will request here at with the ministack. Below is my current implementation using generic containers but would like to see an official module for java/springboot ideally with the ServiceConnection support.
Solution
Another localstack that has a testcontainers module but lacking ServiceConnection
Benefit
Given localstack is removing the free account model looking for a drop in alternates to keep existing testcontainers tests and local development support working.
Alternatives
Would you like to help contributing this feature?
Yes