Skip to content

Conversation

@luketong777
Copy link
Collaborator

Description

Type of Change

  • Types
    • Bug fix
    • New feature
      • Transfer Engine
      • Mooncake Store
      • Mooncake EP
      • Integration
      • P2P Store
      • Python Wheel
    • Breaking change
    • CI/CD
    • Documentation update
    • Other

How Has This Been Tested?

Checklist

  • I have performed a self-review of my own code.
  • I have updated the documentation.
  • I have added tests to prove my changes are effective.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @luketong777, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the project's continuous integration capabilities by adding a robust end-to-end testing framework for the Mooncake project. It enables automated validation of critical functionalities, such as distributed inference with Prefill-Decode disaggregation and the integration of HiCache storage with the Mooncake backend. The changes also include comprehensive guidelines and utility scripts to facilitate the development and maintenance of future E2E tests.

Highlights

  • New E2E Test Framework: Introduces a comprehensive end-to-end testing framework for the Mooncake project, integrated into the CI/CD pipeline.
  • Distributed Inference Test: Adds 'test_1p1d_erdma.sh' to validate distributed inference with Prefill-Decode disaggregation using ERDMA, supporting models like Qwen/Qwen3-8B and DeepSeek-V2-Lite.
  • HiCache Storage Integration Test: Includes 'test_hicache_storage_mooncake_backend.sh' and its corresponding Python implementation to verify HiCache storage system functionality with Mooncake as the backend, covering various memory layouts and MLA models.
  • Standardized Test Development Guidelines: Provides detailed documentation (in both English and Chinese) on how to develop new E2E test cases, covering script structure, variable declaration, path usage, and result formatting.
  • Reusable Shell Utilities: Introduces 'common.sh' with a suite of reusable shell functions for Docker management, environment setup, and service readiness checks, streamlining test script development.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/ci.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@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 introduces a suite of end-to-end tests for sglang, leveraging the T-One platform. The changes include test scripts, Python test code, and documentation. The overall structure is good, with common logic factored out into a shared script and clear documentation for developers.

However, I've identified several critical and high-severity issues that need to be addressed:

  • Critical script errors: The common.sh script contains critical typos (gpg --dearmour, invalid shebang) that will prevent the tests from running.
  • High-severity correctness/portability issues: There's a hardcoded absolute path in a Python test file, an incorrect results filename that will break CI parsing, and unreliable log-grepping for determining test outcomes.
  • High-severity performance issue: One of the main test scripts is highly inefficient, tearing down and recreating Docker containers for each model tested.

I've left detailed comments with suggestions for fixing these issues. Additionally, there are several medium-severity issues, such as an undefined variable in a log message and missing newlines at the end of script files. Addressing these points will significantly improve the robustness, portability, and performance of the new test suite.

@@ -0,0 +1,267 @@
# !/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The shebang #! /bin/bash contains a space, which makes it invalid on many systems. This can cause the script to be executed with the wrong interpreter or fail to execute at all. Please remove the space.

Suggested change
# !/bin/bash
#!/bin/bash

fi

pip_cmd=""
erdm_dirver_cmd='wget -qO - http://mirrors.cloud.aliyuncs.com/erdma/GPGKEY | gpg --dearmour -o /etc/apt/trusted.gpg.d/erdma.gpg && \
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

There are a couple of critical typos on this line that will cause the script to fail:

  1. The variable name erdm_dirver_cmd is misspelled. It should likely be erdma_driver_cmd. This variable is used on lines 51 and 52, and the typo will cause a "command not found" error.
  2. The gpg command has a typo: --dearmour should be --dearmor.

Please correct these typos at the declaration here and where the variable is used.

Suggested change
erdm_dirver_cmd='wget -qO - http://mirrors.cloud.aliyuncs.com/erdma/GPGKEY | gpg --dearmour -o /etc/apt/trusted.gpg.d/erdma.gpg && \
erdma_driver_cmd='wget -qO - http://mirrors.cloud.aliyuncs.com/erdma/GPGKEY | gpg --dearmor -o /etc/apt/trusted.gpg.d/erdma.gpg && \

Comment on lines +239 to +241
for model in "${SUPPORT_MODELS[@]}"; do
run_single_model "$model"
done
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The test logic recreates the Docker containers for every model in the SUPPORT_MODELS array. The run_single_model function calls setup, which in turn calls clean_container and docker_launch. This is highly inefficient and will significantly slow down the test suite. The container setup should be performed once before the loop, and the loop should only run the model-specific test logic.

Comment on lines 105 to 117
if grep -q "FAILED" "$log_file" || grep -q "ERROR" "$log_file"; then
echo "Tests failed - check log file for details"
echo "{\"test_case\": \"$test_case_name\", \"status\": \"Fail\", \"timestamp\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}" > "$result_json"
echo "$test_case_name: Fail"
elif grep -q "passed" "$log_file"; then
echo "All tests passed"
echo "{\"test_case\": \"$test_case_name\", \"status\": \"Pass\", \"timestamp\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}" > "$result_json"
echo "$test_case_name: Pass"
else
echo "Unable to determine test status"
echo "{\"test_case\": \"$test_case_name\", \"status\": \"Fail\", \"timestamp\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\", \"error\": \"Unable to determine status\"}" > "$result_json"
echo "$test_case_name: Fail"
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The parse function determines test success or failure by grep-ing the log file for "FAILED" or "ERROR". This is unreliable and can lead to incorrect results. For example, a test might legitimately print the word "ERROR" in a message while still passing. The run_test function already returns the exit code of pytest. This exit code should be used to determine the test status, which is a much more robust method.

Comment on lines 16 to 18
sglang_test_path = "/sgl-workspace/sglang/test/srt/hicache"
if os.path.exists(sglang_test_path):
sys.path.insert(0, sglang_test_path)
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The path to sglang test files is hardcoded as an absolute path (/sgl-workspace/sglang/test/srt/hicache). This makes the tests not portable and very difficult to run outside of the specific CI environment for which this path was configured. Please remove this and instead configure the PYTHONPATH environment variable in the shell script that executes these Python tests. For example, export PYTHONPATH="/path/to/sglang:$PYTHONPATH".

### Execute Full Test

```bash
cd scripts && ./test_demo.sh
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The example command to execute a full test is incorrect. The path scripts is not where the test scripts are located, and test_demo.sh is not one of the scripts added in this PR. This can be confusing for users trying to run the tests locally. Please update the example to reflect the correct path and a valid script name, for example test_1p1d_erdma.sh.

Suggested change
cd scripts && ./test_demo.sh
cd scripts/tone_tests/scripts && ./test_1p1d_erdma.sh

echo " main - Run complete test workflow (prepare -> run_test -> parse -> cleanup)"
exit 1
;;
esac No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The file is missing a final newline character. This can cause unexpected behavior, especially if the script is sourced by another script. Please add a newline at the end of the file.

Comment on lines +145 to +144
# For now, we'll assume master service is ready if process is running
# and it's been a few seconds since startup
if (
time.time() - start_time > 5
): # Give master service time to initialize
master_ready = True
print("Mooncake master service is ready")
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The readiness check for the mooncake_master service relies on the process running for more than 5 seconds. This is fragile and can lead to flaky tests if the service takes longer to initialize. It would be more robust to implement a proper health check endpoint in the mooncake_master service and poll that endpoint, similar to how the metadata service is checked.

### 执行完整测试

```bash
cd scripts && ./test_demo.sh
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The example command to execute a full test is incorrect. The path scripts is not where the test scripts are located, and test_demo.sh is not one of the scripts added in this PR. This can be confusing for users trying to run the tests locally. Please update the example to reflect the correct path and a valid script name, for example test_1p1d_erdma.sh.

Suggested change
cd scripts && ./test_demo.sh
cd scripts/tone_tests/scripts && ./test_1p1d_erdma.sh

fi
}

main No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The file is missing a final newline character. This can cause unexpected behavior, especially if the script is sourced by another script. Please add a newline at the end of the file.

@luketong777 luketong777 force-pushed the add_e2e_tests branch 2 times, most recently from f54f7d9 to b74ec3b Compare December 9, 2025 04:46
Signed-off-by: lukotong-7 <shicanwei.scw@alibaba-inc.com>
Signed-off-by: lukotong-7 <shicanwei.scw@alibaba-inc.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant