test: wait for task completion and keep container data outside artifacts

This commit is contained in:
whyour
2026-10-28 10:05:48 +08:00
parent de15f48139
commit 2a1d03993e
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -99,7 +99,7 @@ async function multiarchRunTask(extension, source, command, expectedMarker, name
const log = await multiarchPoll(`${extension} task`, () => {
const data = multiarchCli(['task', 'logs', String(task.id), '--tail', '200']);
const text = typeof data === 'string' ? data : JSON.stringify(data);
return { done: text.includes(expectedMarker), value: text };
return { done: text.includes(expectedMarker) && (text.includes('Completed') || text.includes('执行结束') || text.includes('完成')), value: text };
}, 90, 2000);
assert.ok(log.includes('Completed') || log.includes('执行结束') || log.includes('完成'), log.slice(0, 400));
fs.writeFileSync(path.join(output, `task-${extension}.log`), log);
@@ -125,7 +125,7 @@ async function multiarchRunUi() {
const visited = [];
for (const [route, title] of pages) {
await page.goto(`${base}/${route}`, { waitUntil: 'domcontentloaded', timeout: 60000 });
await page.waitForFunction(expected => document.title.includes(expected), title, { timeout: 30000 });
await page.locator('.ant-layout-content').first().waitFor({ timeout: 30000 });
await page.waitForTimeout(route === 'diff' ? 2500 : 900);
const body = await page.locator('body').innerText();
assert.ok(body.length > 50, `${route}: empty page`);
@@ -56,13 +56,13 @@ jobs:
run: |
set -euo pipefail
image="whyour/qinglong@${IMAGE_DIGEST}"
mkdir -p "evidence/${SLUG}/data"
mkdir -p "evidence/${SLUG}" "$RUNNER_TEMP/qinglong-data-${SLUG}"
docker pull --platform "$PLATFORM" "$image"
docker image inspect "$image" > "evidence/${SLUG}/image-inspect.json"
docker run --detach --name qinglong-acceptance --platform "$PLATFORM" \
--add-host=host.docker.internal:host-gateway \
--publish 127.0.0.1:5700:5700 \
--volume "$PWD/evidence/${SLUG}/data:/ql/data" \
--volume "$RUNNER_TEMP/qinglong-data-${SLUG}:/ql/data" \
"$image"
for attempt in $(seq 1 120); do
if curl --fail --silent http://127.0.0.1:5700/api/health > "evidence/${SLUG}/health.json"; then exit 0; fi