Skip to content

tests(ticdc): stop relying on git root for mq compose paths#12607

Open
wlwilliamx wants to merge 2 commits intopingcap:masterfrom
wlwilliamx:fix/tcpserver-tls-cert-lookup-master
Open

tests(ticdc): stop relying on git root for mq compose paths#12607
wlwilliamx wants to merge 2 commits intopingcap:masterfrom
wlwilliamx:fix/tcpserver-tls-cert-lookup-master

Conversation

@wlwilliamx
Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: close #12606

What is changed and how it works?

This removes the mq protocol test framework dependency on git metadata when it resolves repo-local docker-compose assets.

  • add framework.ResolveRepoPath, which searches upward from the framework source tree and current working directory
  • use the helper in the avro/canal/mysql docker envs, compose log dumping, and the compose operator test
  • add a regression test for compose path resolution and drop the unused go-findroot dependency

Check List

Tests

  • Unit test
  • Manual test

Manual test:

  • go test ./tests/mq_protocol_tests/framework/... -run TestResolveRepoPath -count=1

Questions

Will it cause performance regression or break compatibility?

No. This is a test-only path resolution change.

Do you need to update user documentation, design documentation or monitoring documentation?

No.

Release note

None

@wlwilliamx wlwilliamx self-assigned this Apr 15, 2026
@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 15, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the external dependency go-findroot with a custom internal implementation, ResolveRepoPath, to locate the repository root. This change allows the framework to discover test assets without relying on git metadata, improving support for symlinked checkouts and git worktrees. Feedback was provided to improve the robustness of the directory traversal logic in the new utility to ensure it correctly evaluates all directories up to the filesystem root.

Comment on lines +31 to +40
for dir != "." && dir != string(filepath.Separator) {
if isRepoRoot(dir) {
return filepath.Join(dir, normalizedRel), nil
}
parent := filepath.Dir(dir)
if parent == dir {
break
}
dir = parent
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The current loop condition dir != "." && dir != string(filepath.Separator) prevents the search from checking the filesystem root (e.g., / on Unix) or the current directory if base is relative. Since filepath.Dir returns the same path when it reaches the root of the filesystem or the root of a relative path (like .), it is more robust to use parent == dir as the termination condition. This ensures that every directory in the hierarchy, including the root, is evaluated by isRepoRoot.

Suggested change
for dir != "." && dir != string(filepath.Separator) {
if isRepoRoot(dir) {
return filepath.Join(dir, normalizedRel), nil
}
parent := filepath.Dir(dir)
if parent == dir {
break
}
dir = parent
}
for {
if isRepoRoot(dir) {
return filepath.Join(dir, normalizedRel), nil
}
parent := filepath.Dir(dir)
if parent == dir {
break
}
dir = parent
}

@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot bot commented Apr 15, 2026

@wlwilliamx: 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-error-log-review 62f134b link true /test pull-error-log-review
pull-dm-integration-test-next-gen 62f134b link false /test pull-dm-integration-test-next-gen
pull-cdc-integration-kafka-test 62f134b link true /test pull-cdc-integration-kafka-test

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.

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Apr 17, 2026
@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot bot commented Apr 17, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lidezhu, wk989898

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 added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Apr 17, 2026
@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot bot commented Apr 17, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-04-17 06:56:14.644866557 +0000 UTC m=+1716979.850226644: ☑️ agreed by wk989898.
  • 2026-04-17 11:17:29.690100969 +0000 UTC m=+1732654.895461036: ☑️ agreed by lidezhu.

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

Labels

approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tests(ticdc): mq protocol framework relies on git root for compose paths

3 participants