Integration Testing
Relevant source files
The following files were used as context for generating this wiki page:
Integration testing in the flext-ldap project is designed to validate the library's ability to communicate with live LDAP environments. The primary focus is ensuring that the ldap API facade correctly orchestrates connections and operations against real server instances, moving beyond mocked unit tests to verify protocol compliance and network reliability. Sources: tests/integration/test_smoke.py:1-12, examples/README.md:160-165
The project adheres to a "100% REAL, NO MOCKS" philosophy for integration and smoke testing, ensuring that critical requirements like API usability, parameterization, and server detection are validated against actual Docker-based LDAP containers (OpenLDAP and Oracle Unified Directory). Sources: tests/integration/test_smoke.py:1-5, examples/README.md:273-280, AGENTS.md:120-125
Testing Infrastructure
The integration test suite relies on a containerized infrastructure to provide reproducible LDAP environments. These environments are typically managed via Docker Compose and include pre-configured directory structures. Sources: examples/README.md:68-75, tests/constants.py:108-115
Docker Environment Configuration
Test environments are defined using specific constants and configuration files to ensure consistency across different developer machines and CI/CD pipelines.
| Parameter | Value / Source | Description |
|---|---|---|
| Container Name | flext-openldap-test | The default OpenLDAP test container. |
| Compose File | docker/docker-compose.openldap.yml | Path to the orchestration file. |
| Default Port | 3390 | Host port mapped to the LDAP service. |
| Admin DN | cn=admin,dc=flext,dc=local | Administrative credentials for testing. |
| Startup Timeout | 90 seconds | Buffer for container readiness. |
Sources: tests/constants.py:108-120, examples/README.md:295-300
Integration Workflow
The integration process follows a sequence of establishing connectivity, performing operations, and validating results against the live directory state.
Smoke Testing
Smoke tests serve as the first line of defense, verifying that the core ldap API can successfully bind to a container and retrieve basic server information.
Connectivity Verification
The TestsFlextLdapSmoke class utilizes the ldap_container fixture to verify that:
- The LDAP container is responsive to
ldap3protocol requests. - The
ldapAPI facade imports and initializes correctly. - Server metadata (RootDSE) is accessible after a successful bind.
Sources: tests/integration/test_smoke.py:27-46, tests/unit/test_ldap3_adapter.py:46-55
Basic Operations Test
This test validates the end-to-end flow using the primary library interface.
def test_flext_ldap_basic_connection(
self,
ldap_container: t.MappingKV[str, t.Scalar],
) -> None:
client = ldap
conn_config = u.Ldap.Tests.create_connection_config(ldap_container)
result = client.connect(conn_config)
u.Ldap.Tests.assert_connection_success(result)
client.disconnect()
Sources: tests/integration/test_smoke.py:48-59
Comprehensive Validation
Beyond simple smoke tests, the project includes comprehensive validation scripts that test the API against large datasets (~1000 entries). These validations target four critical areas: Sources: examples/README.md:274-285
- API Usability: Ensuring direct method calls, context managers, and batch operations function as expected.
- Parameterization: Validating that all
SearchRequestfields and configuration overrides are respected. - Schema Support: Testing compatibility with various object classes (person, group, inetOrgPerson, etc.).
- Server Accuracy: Confirming the library correctly detects server types (OpenLDAP vs. OUD) and their respective capabilities.
Sources: examples/README.md:275-290, tests/constants.py:138-150
Multi-Server Compatibility Matrix
Integration tests are executed against different server implementations to ensure universal compatibility.
| Server Type | Target Port | Base DN | Validation Focus |
|---|---|---|---|
| OpenLDAP | 3390 | dc=flext,dc=local | RFC compliance, standard schemas |
| Oracle OUD | 3489 | dc=flext,dc=local | Oracle-specific features, ACI management |
Sources: examples/README.md:291-300, examples/README.md:325-335, tests/constants.py:145-155
Quality Gates and Standards
Integration tests are governed by strict quality gates defined in the project configuration. These gates include mandatory execution of make test and make val verbs, which trigger the integration suite. Sources: README.md:28-32, pyproject.toml:440-460
- Continuous Green: No completion is allowed if the integrated environment is broken. Sources: AGENTS.md:70-75
- Zero Mocks in Integration: Strictly enforced for files within the
tests/integration/directory to ensure runtime reality precedes implementation assertions. Sources: tests/integration/test_smoke.py:1-5, AGENTS.md:120-125
Summary
Integration testing in flext-ldap ensures that the library's Clean Architecture and Domain-Driven Design patterns successfully translate to real-world LDAP operations. By utilizing Docker-based environments and avoiding mocks in integration suites, the project guarantees that its facade provides a reliable, typed interface for enterprise directory services. Sources: examples/README.md:20-30, tests/integration/test_smoke.py:1-10