teleo-infrastructure/tests/test_teleo_agent_systemd.py
2026-06-26 01:19:16 +02:00

30 lines
1.2 KiB
Python

from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[1]
def test_teleo_agent_template_supports_optional_per_agent_env_file():
unit = (REPO_ROOT / "systemd" / "teleo-agent@.service").read_text()
assert "Environment=PYTHONUNBUFFERED=1" in unit
assert "EnvironmentFile=-/opt/teleo-eval/secrets/teleo-agent-%i.env" in unit
def test_deploy_scripts_restart_wallet_test_agent_when_present():
auto_deploy = (REPO_ROOT / "deploy" / "auto-deploy.sh").read_text()
manual_deploy = (REPO_ROOT / "deploy" / "deploy.sh").read_text()
assert "add_restart_if_unit_exists teleo-agent@leo-wallet-test" in auto_deploy
assert 'systemctl list-units --all --full "$1.service"' in auto_deploy
assert "teleo-agent@leo-wallet-test" in manual_deploy
def test_auto_deploy_prefers_github_remote_when_present():
auto_deploy = (REPO_ROOT / "deploy" / "auto-deploy.sh").read_text()
assert 'DEPLOY_REMOTE="${TELEO_DEPLOY_REMOTE:-}"' in auto_deploy
assert 'remote get-url github' in auto_deploy
assert 'git fetch "$DEPLOY_REMOTE" main' in auto_deploy
assert 'git rev-parse "$DEPLOY_REMOTE/main"' in auto_deploy
assert 'git merge --ff-only "$DEPLOY_REMOTE/main"' in auto_deploy