fix(ci): run the full Managed Agent unit suite in the fast tier

The fast tier skipped mysql-integration, the only lane that runs the
module's ~4,200-test H2 suite in full, so a PR push got no unit
feedback until the review-triggered full run. In the fast tier the
Java 21 leg now runs the whole module suite instead of its Runtime
Broker subset, after the same workspace install mysql-integration uses:
part of the suite loads the built Core and CLI JavaScript.
This commit is contained in:
yiliang114 2026-10-17 10:02:45 +08:00
parent f29c6a1bbb
commit 7d918f7740
4 changed files with 72 additions and 3 deletions

View file

@ -186,6 +186,12 @@ jobs:
node-version: '22'
package-manager-cache: false
# The fast tier runs the full module suite below, which loads the built
# Core and CLI JavaScript, as mysql-integration's suite does.
- name: 'Build Managed Agent JavaScript prerequisites (fast tier)'
if: "${{ inputs.tier == 'fast' }}"
run: 'corepack pnpm install --frozen-lockfile --prefer-offline --reporter=append-only'
- name: 'Set up Maven (self-hosted)'
if: "${{ runner.environment == 'self-hosted' }}"
run: |-
@ -201,6 +207,7 @@ jobs:
env:
MAVEN_ARGS: '--settings ${{ runner.temp }}/setup-java-m2/settings.xml --toolchains ${{ runner.temp }}/setup-java-m2/toolchains.xml'
MATRIX_JAVA: '${{ matrix.java }}'
TIER: '${{ inputs.tier }}'
run: |-
mkdir -p "${HOME}/.cache/qwen-code-ci"
exec 9>"${HOME}/.cache/qwen-code-ci/sdk-java-tests.lock"
@ -212,7 +219,12 @@ jobs:
if [ "${MATRIX_JAVA}" = "21" ]; then
mvn --batch-mode --no-transfer-progress -DskipTests -Dgpg.skip=true -Dmaven.javadoc.skip=true install
cd ../../managed-agent-server
mvn --batch-mode --no-transfer-progress '-Dtest=com/alibaba/qwen/code/runtimebroker/**/Test*.java,com/alibaba/qwen/code/runtimebroker/**/*Test.java,com/alibaba/qwen/code/runtimebroker/**/*Tests.java,com/alibaba/qwen/code/runtimebroker/**/*TestCase.java' clean test
# The fast tier skips mysql-integration, which owns the full H2 unit suite.
if [ "${TIER}" = "fast" ]; then
mvn --batch-mode --no-transfer-progress clean test
else
mvn --batch-mode --no-transfer-progress '-Dtest=com/alibaba/qwen/code/runtimebroker/**/Test*.java,com/alibaba/qwen/code/runtimebroker/**/*Test.java,com/alibaba/qwen/code/runtimebroker/**/*Tests.java,com/alibaba/qwen/code/runtimebroker/**/*TestCase.java' clean test
fi
fi
- name: 'Run Java SDK tests (hosted)'
@ -228,9 +240,14 @@ jobs:
shell: 'bash'
env:
MAVEN_ARGS: '--settings ${{ runner.temp }}/setup-java-m2/settings.xml --toolchains ${{ runner.temp }}/setup-java-m2/toolchains.xml'
TIER: '${{ inputs.tier }}'
run: |-
mvn --batch-mode --no-transfer-progress -f ../sdk-java/qwencode/pom.xml -DskipTests -Dgpg.skip=true -Dmaven.javadoc.skip=true install
mvn --batch-mode --no-transfer-progress '-Dtest=com/alibaba/qwen/code/runtimebroker/**/Test*.java,com/alibaba/qwen/code/runtimebroker/**/*Test.java,com/alibaba/qwen/code/runtimebroker/**/*Tests.java,com/alibaba/qwen/code/runtimebroker/**/*TestCase.java' clean test
if [ "${TIER}" = "fast" ]; then
mvn --batch-mode --no-transfer-progress clean test
else
mvn --batch-mode --no-transfer-progress '-Dtest=com/alibaba/qwen/code/runtimebroker/**/Test*.java,com/alibaba/qwen/code/runtimebroker/**/*Test.java,com/alibaba/qwen/code/runtimebroker/**/*Tests.java,com/alibaba/qwen/code/runtimebroker/**/*TestCase.java' clean test
fi
- name: 'Run Java SDK Checkstyle'
if: "${{ matrix.os == 'ubuntu-latest' && matrix.java == '11' }}"

