-
-
Notifications
You must be signed in to change notification settings - Fork 337
Description
Problem
Currently, Testcontainers for .NET does not provide any built-in support for LDAP services. Developers who need to test applications relying on directory services like OpenLDAP or Active Directory must manually configure containers using the generic TestcontainersBuilder.
In the past week, I implemented a custom LDAP test container from scratch for one of my projects. The process of loading and setting up the LDAP configuration was complicated and prone to bugs, especially for developers without deep knowledge of LDAP protocols and setup details. This increases maintenance overhead and reduces test reliability.
Solution
Initially, implement a basic configuration that provides a ready-to-use OpenLDAP container with default settings (admin user, password, domain, port mapping). Then, gradually develop the module to support configuring organizations, users, groups, and other LDAP entities internally within the container setup.
This approach aims to prevent increased maintenance overhead and reduce test reliability issues by hiding complex LDAP setup details from users and providing sensible defaults out-of-the-box.
var container = new LdapBuilder().Build();
await container.StartAsync();
var ldapConfig = container.GetLdapConnectionConfig();
container.AddOrganization("");
Benefit
- Simplifies LDAP integration testing with a ready-to-use container.
- Reduces setup time and errors for developers.
Alternatives
- Use generic TestcontainersBuilder with manual LDAP setup.
- Use in-memory or mock LDAP servers (less realistic).
Would you like to help contributing this enhancement?
Yes