Skip to content

test: clean up keyspace kernel mode tests#10987

Open
disksing wants to merge 2 commits into
masterfrom
task3/pr1-keyspace-test-cleanup
Open

test: clean up keyspace kernel mode tests#10987
disksing wants to merge 2 commits into
masterfrom
task3/pr1-keyspace-test-cleanup

Conversation

@disksing

@disksing disksing commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: ref #10989

This PR splits out the keyspace test cleanup portion from the API V3 PD
client work, so later API and TSO routing changes can stay focused.

What is changed and how does it work?

test: clean up keyspace kernel mode tests

Remove test-only kernel mode failpoint toggles from keyspace tests and derive
the expected behavior from the current kernel type instead. This also wires a
mock cluster into keyspace manager test setup and refreshes keyspace group
state inside an async wait loop to avoid stale test objects.

Check List

Tests

  • Unit test
  • Integration test

Code changes

  • None

Side effects

  • None

Related changes

  • None

Release note

None.

@ti-chi-bot ti-chi-bot Bot added do-not-merge/needs-linked-issue dco-signoff: yes Indicates the PR's author has signed the dco. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 9, 2026
Signed-off-by: disksing <i@disksing.com>
@disksing disksing force-pushed the task3/pr1-keyspace-test-cleanup branch from ce7a226 to fb71004 Compare July 9, 2026 05:49
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Test files in pkg/keyspace now use a mocked cluster for NewKeyspaceManager, derive expected kernel-type-specific values from kerneltype.IsNextGen(), and require a valid keyspace-group response before checking member counts in the integration test.

Changes

Keyspace Test Refactor

Layer / File(s) Summary
Mocked cluster wiring in keyspace manager tests
pkg/keyspace/keyspace_test.go
Adds mockcluster and mockconfig imports and constructs a mocked cluster passed into NewKeyspaceManager in SetupTest and TestIterateKeyspaces, replacing the prior nil cluster argument.
Kernel type based test case derivation
pkg/keyspace/keyspace_test.go, pkg/keyspace/util_test.go
Removes failpoint-based classic/next-gen toggling and the failpoint import; TestGCManagementTypeDefaultValue and TestProtectedKeyspaceValidation now compute expected values directly from kerneltype.IsNextGen() with simplified test case tables.
Keyspace group response guard
tests/integrations/mcs/keyspace/tso_keyspace_group_test.go
Adds a status and nil check in TestDefaultKeyspaceGroup before asserting on kg.Members inside the polling loop.

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

Possibly related PRs

  • tikv/pd#10556: Adjusts keyspace-group behavior around missing groups, which matches the integration-test polling change that now waits for a valid response before checking members.
  • tikv/pd#10597: Also changes pkg/keyspace/keyspace_test.go constructor wiring for NewKeyspaceManager(...), touching the same test integration point.

Suggested labels: lgtm, approved

Suggested reviewers: bufferflies, lhy1024, rleungx

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly matches the main change: cleaning up keyspace kernel mode tests.
Description check ✅ Passed The description includes the problem, changes, tests, checklist, and release note, so it is mostly complete.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task3/pr1-keyspace-test-cleanup

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.

Signed-off-by: disksing <i@disksing.com>
@ti-chi-bot ti-chi-bot Bot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/needs-triage-completed and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. do-not-merge/needs-triage-completed labels Jul 9, 2026
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.18%. Comparing base (aa5a988) to head (ebca673).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10987      +/-   ##
==========================================
- Coverage   79.21%   79.18%   -0.03%     
==========================================
  Files         541      541              
  Lines       75677    75847     +170     
==========================================
+ Hits        59949    60063     +114     
- Misses      11491    11544      +53     
- Partials     4237     4240       +3     
Flag Coverage Δ
unittests 79.18% <ø> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@disksing

disksing commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

/test pull-build
/test pull-unit-test-next-gen-3

@ti-chi-bot ti-chi-bot Bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Jul 9, 2026
@ti-chi-bot ti-chi-bot Bot added the lgtm label Jul 13, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lhy1024, rleungx

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot Bot removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jul 13, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

[LGTM Timeline notifier]

Timeline:

  • 2026-07-09 10:00:57.75510769 +0000 UTC m=+275843.791202747: ☑️ agreed by lhy1024.
  • 2026-07-13 03:10:29.946626242 +0000 UTC m=+596815.982721328: ☑️ agreed by rleungx.

@ti-chi-bot

ti-chi-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

@disksing: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-unit-test-next-gen-2 ebca673 link unknown /test pull-unit-test-next-gen-2
pull-unit-test-next-gen-3 ebca673 link unknown /test pull-unit-test-next-gen-3

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved dco-signoff: yes Indicates the PR's author has signed the dco. lgtm release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants