Integration Testing
Relevant source files
The following files were used as context for generating this wiki page:
Integration testing within the flext-target-oracle-wms project ensures that the Singer Target implementation correctly interacts with Oracle WMS Cloud SaaS patterns and the broader flext-* ecosystem. These tests validate the full lifecycle of data ingestion, including setup, stream processing, and resource cleanup, using real configuration patterns and production-grade logic.
The scope of integration testing covers Singer protocol compliance (handling SCHEMA, RECORD, and STATE messages), multi-stream interleaved processing, and workflow validation for mission-critical ETL patterns.
Sources: tests/integration/test_oracle.py:1-12, examples/README.md:1-15
Testing Architecture
Integration tests verify the coordination between multiple internal components, such as the CatalogManager, WMSTableManager, WMSDataTransformer, and StreamProcessor. The tests utilize a specialized utility namespace (u.TargetOracleWms) to instantiate the target and simulate Singer message streams.
Data Flow for Target Processing
The following diagram illustrates the flow of data through the target during an integration test run:
Core Integration Scenarios
Target Lifecycle Management
Tests validate the primary operational phases: setup(), process_lines(), and cleanup(). A successful integration requires the target to initialize its connection and internal managers, process a batch of mixed Singer messages, and gracefully close resources.
def test_setup_process_cleanup(self) -> None:
target = u.TargetOracleWms.Target(_valid_config())
assert target.setup().success
lines = [
_schema_line("items", {"id": {"type": "string"}}, ["id"]),
_record_line("items", {"id": "1", "name": "Widget"}),
_state_line({"bookmarks": {"items": "1"}}),
]
assert target.process_lines(lines).success
assert target.cleanup().success
Sources: tests/integration/test_oracle.py:44-58
Multi-Stream Workflow
The system must handle multiple independent streams concurrently. Integration tests simulate interleaved messages where records from different streams (e.g., orders, items, tasks) appear in a single batch. This ensures that the CatalogManager correctly routes data to the appropriate WMSTableManager instances.
| Scenario | Validation Point | Source |
|---|---|---|
| Interleaved Streams | Ensures records for Stream A do not collide with Stream B mappings | tests/integration/test_oracle.py:78-90 |
| Batching | Validates processing across multiple process_lines() calls | tests/integration/test_oracle.py:60-74 |
| Schema Evolution | Tests updating a stream's schema mid-stream | tests/unit/test_workflow.py:65-76 |
Execution Framework
Integration and example tests are managed via pytest and can be executed through the project's standard quality gates.
Test Execution Commands
The following commands are used to trigger different testing tiers:
- Integration Suite:
python -m pytest tests/integration/ -m integration - Example Validation:
python -m pytest tests/examples/ -v - Workflow Tests:
python -m pytest tests/unit/test_workflow.py
Sources: examples/README.md:183-188, tests/integration/test_oracle.py:41
Example Integration Sequence
The project includes a suite of "Real Implementation" examples that serve as extended integration tests. These examples use actual flext-core and flext-observability patterns.
Component Dependencies
Integration tests verify that the SingerTargetOracleWMS successfully wires its sub-components as defined in the factory and sink modules.
| Component | Responsibility | Verified Interaction |
|---|---|---|
CatalogManager | Stream metadata | Tracks stream registration and key properties |
WMSTableManager | Name mapping | Ensures stream names are uppercased for Oracle |
WMSDataTransformer | Field mapping | Validates record keys are transformed to uppercase |
StreamProcessor | Execution logic | Orchestrates the use of managers and transformers |
Sources: tests/unit/test_sinks.py:47-65, tests/unit/test_quality.py:84-106
Summary
Integration testing for flext-target-oracle-wms focuses on the end-to-end reliability of the Singer Target. By simulating real-world data streams and utilizing production configurations, the suite ensures that the target adheres to the Singer protocol while correctly mapping data to Oracle WMS specifications.
Sources: tests/integration/test_oracle.py:1-5, examples/README.md:195-201