Skip to content

ci: Add integration test timeouts and download progress monitoring#37

Merged
tablackburn merged 3 commits into
mainfrom
ci/integration-test-timeouts
Apr 10, 2026
Merged

ci: Add integration test timeouts and download progress monitoring#37
tablackburn merged 3 commits into
mainfrom
ci/integration-test-timeouts

Conversation

@tablackburn
Copy link
Copy Markdown
Owner

@tablackburn tablackburn commented Apr 10, 2026

Summary

  • Add timeout-minutes: 90 to the integration tests job and timeout-minutes: 75 to the "Run Integration Tests" step to prevent indefinite hangs when Plex server downloads stall
  • Add Start-SyncProgressMonitor / Stop-SyncProgressMonitor helper functions that poll the download destination every 30 seconds and emit [SYNC PROGRESS] lines to CI logs with elapsed time, file count, and total MB
  • Wrap the Sync-PatMedia download and idempotency tests with the progress monitor for CI visibility

Test Plan

  • CI logs show [SYNC PROGRESS] lines during the media download test
  • CI logs show [SYNC COMPLETE] line with total time after download finishes
  • If the download hangs, the step times out at 75 minutes instead of 6 hours
  • All other integration tests remain unaffected

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added a background sync progress monitor with configurable polling intervals to report ongoing download progress and completion.
  • Tests

    • Updated integration tests to start/stop the progress monitor around media sync runs, ensuring progress reporting and proper cleanup even on failure.
  • Chores

    • Added timeout limits to integration test workflows to improve test run reliability.

Add job-level (90 min) and step-level (75 min) timeouts to prevent
integration tests from hanging indefinitely when Plex server downloads
stall on ubuntu runners.

Add Start-SyncProgressMonitor/Stop-SyncProgressMonitor helpers that
poll the destination directory every 30 seconds and emit file count
and total MB to CI logs, giving visibility into download progress.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 10, 2026 07:37
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fc38e56f-47b4-4aab-afda-1c3e33b92d44

📥 Commits

Reviewing files that changed from the base of the PR and between e9a1d72 and c492616.

📒 Files selected for processing (1)
  • .github/workflows/CI.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/CI.yaml

📝 Walkthrough

Walkthrough

Adds job- and step-level timeout settings to the integration-tests CI job and introduces Start-SyncProgressMonitor / Stop-SyncProgressMonitor functions used by integration tests to log periodic file-sync progress and final completion time.

Changes

Cohort / File(s) Summary
Workflow timeout constraints
​.github/workflows/CI.yaml
Added timeout-minutes: 90 at the integration-tests job level and timeout-minutes: 75 to the Run Integration Tests step (when steps.check-secrets.outputs.secrets_configured == 'true').
Sync progress monitoring utilities
tests/Integration/IntegrationTestHelpers.psm1
Added exported Start-SyncProgressMonitor and Stop-SyncProgressMonitor. They create/manage a System.Timers.Timer, poll a destination path at a configurable interval, log [SYNC PROGRESS] with aggregated bytes/MB, and emit [SYNC COMPLETE] on stop.
Integration test instrumentation
tests/Integration/Public/MediaSync.Integration.tests.ps1
Wrapped Sync-PatMedia invocations in try/finally blocks that start and stop the sync progress monitor; one test passes -IntervalSeconds 10 for more frequent polling.

Sequence Diagram

sequenceDiagram
    actor TestRunner as Test Runner
    participant Monitor as SyncProgressMonitor
    participant Timer as System.Timers.Timer
    participant Sync as Sync-PatMedia
    participant FS as File System

    TestRunner->>Monitor: Start-SyncProgressMonitor(path, interval)
    Monitor->>Timer: Create & Start (interval)
    Note right of Timer: Timer ticks every interval

    TestRunner->>Sync: Invoke Sync-PatMedia(...)
    Sync->>FS: Download/Create files
    activate Sync

    loop every interval
        Timer->>FS: Scan destination path
        FS-->>Timer: Return files & sizes
        Timer->>Monitor: Log "[SYNC PROGRESS]" with totals
    end

    Sync->>FS: Finish downloads
    deactivate Sync

    TestRunner->>Monitor: Stop-SyncProgressMonitor(monitor)
    Monitor->>Timer: Stop & Dispose
    Monitor->>TestRunner: Log "[SYNC COMPLETE]" with elapsed time
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I watch the bytes hop, tick by tick,
Timers tap, the progress ticks quick—
Start the monitor, count each file,
Logs that cheer across the mile,
Stop and sip the sync-time tea.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main changes: adding timeouts and download progress monitoring to integration tests, matching the core objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/integration-test-timeouts

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 and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves CI reliability and debuggability for the media sync integration tests by adding workflow timeouts and emitting periodic download progress to the job logs.

