mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-11 14:00:29 +00:00
c1bf03fe39
Fixes panic: assignment to entry in nil map in PMG polling tests. **Problem:** Tests were manually creating Monitor structs without initializing internal maps like pollStatusMap, causing nil map panics when recordTaskResult() tried to update task status. **Root Cause:** - TestPollPMGInstancePopulatesState (line 90) - TestPollPMGInstanceRecordsAuthFailures (line 189) Both created Monitor with only partial field initialization, missing: - pollStatusMap - dlqInsightMap - instanceInfoCache - Other internal state maps **Solution:** Changed both tests to use New() constructor which properly initializes all maps and internal state (monitor.go:1541). This ensures tests match production initialization and will automatically pick up any future map additions. **Tests:** ✅ TestPollPMGInstancePopulatesState - now passes ✅ TestPollPMGInstanceRecordsAuthFailures - now passes ✅ All monitoring tests pass (0.125s) Follows best practice: use constructors instead of manual struct creation to maintain initialization invariants.