Add support for creating a container from a TestImage value

This commit improves TestImage so that an explicit image can trigger
the creation of the container, with optional additional setup. This
removes the need of creating additional container types for images that
have multiple flavors, and to please the static method that can only
create a container based on a single match.

Closes gh-51082
This commit is contained in:
Stéphane Nicoll
2026-09-08 16:46:48 +02:00
parent f956f588d5
commit b1e91c942e
125 changed files with 201 additions and 356 deletions
@@ -47,7 +47,7 @@ class LLdapContainerConnectionDetailsFactoryIntegrationTests {
@Container
@ServiceConnection
static final LLdapContainer lldap = TestImage.container(LLdapContainer.class);
static final LLdapContainer lldap = TestImage.forContainer(LLdapContainer.class);
@Autowired
private LdapTemplate ldapTemplate;
@@ -47,7 +47,8 @@ class OpenLdapContainerConnectionDetailsFactoryIntegrationTests {
@Container
@ServiceConnection
static final OpenLdapContainer openLdap = TestImage.container(OpenLdapContainer.class).withEnv("LDAP_TLS", "false");
static final OpenLdapContainer openLdap = TestImage.forContainer(OpenLdapContainer.class)
.withEnv("LDAP_TLS", "false");
@Autowired
private LdapTemplate ldapTemplate;