Files
Nexus/tests/test_agent_deploy.py
T

31 lines
921 B
Python
Raw Normal View History

"""Agent upgrade shell fragments stay aligned with install.sh."""
from server.utils.agent_deploy import (
AGENT_INSTALL_DIR,
AGENT_PIP_PACKAGES,
agent_kill_port_cmd,
build_agent_upgrade_cmd,
)
def test_pip_packages_match_install_sh_versions():
joined = " ".join(AGENT_PIP_PACKAGES)
assert "fastapi==0.115.6" in joined
assert "uvicorn==0.34.0" in joined
assert "httpx==0.28.1" in joined
assert "python-multipart==0.0.19" in joined
def test_upgrade_cmd_uses_install_dir_and_port():
cmd = build_agent_upgrade_cmd(
base_url="https://api.example.com",
ssh_user="deploy",
install_dir=AGENT_INSTALL_DIR,
agent_port=8602,
)
assert "/opt/nexus-agent/.venv/bin/python" in cmd
assert "heartbeat_policy.py" in cmd
assert agent_kill_port_cmd(8602) in cmd
assert "upgrade_ok" in cmd
assert "sudo systemctl restart nexus-agent" in cmd