Skip to content

feat(tests): use FakeTimeProvider for deterministic CircuitBreaker tests#367

Merged
RicherTunes merged 9 commits intomainfrom
feat/faketimeprovider-tests
Jan 13, 2026
Merged

feat(tests): use FakeTimeProvider for deterministic CircuitBreaker tests#367
RicherTunes merged 9 commits intomainfrom
feat/faketimeprovider-tests

Conversation

@RicherTunes
Copy link
Owner

Summary

  • Bump lidarr.plugin.common submodule (includes TimeProvider injection from PR deps: Bump the test-dependencies group with 2 updates #267)
  • Add testkit project reference to Brainarr.Tests for FakeTimeProvider
  • Update CircuitBreaker to accept optional TimeProvider parameter
  • Refactor state transition tests to use FakeTimeProvider.Advance() instead of flaky Task.Delay()

Benefits

  • CircuitBreaker_transitions_to_half_open_after_duration: 1500ms -> 1ms
  • Half_open_failure_reopens_circuit: saves 1100ms wait time on open duration
  • Eliminates timing-based test flakiness for state transitions

Test plan

  • All CircuitBreaker tests pass (24/24)
  • CI passes on all platforms

🤖 Generated with Claude Code

Bump lidarr.plugin.common submodule (includes TimeProvider injection). Add testkit project reference to Brainarr.Tests. Update CircuitBreaker to accept optional TimeProvider parameter. Refactor state transition tests to use FakeTimeProvider.Advance() instead of flaky Task.Delay() calls.

Benefits: CircuitBreaker_transitions_to_half_open_after_duration runs in 1ms (was 1500ms+). Eliminates timing-based test flakiness.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link
Contributor

github-actions bot commented Jan 13, 2026

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

RicherTunes and others added 8 commits January 13, 2026 15:35
TestKit.csproj uses NSubstitute, which must be allowed in NuGet.config package source mapping.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ectly

Use workflow_call inputs from Common PR #269: test_plugins, lidarr_tag. Use secrets: inherit for cross-repo access.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Includes:
- #268: fix(testkit): add AdditionalProperties to prevent CS2012 file locks
- #270: fix(auth): make StreamingTokenManager deterministically testable with TimeProvider
- #269: feat(ci): reusable multi-plugin smoke test + Brainarr schema assertions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@RicherTunes RicherTunes merged commit 6a68eef into main Jan 13, 2026
25 checks passed
@RicherTunes RicherTunes deleted the feat/faketimeprovider-tests branch January 13, 2026 22:19
RicherTunes added a commit that referenced this pull request Feb 17, 2026
Picks up:
- #383: fix(ci): Windows credential issue in change detection step
- #367: deps: coverlet.collector 6.0.4 → 8.0.0
- #370: deps: publicapigenerator.tool 11.4.6 → 11.5.4
- #371: deps: Spectre.Console 0.50.0 → 0.54.0
- #375: deps: xunit 2.9.2 → 2.9.3

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
RicherTunes added a commit that referenced this pull request Feb 17, 2026
Picks up:
- #383: fix(ci): Windows credential issue in change detection step
- #367: deps: coverlet.collector 6.0.4 → 8.0.0
- #370: deps: publicapigenerator.tool 11.4.6 → 11.5.4
- #371: deps: Spectre.Console 0.50.0 → 0.54.0
- #375: deps: xunit 2.9.2 → 2.9.3

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
RicherTunes added a commit that referenced this pull request Feb 17, 2026
Picks up:
- #383: fix(ci): Windows credential issue in change detection step
- #367: deps: coverlet.collector 6.0.4 → 8.0.0
- #370: deps: publicapigenerator.tool 11.4.6 → 11.5.4
- #371: deps: Spectre.Console 0.50.0 → 0.54.0
- #375: deps: xunit 2.9.2 → 2.9.3

Co-authored-by: Claude Opus 4.6 <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.

1 participant