View file

@ -57,6 +57,13 @@ to the Linux Java 21 leg and skips `mysql-integration`, `hosted-harness-mysql`,
including none, runs every lane, so the release and nightly paths are
unchanged.
Skipping `mysql-integration` would also skip the Managed Agent Server H2 unit
suite, which only that lane runs in full. In the fast tier, the Java 21 leg
runs the whole module suite in place of its Runtime Broker subset. Part of the
suite loads the built Core and CLI JavaScript, so the leg first runs the same
workspace install as `mysql-integration`. Together that adds about 16 minutes:
5 for the install on the ECS pool, 11 for the tests.
### Path scope
`.github/scripts/managed-agent-gate-scope.mjs` matches the changed paths:

View file

@ -48,6 +48,12 @@
`event-transport-multi-node`。其他取值(包括不传)都运行全部检查项,因此发布与夜间
路径不变。
跳过 `mysql-integration` 也会跳过 Managed Agent Server 的 H2 单元测试,完整的这套
测试只在该检查项里跑。fast 层中,Java 21 一条改为运行整个模块的单元测试,代替原来的
Runtime Broker 子集。其中一部分测试要加载已构建的 Core 与 CLI JavaScript,所以这一条先执行与
`mysql-integration` 相同的 workspace 安装。合计约多 16 分钟:ECS 池上安装约 5 分钟,
测试约 11 分钟。
### 路径范围
`.github/scripts/managed-agent-gate-scope.mjs` 匹配变更路径:

View file

@ -98,12 +98,18 @@ describe('SDK Java self-hosted workflow guards', () => {
const block = step(job('test'), 'Run Java SDK tests (self-hosted)');
expect(block).toContain("working-directory: 'packages/sdk-java/qwencode'");
expect(block).toContain("MATRIX_JAVA: '${{ matrix.java }}'");
expect(block).toContain("TIER: '${{ inputs.tier }}'");
expect(block).toContain(
'mvn --batch-mode --no-transfer-progress clean test\n' +
' if [ "${MATRIX_JAVA}" = "21" ]; then\n' +
' mvn --batch-mode --no-transfer-progress -DskipTests -Dgpg.skip=true -Dmaven.javadoc.skip=true install\n' +
' cd ../../managed-agent-server\n' +
` mvn --batch-mode --no-transfer-progress '-Dtest=${brokerTestPattern}' clean test\n` +
' # The fast tier skips mysql-integration, which owns the full H2 unit suite.\n' +
' if [ "${TIER}" = "fast" ]; then\n' +
' mvn --batch-mode --no-transfer-progress clean test\n' +
' else\n' +
` mvn --batch-mode --no-transfer-progress '-Dtest=${brokerTestPattern}' clean test\n` +
' fi\n' +
' fi',
);
});
@ -122,6 +128,39 @@ describe('SDK Java self-hosted workflow guards', () => {
block.indexOf('clean test'),
);
expect(block).toContain(`'-Dtest=${brokerTestPattern}'`);
expect(block).toContain("TIER: '${{ inputs.tier }}'");
expect(hosted.run).toContain(
'if [ "${TIER}" = "fast" ]; then\n' +
' mvn --batch-mode --no-transfer-progress clean test\n' +
'else\n' +
` mvn --batch-mode --no-transfer-progress '-Dtest=${brokerTestPattern}' clean test\n` +
'fi',
);
});
it('builds the JavaScript the full module suite loads before the fast tier runs it', () => {
const steps = parse(workflow).jobs.test.steps;
const names = steps.map((candidate) => candidate.name);
const build = steps.find(
(candidate) =>
candidate.name ===
'Build Managed Agent JavaScript prerequisites (fast tier)',
);
expect(build.if).toBe("${{ inputs.tier == 'fast' }}");
expect(build.run).toBe(
parse(workflow).jobs['mysql-integration'].steps.find(
(candidate) => candidate.name === 'Build native producer prerequisites',
).run,
);
for (const later of [
'Run Java SDK tests (self-hosted)',
'Run Runtime Broker state tests',
]) {
expect(names.indexOf(build.name)).toBeLessThan(names.indexOf(later));
}
expect(names.indexOf('Set up Node.js 22 (hosted)')).toBeLessThan(
names.indexOf(build.name),
);
});
it.skipIf(process.platform === 'win32').each([0, 23])(