SIENTIAPDE-1478

Enhance end-to-end tests for PredictionsBatch workflow scenarios

- Updated scenario descriptions and assertions for error handling in prediction exports.
- Introduced new test cases for handling exports with only OPC or PI Web API.
- Refactored existing tests to improve clarity and maintainability, including dynamic data insertion.
- Adjusted workflow input configurations to better reflect expected behaviors for various error scenarios.
This commit is contained in:
vitor-aignosi
2026-01-16 10:38:08 -03:00
parent 0cd6ae660a
commit 6b9bb38968
3 changed files with 374 additions and 898 deletions

View File

@@ -326,48 +326,6 @@ The `predictions_batch` workflow:
---
### 2.4 Error Scenarios
#### Scenario 2.4.1: MLFlow Transform API Error
**Description**: MLFlow transform request fails
**Input**:
- Valid input data
- MLFlow service unavailable or returns error
**Expected Behavior**:
- `request_transform` raises exception
- Notification sent with MLFlow error details
- Workflow fails after retry attempts
**Assertions**:
- Exception raised from transform activity
- Error notification sent
- Workflow fails
- Export NOT called
---
#### Scenario 2.4.2: MLFlow Predict API Error
**Description**: MLFlow predict request fails
**Input**:
- Valid input and transform data
- MLFlow predict service unavailable
**Expected Behavior**:
- `request_predict` raises exception
- Notification sent
- Workflow fails after retries
**Assertions**:
- Transform succeeded
- Predict raised exception
- Error notification sent
- Workflow fails
---
## 3. Format and Export Prediction - Child Workflow Scenarios
### 3.1 Success Scenarios
@@ -376,7 +334,7 @@ The `predictions_batch` workflow:
**Description**: Error prediction path creates default prediction
**Input**:
- `path_flag: 'STOP'` or other non-None value
- `path_flag: 'ERROR'` or other non-None value (not STOP/CONTINUE/REPEAT)
- `comment` provided with error details
**Expected Behavior**:
@@ -396,7 +354,53 @@ The `predictions_batch` workflow:
---
#### Scenario 3.1.2: Export Without Optional Outputs
#### Scenario 3.1.2: Export with OPC only
**Description**: Export to PostgreSQL and OPC server only (no PI Web API)
**Input**:
- `path_flag: None`
- `opc_output_config` configured with valid OPC settings
- `pi_web_api_output_config: None` or `{}`
**Expected Behavior**:
- Normal formatting
- PostgreSQL export executed
- OPC export executed
- PI Web API activity skipped
- Metrics written with OPC metrics
**Assertions**:
- PI Web API activity NOT called
- OPC activity called
- PostgreSQL export called
- Metrics written with `opc_metrics` populated
---
#### Scenario 3.1.3: Export with PI Web API only
**Description**: Export to PostgreSQL and PI Web API only (no OPC)
**Input**:
- `path_flag: None`
- `pi_web_api_output_config` configured with valid PI Web API settings
- `opc_output_config: None` or `{}`
**Expected Behavior**:
- Normal formatting
- PostgreSQL export executed
- PI Web API export executed
- OPC activity skipped
- Metrics written without OPC metrics
**Assertions**:
- OPC activity NOT called
- PI Web API activity called
- PostgreSQL export called
- Metrics written with empty `opc_metrics`
---
#### Scenario 3.1.4: Export Without Optional Outputs
**Description**: Export only to PostgreSQL (no OPC or PI Web API)
**Input**:
@@ -418,12 +422,14 @@ The `predictions_batch` workflow:
---
#### Scenario 3.1.3: Export Without Transformed Data
#### Scenario 3.1.5: Export Without Transformed Data
**Description**: Only prediction exported, no transform table
**Input**:
- `path_flag: None`
- `transformed_data: None`
- `transformed_data: None` or `save_transform: False`
- `opc_output_config: None` or `{}`
- `pi_web_api_output_config: None` or `{}`
**Expected Behavior**:
- Only prediction formatted and exported