Skip to content

test: add scanner update rate override for testing#3241

Open
michaelhthomas wants to merge 1 commit into
seerr-team:developfrom
michaelhthomas:test-fixes
Open

test: add scanner update rate override for testing#3241
michaelhthomas wants to merge 1 commit into
seerr-team:developfrom
michaelhthomas:test-fixes

Conversation

@michaelhthomas

@michaelhthomas michaelhthomas commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

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:

  • I have read and followed the contribution guidelines.
  • Disclosed any use of AI (see our policy)
  • I have updated the documentation accordingly.
  • All new and existing tests passed.
  • Successful build pnpm build
  • Translation keys pnpm i18n:extract
  • Database migration (if required)

Summary by CodeRabbit

  • Tests
    • Improved scanner test reliability by allowing scan timing settings to be overridden during test runs.
    • Updated Jellyfin, Radarr, and Sonarr scanner tests to run without update delays, producing faster and more deterministic results.

@michaelhthomas
michaelhthomas requested a review from a team as a code owner July 12, 2026 19:12
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

BaseScanner now supports test-specific timing overrides, and Jellyfin, Radarr, and Sonarr tests configure updateRate to zero during setup.

Changes

Scanner test timing overrides

Layer / File(s) Summary
Expose and apply scanner timing overrides
server/lib/scanners/baseScanner.ts, server/lib/scanners/*/*.test.ts
BaseScanner exposes timing fields to subclasses and adds setTestOverrides; scanner test suites apply an updateRate override of zero before each test.

Estimated code review effort: 2 (Simple) | ~5 minutes

Poem

I’m a small rabbit, hopping in time,
Zero-rate scans now run just fine.
Jellyfin, Radarr, Sonarr in a row,
With tidy test clocks set low.
Nibble, test, and let results grow!

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: a test-only scanner update rate override to speed up scanner tests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
server/lib/scanners/baseScanner.ts (1)

62-63: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep the timing fields private.

setTestOverrides can mutate these fields internally, and the existing getters already expose read-only access to subclasses. Making them protected lets 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

📥 Commits

Reviewing files that changed from the base of the PR and between 5ae70d0 and bf7de2a.

📒 Files selected for processing (4)
  • server/lib/scanners/baseScanner.ts
  • server/lib/scanners/jellyfin/jellyfin.test.ts
  • server/lib/scanners/radarr/radarr.test.ts
  • server/lib/scanners/sonarr/sonarr.test.ts

Comment thread server/lib/scanners/baseScanner.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant