Skip to content

scheduler: replace reflection with @VisibleForTesting in IsolationSchedulerTest#8811

Merged
reiabreu merged 1 commit into
masterfrom
isolation-scheduler-visible-for-testing
Jun 28, 2026
Merged

scheduler: replace reflection with @VisibleForTesting in IsolationSchedulerTest#8811
reiabreu merged 1 commit into
masterfrom
isolation-scheduler-visible-for-testing

Conversation

@reiabreu

Copy link
Copy Markdown
Contributor

Summary

  • Makes IsolationScheduler#hostAssignableSlots package-private and annotates it with @VisibleForTesting
  • Removes the reflection-based wrapper in IsolationSchedulerTest that called setAccessible(true) to reach the private method
  • Tests now call hostAssignableSlots directly; throws Exception removed from both test signatures

Motivation

As suggested in #8709 (comment) — reflection-based test helpers are fragile (silently break on method renames, signature changes, or module boundary changes) and harder to maintain. The @VisibleForTesting pattern is already used elsewhere in storm-server (e.g. Supervisor.java) and makes the intent explicit without exposing the method publicly.

Test plan

  • mvn test -pl storm-server -Dtest=IsolationSchedulerTest passes

🤖 Generated with Claude Code

…edulerTest

Make IsolationScheduler#hostAssignableSlots package-private and annotate
it with @VisibleForTesting so the test can call it directly instead of
using reflection, which is fragile under refactoring.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@reiabreu

Copy link
Copy Markdown
Contributor Author

Closes #8806

@reiabreu reiabreu added this to the 3.0.0 milestone Jun 28, 2026
@reiabreu reiabreu merged commit a18676b into master Jun 28, 2026
11 checks passed
@reiabreu reiabreu deleted the isolation-scheduler-visible-for-testing branch June 28, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant