Skip to content

Conversation

@tomchon
Copy link
Contributor

@tomchon tomchon commented Jun 20, 2025

This pull request improves the handling of local and remote hosts in the tests/parallel_test/run.sh script, ensuring commands are executed appropriately based on the host type. It introduces a new helper function, is_local_host(), to determine if a host is local, and updates several functions to use this logic for cleaner and more reliable execution.

jira:https://jira.taosdata.com:18080/browse/TD-35700

Enhancements for handling local vs. remote hosts:

  • Added is_local_host() helper function: This function checks if a given host is local by comparing it against common local host identifiers (127.0.0.1, localhost, hostname, etc.).
  • Updated clean_tmp() function: Incorporated is_local_host() to determine whether to execute commands directly or via SSH, ensuring proper handling of local hosts.
  • Improved run_thread() function:
    • Adjusted command execution logic to differentiate between local and remote hosts for logging, copying files, and executing scripts. [1] [2] [3]
    • Replaced direct command execution with bash -c for consistency and better handling of complex commands. [1] [2] [3]

@tomchon tomchon marked this pull request as ready for review June 20, 2025 10:00
@tomchon tomchon requested a review from Copilot June 20, 2025 10:52

This comment was marked as outdated.

@tomchon
Copy link
Contributor Author

tomchon commented Jun 20, 2025

遇到报错如下,这种一般就是run_container.sh 的参数中有空格之类的,导致识别参数识别错误。这次就是-c 后面跟的是python 的命令行,使用 eval $cmd 这种执行模式就能避免这类问题。如果是加上了远程执行,还是只能使用 $cmd

192.168.1.52-26 order:1, redo:2 task:,,y,army,./pytest.sh python3 ./test.py -f cluster/snapshot.py -N 3 -L 3 -D 2
2025-06-20 19:04:04
/var/lib/jenkins/workspace/TDinternal/community/tests/parallel_test/run_container.sh
	 -w work dir
	 -d execution dir
	 -c command
	 -t thread number
	 -e enterprise edition
	 -o default timeout value
	 -s build with sanitizer
	 -h help
execute time: 0s
192.168.1.52 2025-06-20 19:04:04 exit code:1

192.168.1.52 total time: 0s

@tomchon tomchon requested a review from Copilot June 20, 2025 12:11

This comment was marked as outdated.

@tomchon tomchon requested a review from Copilot June 21, 2025 06:20

This comment was marked as outdated.

@tomchon tomchon requested a review from a team as a code owner June 21, 2025 07:13
@tomchon tomchon requested a review from Copilot June 21, 2025 07:14
@tomchon tomchon changed the title fix: enhance SSH command handling for local hosts in clean_tmp and ru… fix: enhance SSH command handling for local hosts in clean_tmp and run_thread functions Jun 21, 2025

This comment was marked as outdated.

@tomchon tomchon requested a review from feici02 as a code owner June 24, 2025 07:35
@tomchon tomchon requested a review from Copilot June 24, 2025 09:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request improves the handling of local and remote hosts in the test scripts by introducing a new helper function (is_local_host) and updating the command execution logic for consistency. Key changes include:

  • Adding the is_local_host() helper to distinguish between local and remote hosts.
  • Refactoring clean_tmp() and run_thread() functions to use bash -c for command execution and properly construct SSH/scp commands.
  • Adjusting test cases and CI scripts to match updated expectations and improve environmental setup.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/parallel_test/run.sh Introduces is_local_host() and updates SSH command handling in clean_tmp() and run_thread().
test/ci/run.sh Adjusts the redo condition for thread runs with a configurable retry limit.
test/ci/cases.task Updates test flags and rerun indicators for various test cases.
test/cases/50-Others/01-Valgrind/test_valgrind_checkerror1.py Updates expected row count in valgrind check.
test/cases/22-Show/test_show_basic.py Updates expected row count in show test cases.
packaging/tools/install_spec.sh Modifies environment variable setup to remove early returns and ensure both PATH and LD_LIBRARY_PATH are updated.
Comments suppressed due to low confidence (1)

packaging/tools/install_spec.sh:1033

  • With the removal of the early return statements, verify that appending both PATH and LD_LIBRARY_PATH entries does not lead to duplicate entries in ~/.bashrc on subsequent runs.
  if grep -q "export PATH=$bin_link_dir:\$PATH" ~/.bashrc; then

@feici02 feici02 merged commit 8681d79 into main Jun 24, 2025
6 checks passed
@feici02 feici02 deleted the fix/chr/ci-ssh-TD-35700 branch June 24, 2025 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants