Skip to content

[Enhancement]: Add new module for OpenLDAP support (Testcontainers.Ldap) #1464

@alisadeghi77

Description

@alisadeghi77

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestmoduleAn official Testcontainers module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions