peppa/packages/testkit/bin/mock-act-runner
peppa-bot 4ae203e037
All checks were successful
peppa/lint lint: success за 2с
peppa/typecheck typecheck: success за 49с
peppa/build build: success за 35с
peppa/bundle bundle: success за 0с
peppa/test test: success за 1652с
peppa-ci / ci (pull_request) Successful in 29m39s
PEP-320: один демон исполнителя проверок на регистрацию
supervise.sh пишет в .pid номер самого демона, журнал без буфера sed,
лишних демонов каталога останавливает SIGTERM; register.sh сначала
останавливает прежнего демона. Тест с mock-act-runner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 13:42:33 +00:00

17 lines
909 B
Bash
Executable File

#!/bin/sh
# mock-act-runner — stands in for `act_runner` of the gitea/act_runner image (PEP-320 test).
# The test links it as <tmp>/act_runner so supervise.sh recognises it by its command line, as the real one.
# register --config … --name <n> … → writes a new .runner in the current directory (unique each time)
# daemon --config … → runs until SIGTERM (graceful exit, like act_runner), logs to stdout
case "$1" in
register)
printf '{"id":%s,"uuid":"mock-%s-%s","name":"%s"}\n' "$$" "$$" "$(date +%s)" "$*" > .runner
echo "mock runner registered successfully" ;;
daemon)
[ -f .runner ] || { echo "mock: no .runner here" >&2; exit 1; }
trap 'echo "mock daemon $$ stopping gracefully"; exit 0' TERM
echo "mock daemon $$ declare successfully"
while :; do sleep 1 & wait $!; done ;;
*) echo "mock-act-runner: unknown command $1" >&2; exit 2 ;;
esac