跳转至

E2E CI 测试

本文档说明如何通过评论命令针对您的PR代码触发特定的E2E测试,而无需运行PR选定的测试套件。

背景

当 PR 带有 ready-precise、ready-all、ready-a5 或 main2main 标签之一时,E2E 工作流(pr_test.yaml)会运行一组由 PR 选定的测试。main2main 会运行两遍完整测试套件,一遍针对已验证的 vLLM main 提交,一遍针对匹配的 vLLM 发布标签。在发布分支(releases/v*)上,工作流只测试匹配的 vLLM 发布标签,因为这些分支与已发布的上游版本相匹配。 这会消耗大量 CI 资源和时间。

授权用户可以通过在PR上发布/e2e评论,仅触发他们关心的特定测试文件。

如何触发

1. 发布评论

在PR上发布评论,指定要运行的测试路径:

/e2e [test-path-1] [test-path-2] ...
  • 每个路径必须是相对于仓库根目录的有效 pytest 路径。
  • 可以在单条评论中列出多个路径,用空格分隔。
  • 可以使用 :: 表示法定位特定的测试用例。
注释格式 效果
/e2e tests/e2e/pull_request/one_card/test_foo.py 在 one_card 上运行一个测试文件
/e2e tests/e2e/pull_request/two_card/test_bar.py 在 two_card 上运行一个测试文件
/e2e path1 path2 path3 运行多个文件,按路径模式路由
/e2e tests/e2e/pull_request/one_card/test_foo.py::test_case 运行指定的测试用例

评论本身即可触发工作流——无需标签。

2. 等待结果

GitHub Actions将触发Handle /e2e Command工作流。只有与提供的测试路径匹配的硬件任务才会运行,从而节省CI资源。

路径路由规则

工作流通过.github/workflows/scripts/test_config.yaml中的runner_mapping正则表达式模式,将每个测试路径路由到正确的硬件运行器。每个模式映射到一个逻辑分区,该分区从runner_label.json中选择一个确切的运行器标签:

路径模式 硬件 运行器
路径中包含 two_card two_card A3 NPU (560T) linux-aarch64-a3-800i-2
路径中包含 four_card four_card A3 NPU (560T) linux-aarch64-a3-800i-4
one_card 下文件名包含 _310p Ascend 310P x1 linux-aarch64-310p-1
two_card 下文件名包含 _310p Ascend 310P x2 linux-aarch64-310p-2
four_card 下文件名包含 _310p Ascend 310P x4 linux-aarch64-310p-4
所有其他路径 单卡 A2 NPU(B1/B3 混合池) linux-aarch64-a2b1b3-1-hk-001

当单条评论中列出了来自多个类别的路径时,每个类别的测试会在其各自的硬件上并行运行。

测试路径参考

tests/e2e/pull_request/ 目录按硬件类别组织:

tests/e2e/pull_request/
├── one_card/          # Single card tests → A2 NPU x1 runner
├── two_card/          # Two card tests → A3 NPU x2 runner
├── four_card/         # Four card tests → A3 NPU x4 runner

310P 测试在对应卡数目录下使用文件名包含 _310p 的文件:

tests/e2e/pull_request/one_card/_310p/   # 310P single card
tests/e2e/pull_request/two_card/_310p/   # 310P two card
tests/e2e/pull_request/four_card/_310p/  # 310P four card

与PR选定测试的对比

方面 PR选定测试(ready-precise / ready-all) 按测试评论触发
触发方式 标签 /e2e评论
范围 由精度测试流水线(基于覆盖率+AST)推荐的测试,或ready-all下的完整套件 仅指定的测试路径
触发权限 任何可添加标签的人 PR 作者或具有写入/管理员权限的协作者
使用场景 合入前验证 特定测试的迭代调试

示例

运行单个 one_card 测试:

/e2e tests/e2e/pull_request/one_card/test_offline_inference.py

运行 two_card 测试:

/e2e tests/e2e/pull_request/two_card/test_data_parallel.py

在一条评论中跨多个硬件类别运行测试:

/e2e tests/e2e/pull_request/one_card/test_offline_inference.py tests/e2e/pull_request/two_card/test_data_parallel.py

Re-trigger after fixing an issue: pushing a new commit does not start CI by itself. Post /e2e again to re-run these paths, or /run to run the full PR gate on the latest commit.

故障排除

发布评论后工作流未启动。

  • Check that the comment starts exactly with /e2e followed by at least one path, with no leading spaces or extra characters before the slash.
  • To re-trigger after fixing an issue, push the fix and post /e2e again (or /run for the full PR gate on the latest commit).

测试在错误的硬件上运行。

  • 检查路径是否包含预期的目录段(one_card、two_card、four_card 或 _310p)。不匹配这些模式中任何一个的路径默认会路由到 one_card 运行器。

parse-comment 任务因权限错误被跳过。

  • 只有 PR 作者或写入/管理员协作者才能使用评论触发。 请让维护者代为发布 /e2e 评论。