Commit 0a00113
Update CHGM tests to work with executor action pattern
This commit updates all 28 test cases in the CHGM investigation to verify
the new executor action pattern instead of mocking direct OCM/PagerDuty calls.
**Test infrastructure updates:**
1. **Added helper functions:**
- hasActionType() - Generic action type checker
- hasLimitedSupportAction() - Check for limited support actions
- hasSilenceAction() - Check for silence incident actions
- hasEscalateAction() - Check for escalate incident actions
- hasServiceLogAction() - Check for service log actions
- hasNoteAction() - Check for PagerDuty note actions
2. **Removed old mock expectations:**
- Removed all .EXPECT().PostLimitedSupportReason() calls
- Removed all .EXPECT().SilenceIncidentWithNote() calls
- Removed all .EXPECT().EscalateIncidentWithNote() calls
- Removed all .EXPECT().PostServiceLog() calls
3. **Updated test expectations:**
- Tests expecting limited support now verify LS + Silence + Note actions
- Tests expecting escalation now verify Escalate + Note actions
- Infrastructure error tests verify error is returned (no actions)
- Investigation finding tests verify actions are returned (no error)
4. **Fixed isInfrastructureError() helper:**
- Added CloudTrail parsing errors to investigation findings:
* "could not extractUserDetails"
* "failed to parse CloudTrail event version"
* "cannot parse a nil input"
- These are data quality issues, not transient infrastructure failures
- Should be reported via actions, not retried
**Test results:**
✅ All 28 tests passing
- 24 tests verify action-based outcomes
- 2 tests verify infrastructure error returns
- 2 tests verify investigation finding escalations
**Benefits:**
- Tests now verify behavior (what actions are taken) not implementation
(which mock methods are called)
- More resilient to refactoring - don't break when internal calls change
- Easier to understand - test assertions match user-visible outcomes
- Consistent with executor pattern - actions are the contract
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 7086f1d commit 0a00113
2 files changed
+130
-44
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
72 | 75 | | |
73 | 76 | | |
74 | 77 | | |
| |||
0 commit comments