fix(gateway): avoid restarting stopped systemd services

This commit is contained in:
chengyongru authored and chengyongru committed 2026-11-10 23:47:23 +08:00
1 parent 62c05e7f7e
commit 0ce335bf12
5 files changed
+16 -10

No files matched your search

+4 -2
View File
@@ -337,7 +337,8 @@ def test_gateway_background_does_not_claim_a_foreground_gateway(tmp_path):
assert result.exit_code == 1
assert "cannot be" in result.stdout
assert "detached in place" in result.stdout
assert "Stop it in its current terminal" in result.stdout
assert "service manager" in result.stdout
assert "nanobot gateway stop" in result.stdout
def test_gateway_rejects_conflicting_modes(tmp_path):
@@ -522,7 +523,8 @@ def test_gateway_restart_explains_foreground_lifecycle(tmp_path):
result = runner.invoke(app, ["gateway", "restart"])
assert result.exit_code == 1
assert "attached to a foreground terminal" in result.stdout
assert "running in the foreground" in result.stdout
assert "service manager" in result.stdout
def test_gateway_install_service_uses_service_installer(tmp_path):
+2
View File
@@ -38,6 +38,8 @@ def test_systemd_install_dry_run_renders_user_unit(tmp_path):
assert 'WorkingDirectory="/tmp/nanobot workspace"' in result.content
assert 'ExecStart=/venv/bin/python -m nanobot gateway --foreground --port 18790 --verbose' in result.content
assert '--workspace "/tmp/nanobot workspace" --config /tmp/nanobot/config.json' in result.content
assert 'Restart=on-failure' in result.content
assert 'SuccessExitStatus=SIGTERM' in result.content
def test_systemd_install_writes_unit_and_runs_commands(tmp_path):