Repository navigation
tests: support cloud-engine next gen startup - #4661
ti-chi-bot[bot] merged 3 commits into
Conversation
Signed-off-by: tenfyzhong <tenfy@tenfy.cn>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughTwo next-gen integration test startup scripts now run Changes
Sequence Diagram(s)sequenceDiagram
participant Script
participant TiKV_Binary
participant Config_File
Script->>TiKV_Binary: run `tikv-server -V`
TiKV_Binary-->>Script: version output (includes Git Commit Branch)
Script->>Script: parse branch, set tikvNeedsCdcEnable
alt branch == cloud-engine
Script->>Config_File: append [cdc]\nenable = true
else
Script->>Config_File: write standard TiKV config
end
Script->>TiKV_Binary: start TiKV with generated config
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces logic to automatically enable CDC in TiKV configurations when the 'cloud-engine' branch is detected during integration tests. This change is implemented in both the standard and TLS cluster startup scripts, while also removing redundant version print statements. The review feedback highlights an opportunity to refactor the duplicated version-checking logic into a shared utility and suggests applying the CDC configuration to downstream TiKV instances as well to ensure consistency across the test environment.
| tikvVersionInfo=$(tikv-server -V 2>&1) | ||
| printf '%s\n' "$tikvVersionInfo" | ||
| tikvGitCommitBranch=$(printf '%s\n' "$tikvVersionInfo" | sed -nE 's/^Git Commit Branch:[[:space:]]*([^[:space:]]+).*$/\1/p' | head -n 1) | ||
| tikvNeedsCdcEnable=false | ||
| if [ "$tikvGitCommitBranch" = "cloud-engine" ]; then | ||
| tikvNeedsCdcEnable=true | ||
| fi |
There was a problem hiding this comment.
The logic for detecting the TiKV branch and determining if CDC needs to be enabled is duplicated in tests/integration_tests/_utils/start_tls_tidb_cluster_impl_nextgen. To improve maintainability and ensure consistency across different test startup scripts, consider extracting this logic into a shared function or a common utility script.
| if [ "$tikvNeedsCdcEnable" = "true" ]; then | ||
| cat >>"$OUT_DIR/upstream-tikv.toml" <<EOF | ||
| [cdc] | ||
| enable = true | ||
| EOF | ||
| fi |
There was a problem hiding this comment.
The cdc.enable = true configuration is only applied to upstream-tikv.toml. In these integration tests, both upstream and downstream clusters typically use the same TiKV binary. If the cloud-engine branch requires this configuration for proper operation, it should likely be applied to downstream-tikv.toml as well (after it is initialized around line 240) to ensure the downstream cluster starts and behaves correctly.
There was a problem hiding this comment.
@tenfyzhong PTAL. I think BDR mode needs this?
There was a problem hiding this comment.
The comment is outdated. I have added the same configuration to the downstream config file on line 263.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/integration_tests/_utils/start_tls_tidb_cluster_impl_nextgen (1)
71-78: Implementation is consistent with the non-TLS script.The version check logic is identical to
start_tidb_cluster_nextgen, which is good for consistency.Consider extracting to a shared helper function.
Both nextgen scripts now have identical logic for checking the TiKV version and determining if CDC should be enabled. Consider extracting this into a reusable function in a shared utility file (e.g.,
test_prepareor a new helper) to reduce duplication:# Example helper function get_tikv_needs_cdc_enable() { local tikvVersionInfo tikvVersionInfo=$(tikv-server -V 2>&1) printf '%s\n' "$tikvVersionInfo" local tikvGitCommitBranch tikvGitCommitBranch=$(printf '%s\n' "$tikvVersionInfo" | sed -nE 's/^Git Commit Branch:[[:space:]]*([^[:space:]]+).*$/\1/p' | head -n 1) if [ "$tikvGitCommitBranch" = "cloud-engine" ]; then echo "true" else echo "false" fi }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/integration_tests/_utils/start_tls_tidb_cluster_impl_nextgen` around lines 71 - 78, Extract the duplicated TiKV version / CDC detection logic into a shared helper function (suggested name get_tikv_needs_cdc_enable) and replace the inline block in start_tls_tidb_cluster_impl_nextgen and start_tidb_cluster_nextgen with a call to that helper; the helper should run tikv-server -V, print the version info as before, parse the "Git Commit Branch" using the existing sed expression, and output "true" or "false" so callers can assign tikvNeedsCdcEnable=$(get_tikv_needs_cdc_enable) — add the helper to a common test utility file (e.g., test_prepare or a new shared helper) and update both scripts to source that file.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@tests/integration_tests/_utils/start_tls_tidb_cluster_impl_nextgen`:
- Around line 71-78: Extract the duplicated TiKV version / CDC detection logic
into a shared helper function (suggested name get_tikv_needs_cdc_enable) and
replace the inline block in start_tls_tidb_cluster_impl_nextgen and
start_tidb_cluster_nextgen with a call to that helper; the helper should run
tikv-server -V, print the version info as before, parse the "Git Commit Branch"
using the existing sed expression, and output "true" or "false" so callers can
assign tikvNeedsCdcEnable=$(get_tikv_needs_cdc_enable) — add the helper to a
common test utility file (e.g., test_prepare or a new shared helper) and update
both scripts to source that file.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 10bdb03a-08eb-4a0a-bf15-48f475ba4922
📒 Files selected for processing (2)
tests/integration_tests/_utils/start_tidb_cluster_nextgentests/integration_tests/_utils/start_tls_tidb_cluster_impl_nextgen
Signed-off-by: tenfyzhong <tenfy@tenfy.cn>
|
/test next-gen |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: wk989898, wlwilliamx The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
|
/test next-gen |
…heck - Remove branch detection logic for TiKV version - Always enable CDC in TiKV configuration files - Simplify TiKV version check to just display output without parsing - This eliminates conditional logic that was specific to 'cloud-engine' branch Signed-off-by: tenfyzhong <tenfy@tenfy.cn>
|
/test all |
|
@tenfyzhong: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
|
/cherry-pick release-8.5 |
|
@tenfyzhong: new pull request created to branch DetailsIn response to this:
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 ti-community-infra/tichi repository. |
What problem does this PR solve?
Issue Number: close #4660
What is changed and how it works?
This PR updates next-gen integration test cluster startup scripts to support TiKV binaries built from the
cloud-enginebranch.Before generating the TiKV config, the scripts now run
tikv-server -Vand parseGit Commit Branch. When the branch iscloud-engine, the scripts append:The non-TLS next-gen startup only applies this to
upstream-tikv.toml, while the TLS next-gen startup applies it to its generated TiKV config.Check List
Tests
Manual verification:
bash -n tests/integration_tests/_utils/start_tidb_cluster_nextgen tests/integration_tests/_utils/start_tls_tidb_cluster_impl_nextgenQuestions
Will it cause performance regression or break compatibility?
No. The change only affects next-gen integration test startup scripts and only appends
cdc.enable = truewhentikv-server -VreportsGit Commit Branch: cloud-engine.Do you need to update user documentation, design documentation or monitoring documentation?
No.
Release note
Summary by CodeRabbit