Skip to content

test(leader-election): cover follower leader observation - #203

Merged
GatewayJ merged 1 commit into
rustfs:mainfrom
GatewayJ:fix/issue-1083-follower-leader-state
Jul 29, 2026
Merged

test(leader-election): cover follower leader observation#203
GatewayJ merged 1 commit into
rustfs:mainfrom
GatewayJ:fix/issue-1083-follower-leader-state

Conversation

@GatewayJ

Copy link
Copy Markdown
Member

Type of Change

  • New Feature
  • Bug Fix
  • Documentation
  • Performance Improvement
  • Test/CI
  • Refactor
  • Other:

Related Issues

  • Closes rustfs/backlog#1083

Summary of Changes

  • Replace the pre-seeded single-follower regression test with three active electors sharing one lock backend.
  • Verify that both followers publish Following("node-1"), expose the leader through current_leader(), and never report themselves as leaders.
  • Verify that each follower receives exactly one on_new_leader("node-1") callback while preserving the stopped callback contract.
  • Keep failure injection state isolated per fake lock participant while sharing only distributed lock state.

The production behavior was already corrected by #194. This change completes the explicit three-instance acceptance coverage for rustfs/backlog#1083 without changing production code or public APIs.

Checklist

  • I have read and followed the CONTRIBUTING.md guidelines
  • Passed make pre-commit (fmt-check + clippy + test + console-lint + console-fmt-check)
  • Added/updated necessary tests
  • Documentation updated (N/A: test-only change)
  • CHANGELOG.md updated under [Unreleased] (N/A: test-only change)
  • CI/CD passed (pending)

Impact

  • Breaking change (CRD/API compatibility)
  • Requires doc/config/deployment update
  • Other impact: regression coverage only; no production behavior or public API changes

Verification

make pre-commit
cargo test -p kube-leader-election test_spawn_reports_remote_leader_to_all_followers -- --exact

The focused three-instance test was also run 100 consecutive times successfully.

Additional Notes

The test starts node-1 first and waits for Leading before starting two followers. Followers are stopped and joined before the leader to avoid release or takeover races.


Thank you for your contribution! Please ensure the community standards (CODE_OF_CONDUCT.md) are followed and the CLA is signed if this is your first contribution.

@GatewayJ

Copy link
Copy Markdown
Member Author

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 4a62f6b84f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@GatewayJ
GatewayJ marked this pull request as ready for review July 29, 2026 13:36
@GatewayJ
GatewayJ added this pull request to the merge queue Jul 29, 2026
Merged via the queue into rustfs:main with commit 9f1c85b Jul 29, 2026
3 checks passed
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