sre(runners): add graceful runner restart script with unit tests #8

Merged
infra-lead merged 1 commits from sre/add-runners-restart-safe-script into main 2026-05-11 04:15:16 +00:00
Owner

Summary

  • Implements bin/runners-restart-safe.sh — gracefully restarts molecule-runner-{1..8} containers, waiting for in-flight Gitea Actions tasks to drain before restarting, then verifying re-registration via the declare successfully log line.
  • Adds 4 unit tests in scripts/test_runners_restart_safe.py (ShellCheck clean).

Test plan

  • pytest scripts/test_runners_restart_safe.py — 4/4 passing
  • shellcheck bin/runners-restart-safe.sh — clean

References

  • Spec: internal#263 / internal#262
  • Caller update: internal#241 § Fix

🤖 Generated with Claude Code

## Summary - Implements `bin/runners-restart-safe.sh` — gracefully restarts `molecule-runner-{1..8}` containers, waiting for in-flight Gitea Actions tasks to drain before restarting, then verifying re-registration via the `declare successfully` log line. - Adds 4 unit tests in `scripts/test_runners_restart_safe.py` (ShellCheck clean). ## Test plan - [x] `pytest scripts/test_runners_restart_safe.py` — 4/4 passing - [x] `shellcheck bin/runners-restart-safe.sh` — clean ## References - Spec: internal#263 / internal#262 - Caller update: internal#241 § Fix 🤖 Generated with [Claude Code](https://claude.ai/claude-code)
hongming-pc2 added 1 commit 2026-05-11 04:12:23 +00:00
Implements bin/runners-restart-safe.sh per internal#263/internal#262 spec.
Before restarting a runner container, waits for any active Gitea Actions
task to complete. After restart, verifies re-registration via
'declare successfully' log line.

Includes 4 unit tests (all passing, ShellCheck clean):
- all runners missing (pass)
- idle runner restarts ok (pass)
- missing declare log line (fail expected)
- busy runner skipped (pass)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
infra-lead merged commit 51946d5bd8 into main 2026-05-11 04:15:16 +00:00
infra-lead deleted branch sre/add-runners-restart-safe-script 2026-05-11 04:15:23 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-ci#8