rcourtman
36d6279107
test: Add DiscoveryConfig UnmarshalJSON tests
...
Cover invalid JSON error path, modern field parsing, legacy field
parsing, and empty object default handling.
Coverage: 60% → 88.9%
2025-12-02 02:29:38 +00:00
rcourtman
d873d68dcc
test: Add ProcessQueuedNotification error path tests
...
Cover invalid config JSON for email, webhook, and apprise types,
plus unknown notification type handling.
Coverage: 63.3% → 83.3%
2025-12-02 02:26:25 +00:00
rcourtman
c812720f25
test: Add Disk UnmarshalJSON RPM and error path tests
...
Cover RPM field handling (numeric, string, SSD, N/A, null, invalid),
invalid JSON error path, and unexpected type fallbacks for both
wearout and RPM fields.
Coverage: 50% → 95.5%
2025-12-02 02:23:44 +00:00
rcourtman
5bd018277f
test: Add sendNotificationsDirect tests
...
Cover disabled paths: all channels disabled, webhook disabled,
multiple webhooks with mixed enabled state.
Coverage: 44.4% → 66.7%
2025-12-02 02:21:46 +00:00
rcourtman
251b252062
test: Add sendHTMLEmailWithError tests
...
Cover email sending paths: empty To uses From as recipient,
nil email manager creates new one, existing manager config updates.
Coverage: 57.9% → 89.5%
2025-12-02 02:19:49 +00:00
rcourtman
645173ec22
test: Add sendGroupedApprise error path tests
...
Add 3 tests for Apprise notification error handling:
- No alerts returns error
- Not enabled returns error
- Empty payload (all nil alerts) returns error
Coverage: 56.2% → 75.0%
2025-12-02 02:14:13 +00:00
rcourtman
e32621040a
test: Add describeInstancesForScheduler tests
...
Add 6 tests for instance descriptor generation:
- No clients returns nil
- PVE only with sorted order
- PBS only
- PMG only
- All types combined
- Nil scheduler/stalenessTracker safety
Coverage: 60.7% → 62.5%
2025-12-02 02:11:14 +00:00
rcourtman
24ae84671f
test: Add handleHealth method tests
...
Add 2 tests for health endpoint:
- POST/PUT/DELETE/PATCH return 405 Method Not Allowed
- HEAD is allowed (same as GET)
Coverage: 50% → 83.3%
2025-12-02 02:09:04 +00:00
rcourtman
09b87c0dea
test: Add recordTaskResult tests
...
Add 6 tests for polling task result recording:
- Nil monitor safety check
- Success case resets counters
- Failure case increments counters
- Consecutive failures tracking
- Success resets failure state
- Nil internal maps don't panic
Coverage: 53.7% → 97.6%
2025-12-02 02:06:08 +00:00
rcourtman
d697633fed
test: Add ApplyHostReport error path tests
...
Add 4 tests for error and edge cases:
- Missing hostname returns error
- Whitespace-only hostname returns error
- Nil hostTokenBindings map is initialized
- Fallback identifier generation
Coverage: 63.7% → 70.8%
2025-12-02 02:03:03 +00:00
rcourtman
9fa8c2e752
test: Add ApplyDockerReport error path tests
...
Add 4 tests for error conditions:
- Missing identifier (no agent ID or hostname)
- Removed host rejection
- Token bound to different agent
- Missing hostname
Coverage: 63.0% → 69.5%
2025-12-02 02:00:06 +00:00
rcourtman
df4a596e8b
test: Add RemoveHostAgent error path tests
...
Add 4 tests for uncovered branches:
- Empty/whitespace hostID returns error
- Host not found returns synthetic host
- No token binding (token exists but not bound)
- Nil alertManager doesn't panic
Coverage: 64.3% → 78.6%
2025-12-02 01:56:50 +00:00
rcourtman
836303755f
test: Add adminBypassEnabled tests
...
Add 5 tests to cover all branches:
- Not requested (ALLOW_ADMIN_BYPASS != "1")
- Enabled with PULSE_DEV=true
- Enabled with NODE_ENV=development
- Case-insensitive NODE_ENV check
- Declined when outside dev mode
Coverage: 40% → 100%
2025-12-02 01:53:55 +00:00
rcourtman
677d4417aa
test: Add loadTrustedProxyCIDRs tests
...
Cover invalid CIDR, invalid IP, IPv6, and empty entry handling (48% to 100%)
2025-12-02 01:48:41 +00:00
rcourtman
daa11a072c
test: Add LogAuditEvent tests
...
Cover success and failure logging branches (66.7% to 100%)
2025-12-02 01:46:27 +00:00
rcourtman
b9578b0665
test: Add SecurityHeadersWithConfig tests
...
Cover all CSP/X-Frame-Options embedding configurations (57.1% to 100%)
2025-12-02 01:44:22 +00:00
rcourtman
72fd885677
test: Add filesystem error tests for SessionStore
...
Cover saveUnsafe (57.9% to 89.5%) and load (55.6% to 74.1%) error paths
2025-12-02 01:40:54 +00:00
rcourtman
cd1420a085
test: Add filesystem error tests for CSRFTokenStore
...
Cover saveUnsafe (57.9% to 89.5%) and load (50.0% to 67.9%) error paths
2025-12-02 01:38:49 +00:00
rcourtman
eadd8442bb
test: Add filesystem error tests for RecoveryTokenStore.saveUnsafe
...
Cover MkdirAll, WriteFile, and Rename error paths (46.7% to 86.7%)
2025-12-02 01:36:21 +00:00
rcourtman
618fc084f1
test: Add invalid user format tests for NewClient
...
Test error handling for password authentication user format validation:
- Missing realm separator (no @)
- Empty user string
- Multiple @ symbols
Improves NewClient coverage from 74.2% to 83.9%.
2025-12-02 01:25:11 +00:00
rcourtman
de33653dc2
test: Add invalid value tests for VMFileSystem.UnmarshalJSON
...
Test error handling for JSON parsing edge cases:
- Invalid JSON syntax
- Unsupported field types (bool, array)
- Unparseable string values for total-bytes and used-bytes
Improves coverage from 83.3% to 94.4%.
2025-12-02 01:22:42 +00:00
rcourtman
79afff8ba2
test: Add invalid value tests for MemoryStatus.UnmarshalJSON
...
Test error handling for JSON parsing edge cases:
- Invalid JSON syntax
- Unsupported field types (bool, array, object)
- Unparseable string values
Improves coverage from 70.0% to 83.3%.
2025-12-02 01:20:15 +00:00
rcourtman
a73dcd51a1
test: Add edge case tests for HandleSetupScript
...
Tests method not allowed, missing type parameter, and invalid host
parameter error paths (71.4% to 79.2% coverage).
2025-12-02 01:11:57 +00:00
rcourtman
87a184137b
test: Add DNS resolution failure test for ValidateWebhookURL
...
Tests the error path when webhook hostname cannot be resolved
(78.1% to 81.2% coverage).
2025-12-02 01:09:03 +00:00
rcourtman
22d9e2795c
test: Add permanent failure test for ClusterClient.GetNodes
...
Tests the error logging path when all endpoints fail with auth error
(83.3% to 91.7% coverage).
2025-12-02 01:05:48 +00:00
rcourtman
5bbf7de1a3
test: Add JSON decode error test for Client.GetNodes
...
Tests the error path when server returns invalid JSON (87.5% to 100%).
2025-12-02 01:03:30 +00:00
rcourtman
13d05cbdc4
test: Add invalid PEM data test for newOIDCHTTPClient
...
Tests the error path when a CA bundle file contains non-PEM data
(81.8% to 86.4% coverage).
2025-12-02 01:00:06 +00:00
rcourtman
8eb195b9ff
test: Add edge cases for UniversalRateLimitMiddleware
...
Cover nil config initialization and static asset bypass paths.
Coverage: UniversalRateLimitMiddleware 87.5% -> 100%
2025-12-02 00:54:37 +00:00
rcourtman
ba03551dba
test: Add edge case for initializeBootstrapToken error path
...
Cover loadOrCreateBootstrapToken failure path.
Coverage: initializeBootstrapToken 92% -> 100%
2025-12-02 00:51:44 +00:00
rcourtman
475575212d
test: Add edge cases for HandleLookup error paths
...
Cover method-not-allowed and missing lookup parameter paths.
Coverage: HandleLookup 88.4% -> 97.7%
2025-12-02 00:49:16 +00:00
rcourtman
4e90e6efb2
test: Add critical-only grouped alert template case
...
Test multiple critical alerts without warnings to cover the
"critical > 0" only branch in subject line generation.
Coverage: 97.7% → 100%
2025-12-02 00:40:02 +00:00
rcourtman
6c21af6e3d
test: Add edge cases for buildApprisePayload
...
- Test nil alerts in list are filtered out
- Test all-nil alert list returns empty
- Test multiple alerts changes title format
Coverage: 88.9% → 100%
2025-12-02 00:37:28 +00:00
rcourtman
eb46942a40
test: Add edge case for extractTelegramChatID URL parse error
...
Test URL with control characters triggers url.Parse error path.
Coverage: 92.9% → 100%
2025-12-02 00:31:50 +00:00
rcourtman
b326580780
test: Add edge case for NormalizeAppriseConfig low timeout
...
Test TimeoutSeconds value between 1-4 clamps to minimum of 5.
Coverage: 97.4% → 100%
2025-12-02 00:29:12 +00:00
rcourtman
490fd9a810
test: Add edge cases for parseReplicationJob fields
...
- Test jobid fallback when id field is missing
- Test jobnum field takes precedence over ID parsing
- Test last_sync_duration and duration fields
- Test last-sync-duration fallback format
- Test next_sync and next-sync fallback formats
Coverage: 79.7% → 100%
2025-12-02 00:24:40 +00:00
rcourtman
4c7bcd12d0
test: Add edge cases for normalizeRequestedScopes
...
- Test blank scope identifier returns error
- Test wildcard-only input returns wildcard scope
Coverage: 89.7% → 96.6% (remaining 3.4% is defensive
unreachable code path)
2025-12-02 00:19:20 +00:00
rcourtman
139deb73aa
Filter virtual/system filesystems from host disk display
...
Host disk bars were showing virtual filesystems like tmpfs, /dev, /run,
/sys, and Docker overlay mounts. These clutter the UI and don't represent
meaningful disk usage.
Changed from `shouldIgnoreReadOnlyFilesystem` (read-only only) to the
full `fsfilters.ShouldSkipFilesystem` which also excludes:
- Virtual FS types: tmpfs, devtmpfs, sysfs, proc, cgroup, etc.
- Special mountpoints: /dev, /proc, /sys, /run, /var/lib/docker, /snap
- Network filesystems: fuse, nfs, cifs, etc.
Related to #790
2025-12-02 00:16:39 +00:00
rcourtman
57e97c3ec1
test: Add edge case for ensureSettingsWriteScope valid scope
...
Tests the code path when an API token has the settings:write scope,
which allows the operation to proceed.
2025-12-02 00:13:32 +00:00
rcourtman
49f71015c8
Fix backup indicator being reset when VMs/Containers are re-polled
...
UpdateVMsForInstance and UpdateContainersForInstance were replacing
guest data without preserving the LastBackup field that was populated
by SyncGuestBackupTimes. This caused backup indicators to always show
"no backup found" since the LastBackup would be wiped every time
guests were polled (which happens more frequently than backup polling).
Now both functions preserve LastBackup from existing data when the
incoming guest data has a zero value.
Related to #762
2025-12-02 00:12:31 +00:00
rcourtman
e471001d29
test: Add edge cases for isTrustedProxyIP and GetClientIP
...
Tests empty string, invalid IP, and IP not matching CIDR for
isTrustedProxyIP. Also adds tests for GetClientIP empty RemoteAddr
and X-Real-IP fallback paths.
2025-12-02 00:09:23 +00:00
rcourtman
9d12f9730e
Fix memory bar width showing 100% instead of actual percentage
...
The StackedMemoryBar component was incorrectly calculating segments when
Proxmox balloon was set to maxmem (no actual ballooning). In this case:
- balloon = total (e.g., 32GB)
- used = actual memory (e.g., 20GB)
- active = used - balloon = 20GB - 32GB = 0 (clamped)
- balloonPercent = 32GB/32GB * 100 = 100%
This caused the bar to always show 100% yellow (balloon) even when the
actual memory usage was much lower.
Fixed by only showing balloon segment when actual ballooning is in effect
(balloon > 0 && balloon < total). When there's no ballooning, the bar
now correctly shows used memory as green with the actual percentage.
Related to #788
2025-12-02 00:08:05 +00:00
rcourtman
ad646e3923
test: Add tests for hostAgentSearchCandidates parameter variants
...
Tests all code paths: strict mode (both params), platform only,
and no params (generic paths).
2025-12-02 00:03:19 +00:00
rcourtman
b2a4296557
test: Add edge case for handleServerInfo method not allowed
...
Tests that POST requests to /api/server/info return 405.
2025-12-02 00:01:17 +00:00
rcourtman
a685ba26b4
test: Add edge case for capturePublicURLFromRequest nil inputs
...
Tests the early return paths when router, request, or config are nil.
2025-12-01 23:59:17 +00:00
rcourtman
7cbb5c061d
test: Add edge case for canCapturePublicURL nil inputs
...
Tests the early return paths when config or request are nil.
2025-12-01 23:56:59 +00:00
rcourtman
588665a86f
test: Add edge case for recovery token load read error
...
Tests the error logging path when os.ReadFile fails with an error
other than ErrNotExist. Uses a directory in place of the file.
2025-12-01 23:54:42 +00:00
rcourtman
a3a894b54b
test: Add edge case for writeErrorResponse encode failure
...
Tests the error logging path when json.Encode fails due to a
write error on the ResponseWriter.
2025-12-01 23:52:21 +00:00
rcourtman
80d9d00962
test: Add edge cases for markAutoRegistered empty inputs
...
Tests the early return paths when nodeType or nodeName are empty.
2025-12-01 23:50:10 +00:00
rcourtman
41a7bdf7ff
test: Add edge case for clearBootstrapToken remove failure
...
Tests the warning log path when os.Remove fails with an error other
than ErrNotExist. Uses a directory with contents to trigger ENOTEMPTY.
2025-12-01 23:47:58 +00:00
rcourtman
29e01f8ff5
test: Add edge case for coerceUint64 ParseUint error branch
...
String 'abc' without .eE characters triggers ParseUint error path.
Coverage: 97.4% to 100%.
2025-12-01 23:44:04 +00:00