Changes:

  • Add job- and step-level timeouts to the GitHub Actions integration-tests workflow to prevent indefinite hangs.
  • Introduce Start-SyncProgressMonitor / Stop-SyncProgressMonitor helpers to periodically log file count and downloaded size while syncing media.
  • Wrap the Sync-PatMedia download and idempotency integration tests with the progress monitor.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/Integration/Public/MediaSync.Integration.tests.ps1 Wraps long-running sync tests with a progress monitor to improve CI log visibility.
tests/Integration/IntegrationTestHelpers.psm1 Adds and exports progress monitor helpers used by integration tests.
.github/workflows/CI.yaml Adds timeouts to integration test job/step to prevent long hangs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/Integration/IntegrationTestHelpers.psm1
tablackburn and others added 2 commits April 10, 2026 03:57
Register-ObjectEvent -Action returns a PSEventJob whose .Name is the
job name, not the SourceIdentifier needed by Unregister-Event. Use an
explicit -SourceIdentifier with a unique GUID and store that instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tablackburn tablackburn enabled auto-merge (squash) April 10, 2026 08:16
@tablackburn tablackburn merged commit b4a6b8e into main Apr 10, 2026
13 checks passed
@tablackburn tablackburn deleted the ci/integration-test-timeouts branch April 10, 2026 08:21
tablackburn added a commit that referenced this pull request Apr 27, 2026
The [Unreleased] section had drifted empty even though user-facing work
landed since 0.10.3. Backfill the entries so the next release captures
them and so users browsing the changelog can see what's coming.

- Added: Update-PatServerToken (#31) — interactive/direct token refresh
  with vault or inline storage and post-update verification
- Added: CI integration token validation pre-flight step (#31) — fast
  actionable failure when PLEX_TOKEN is expired
- Changed: actionable 401 token recovery guidance from this PR (#39)

Pure CI/dev-tooling churn (#34/#35/#36/#37/#38) intentionally omitted —
Keep a Changelog focuses on user-facing changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
tablackburn added a commit that referenced this pull request Apr 27, 2026
* feat: Replace 401 errors with actionable token recovery guidance

Plex API 401 responses now throw a message naming the cmdlets users can
run to recover (Update-PatServerToken, Get-PatStoredServer, -Token) instead
of bubbling up the raw HTTP status. Detection happens centrally in
Invoke-PatApi so every public cmdlet that hits the Plex API benefits.

Also fixes a latent test that constructed a [WebException] with an invalid
4-arg overload — the constructor failure was masking the assertion.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* refactor: Tighten 401 detection and preserve original error context

Address review feedback on PR #39:

- Drop the lone 'Unauthorized' regex clause; rely on \b401\b alone.
  Bare 'Unauthorized' could misfire on UnauthorizedAccessException, 403
  bodies that include the word, proxy/auth middleware errors, etc., and
  then incorrectly recommend Plex token recovery.
- Append 'Original error: <message>' to the 401 guidance so URL/inner-
  exception detail is retained for support and debugging.
- Tighten the raw-string 401 test to also assert on Update-PatServerToken
  so the cmdlet-naming contract is enforced for both message shapes.
- Add a regression test asserting that an UnauthorizedAccessException-
  style message does NOT trigger the 401 guidance.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs: Backfill [Unreleased] changelog entries

The [Unreleased] section had drifted empty even though user-facing work
landed since 0.10.3. Backfill the entries so the next release captures
them and so users browsing the changelog can see what's coming.

- Added: Update-PatServerToken (#31) — interactive/direct token refresh
  with vault or inline storage and post-update verification
- Added: CI integration token validation pre-flight step (#31) — fast
  actionable failure when PLEX_TOKEN is expired
- Changed: actionable 401 token recovery guidance from this PR (#39)

Pure CI/dev-tooling churn (#34/#35/#36/#37/#38) intentionally omitted —
Keep a Changelog focuses on user-facing changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants