Testing Strategy & Environment Setup
Relevant source files
The following files were used as context for generating this wiki page:
The testing strategy for the flext-oracle-oic extension focuses on ensuring robust integration with Oracle Integration Cloud (OIC) through rigorous validation of configurations, models, and service interfaces. The strategy employs a layered approach, utilizing unit tests to verify individual components such as Pydantic settings and data models, while maintaining environmental consistency through standardized configuration management.
The environment setup is driven by a unified settings pattern, allowing developers to switch between development, testing, and production environments using environment variables and deterministic configuration builders. This ensures that the application behaves predictably across different deployment stages, adhering to the project's quality gates and engineering principles.
Sources: src/flext_oracle_oic/settings.py, tests/unit/test_config.py, README.md
Test Architecture and Categories
The project uses pytest as its primary testing framework, supported by a variety of plugins for coverage, environment management, and mocking. The tests are organized into specific markers to allow for granular execution.
Test Markers
| Marker | Description |
|---|---|
unit | Tests for individual functions, classes, and logic in isolation. |
integration | Tests verifying the interaction between internal modules and Oracle services. |
docker | Tests requiring a Docker environment for containerized dependencies. |
e2e | End-to-end integration tests covering full operation flows. |
performance | Benchmarks and performance-related verification. |
Sources: pyproject.toml:500-515, tests/unit/test_basic.py
Testing Workflow
The following diagram illustrates the flow from code changes to validated state using the configured quality gates.
The workflow ensures that every change meets the root cause fixing and zero-tolerance policies defined in the universal agent law.
Sources: pyproject.toml:500-550, AGENTS.md
Configuration and Environment Setup
Environment setup is managed via the FlextOracleOicSettings class, which utilizes Pydantic for validation and environment variable loading.
Environment Variable Management
All settings are prefixed with FLEXT_ORACLE_OIC_. The configuration system supports deterministic development setup through the create_for_development method.
# Example of deterministic development setup
settings = FlextOracleOicSettings.create_for_development()
# Sources: [src/flext_oracle_oic/settings.py:46-51]
Key Configuration Parameters
| Parameter | Default Value | Description |
|---|---|---|
base_url | https://localhost.integration.ocp.oraclecloud.com | The OIC instance endpoint. |
api_version | v1 | Target OIC REST API version. |
request_timeout | 60 | Network request timeout in seconds. |
verify_ssl | True | Whether to verify SSL certificates. |
enable_monitoring | True | Flag to enable health check and metric utilities. |
Sources: src/flext_oracle_oic/settings.py:27-44, src/flext_oracle_oic/constants.py:75-80
Data Model Validation
A significant portion of the testing strategy involves validating the data structures used to communicate with OIC. Tests verify both successful creation and failure modes for various configuration models.
Authentication and Connection Models
Tests ensure that OICAuthConfig and OICConnectionConfig correctly handle sensitive data like client secrets and validate required fields.
Validation Logic
The FlextOracleOicUtilitiesOracleOic class provides static methods to validate integration names, versions, and statuses against defined constraints.
- Integration Name: Must match
^[a-zA-Z0-9_\-\s]+$and be between 1-100 characters. - Version Format: Must follow the
XX.XX.XXXXpattern. - Status: Validated against a fixed set including
ACTIVATED,DRAFT, andERROR.
Sources: src/flext_oracle_oic/constants.py:182-205, src/flext_oracle_oic/_utilities/oracle_oic.py:118-164
Execution Environment Requirements
The project targets Python 3.13 and uses hatchling as the build backend. Development dependencies include tools for linting (ruff), type checking (mypy, pyright), and code formatting (black).
Tooling Integration
- Ruff: Enforces coding standards and linting rules.
- MyPy/PyRight: Ensures type safety across the extension and its tests.
- Coverage: Configured to fail if coverage drops below 25%, aiming for comprehensive reporting of missing lines.
Sources: pyproject.toml:25-150, pyproject.toml:230-260
Conclusion
The testing strategy for flext-oracle-oic combines strict Pydantic model validation with a flexible configuration system. By utilizing a multi-layered approach of unit and integration tests, backed by a standardized environment setup, the project ensures high reliability and maintainability for its Oracle Integration Cloud extensions.