fix: expose failed deployment container logs

This commit is contained in:
2026-08-25 11:41:25 +08:00
parent 6ba4537d3d
commit d066381ae2
2 changed files with 20 additions and 0 deletions
@@ -54,6 +54,9 @@ case "$command" in
*) exit 2 ;;
esac
;;
logs)
echo 'mock startup failure'
;;
*)
echo "unexpected docker command: $command $*" >&2
exit 2
@@ -129,6 +132,9 @@ test('unhealthy deployment restores the previous healthy image and still fails t
assert.equal(result.status, 1, output)
assert.match(output, /新镜像健康检查失败: registry\.local\/group\/firstleg\/audit-service:newbad/)
assert.match(output, /新镜像容器最近日志(最多 200 行):/)
assert.match(output, /mock startup failure/)
assert.match(result.dockerLog, /logs --tail 200 mock-container/)
assert.match(output, /开始自动回滚到: registry\.local\/group\/firstleg\/audit-service:oldgood/)
assert.match(output, /自动回滚成功: registry\.local\/group\/firstleg\/audit-service:oldgood/)
assert.match(result.dockerLog, /pull registry\.local\/group\/firstleg\/audit-service:oldgood/)