test: add scanner update rate override for testing#3241
Conversation
📝 WalkthroughWalkthrough
ChangesScanner test timing overrides
Estimated code review effort: 2 (Simple) | ~5 minutes Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
server/lib/scanners/baseScanner.ts (1)
62-63: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winKeep the timing fields private.
setTestOverridescan mutate these fields internally, and the existing getters already expose read-only access to subclasses. Making themprotectedlets subclasses bypass validation and assign invalid values directly.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@server/lib/scanners/baseScanner.ts` around lines 62 - 63, Change the bundleSize and updateRate fields in the base scanner class back to private visibility. Keep setTestOverrides responsible for internal mutation and preserve the existing getter-based read-only access for subclasses.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@server/lib/scanners/baseScanner.ts`:
- Around line 795-806: Update BaseScanner.setTestOverrides to validate values
before mutating scanner state: reject bundleSize values that are non-positive or
non-integer, and reject updateRate values that are negative or non-finite.
Preserve existing state when validation fails, and only assign validated
overrides.
---
Nitpick comments:
In `@server/lib/scanners/baseScanner.ts`:
- Around line 62-63: Change the bundleSize and updateRate fields in the base
scanner class back to private visibility. Keep setTestOverrides responsible for
internal mutation and preserve the existing getter-based read-only access for
subclasses.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 66dade10-f5bf-4333-9151-9261fbe33b07
📒 Files selected for processing (4)
server/lib/scanners/baseScanner.tsserver/lib/scanners/jellyfin/jellyfin.test.tsserver/lib/scanners/radarr/radarr.test.tsserver/lib/scanners/sonarr/sonarr.test.ts
Description
The scanner tests are currently pretty slow to run, as they wait for 4 seconds before running the scanner due to the update rate. This can be overridden in tests, which considerably speeds them up.
How Has This Been Tested?
Tests pass.
Screenshots / Logs (if applicable)
Checklist:
pnpm buildpnpm i18n:extractSummary by CodeRabbit