Skip to content

tests: Enlarge unittest timeout#10949

Merged
ti-chi-bot[bot] merged 2 commits into
pingcap:masterfrom
JaySon-Huang:gtest_timeout
Jul 3, 2026
Merged

tests: Enlarge unittest timeout#10949
ti-chi-bot[bot] merged 2 commits into
pingcap:masterfrom
JaySon-Huang:gtest_timeout

Conversation

@JaySon-Huang

@JaySon-Huang JaySon-Huang commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: ref #6233

Problem Summary:

What is changed and how it works?


Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

None

Summary by CodeRabbit

  • Bug Fixes

    • Fixed interrupted test runs so elapsed runtime is now recorded and shown consistently.
    • Improved interrupted test output formatting for clearer reporting during parallel runs.
  • Chores

    • Increased the gtest parallel run timeout from 60 minutes to 90 minutes to reduce unexpected timeouts.

Signed-off-by: JaySon-Huang <tshent@qq.com>
Signed-off-by: JaySon-Huang <tshent@qq.com>
@ti-chi-bot ti-chi-bot Bot added release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 2, 2026
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR modifies the gtest_parallel test runner to record runtime for interrupted test tasks and updates output formatting for interrupted tests, and increases the parallel test execution timeout in run-gtest.sh from 3600 to 5400 seconds.

Changes

Test Runner Fixes

Layer / File(s) Summary
Interrupted task runtime and print formatting
tests/gtest_parallel.py
Task.run now sets runtime_ms when interrupted via ProcessWasInterrupted, and FilterFormat.print_tests uses dedicated formatting for INTERRUPTED TESTS output, showing Interrupted: <ms>: <binary> <test_name> when runtime is available or Interrupted: <binary> <test_name> otherwise.
Parallel test timeout increase
tests/run-gtest.sh
run_test_parallel timeout for gtest_parallel.py increased from 3600s (60 min) to 5400s (90 min), with updated comment.

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

Poem

A rabbit timed the tests with glee,
Interrupted or not, the ms we see,
Ninety minutes now to run and wait,
No test left behind, none left too late,
Hop hop, all green, isn't that great! 🐇⏱️

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The template is present, but the Problem Summary, commit-message block, and test checklist are effectively empty or incomplete. Add a real problem summary, fill in the commit-message section, and check at least one test item; use the required issue-closing format if applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main test-related change: increasing the gtest/unittest timeout.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (3)
tests/gtest_parallel.py (2)

386-390: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Local variable shadows attribute name.

runtime_ms local var shadows task.runtime_ms; a distinct name (e.g. runtime_str) would avoid the confusion.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/gtest_parallel.py` around lines 386 - 390, The variable in the output
formatting block of gtest_parallel’s task printing logic is shadowing the
task.runtime_ms attribute, which can be confusing. Rename the local in the code
path that builds the permanent line output to a distinct name such as
runtime_str, and update the formatted string to use that renamed variable while
keeping the existing runtime_ms attribute access unchanged.

370-384: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Fragile magic-string dispatch for interrupted formatting.

is_interrupted is derived by comparing message against the literal 'INTERRUPTED TESTS'. This couples formatting behavior to the exact caller-supplied string; if a caller passes a differently-worded message for the interrupted set, this silently falls back to the non-interrupted branch.

♻️ Consider an explicit parameter instead
-    def print_tests(self, message, tasks, print_try_number):
+    def print_tests(self, message, tasks, print_try_number, is_interrupted=False):
         self.out.permanent_line("%s (%s/%s):" %
                                 (message, len(tasks), self.total_tasks))
-        is_interrupted = message == 'INTERRUPTED TESTS'
         for task in sorted(tasks):

Would require updating call sites to pass the flag explicitly.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/gtest_parallel.py` around lines 370 - 384, The interrupted-test
formatting in the task-printing path is driven by a brittle string comparison on
message; update the relevant formatter in gtest_parallel to take an explicit
interrupted flag instead of deriving is_interrupted from the literal message.
Propagate that flag from the call sites that render test results, and keep the
existing Interrupted output branch in the same task iteration logic so
formatting no longer depends on the exact caller-supplied text.
tests/run-gtest.sh (1)

60-60: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Unquoted variable expansions (SC2086).

Shellcheck flags ${test_bins}, ${NPROC}, ${args} on this line for missing quotes, risking word splitting/globbing. This mirrors an existing pattern elsewhere in the file, so treat as optional cleanup rather than blocking.

🧹 Optional quoting fix
-	python ${SRC_TESTS_PATH}/gtest_parallel.py ${test_bins} --workers=${NPROC} ${args} --print_test_times --timeout=5400
+	python "${SRC_TESTS_PATH}/gtest_parallel.py" "${test_bins}" --workers="${NPROC}" ${args} --print_test_times --timeout=5400

As per static analysis hints, "Double quote to prevent globbing and word splitting."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/run-gtest.sh` at line 60, Shellcheck is flagging unquoted expansions in
the gtest invocation, so update the run-gtest.sh command to quote the test_bins,
NPROC, and args variables consistently with the script’s other quoted usage.
Keep the behavior unchanged while preventing word splitting/globbing in the
python gtest_parallel.py call.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/gtest_parallel.py`:
- Around line 386-390: The variable in the output formatting block of
gtest_parallel’s task printing logic is shadowing the task.runtime_ms attribute,
which can be confusing. Rename the local in the code path that builds the
permanent line output to a distinct name such as runtime_str, and update the
formatted string to use that renamed variable while keeping the existing
runtime_ms attribute access unchanged.
- Around line 370-384: The interrupted-test formatting in the task-printing path
is driven by a brittle string comparison on message; update the relevant
formatter in gtest_parallel to take an explicit interrupted flag instead of
deriving is_interrupted from the literal message. Propagate that flag from the
call sites that render test results, and keep the existing Interrupted output
branch in the same task iteration logic so formatting no longer depends on the
exact caller-supplied text.

In `@tests/run-gtest.sh`:
- Line 60: Shellcheck is flagging unquoted expansions in the gtest invocation,
so update the run-gtest.sh command to quote the test_bins, NPROC, and args
variables consistently with the script’s other quoted usage. Keep the behavior
unchanged while preventing word splitting/globbing in the python
gtest_parallel.py call.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: faa3b8a2-f776-42ac-bfd4-a72be77740c0

📥 Commits

Reviewing files that changed from the base of the PR and between 63cff9a and ab5be73.

📒 Files selected for processing (2)
  • tests/gtest_parallel.py
  • tests/run-gtest.sh

@JaySon-Huang JaySon-Huang requested a review from JinheLin July 2, 2026 11:03
@ti-chi-bot ti-chi-bot Bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jul 3, 2026

@windtalker windtalker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@ti-chi-bot

ti-chi-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: windtalker, yongman

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 Jul 3, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

[LGTM Timeline notifier]

Timeline:

  • 2026-07-03 01:57:20.641167041 +0000 UTC m=+350182.341546484: ☑️ agreed by yongman.
  • 2026-07-03 03:20:10.023389466 +0000 UTC m=+355151.723768889: ☑️ agreed by windtalker.

@JaySon-Huang

Copy link
Copy Markdown
Contributor Author

/retest

1 similar comment
@JaySon-Huang

Copy link
Copy Markdown
Contributor Author

/retest

@ti-chi-bot ti-chi-bot Bot merged commit cfca86e into pingcap:master Jul 3, 2026
11 checks passed
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/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants