fix: replace legacy speedtest container during StreamScope cutover
This commit is contained in:
parent
45d4091051
commit
0360fbba55
1 changed files with 37 additions and 0 deletions
37
tests/test_streamscope_deploy.py
Normal file
37
tests/test_streamscope_deploy.py
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
import app
|
||||||
|
|
||||||
|
|
||||||
|
def test_streamscope_deploy_replaces_legacy_container_before_compose(monkeypatch):
|
||||||
|
files = {path: "placeholder" for path in app.SPEEDTEST_REPO_FILES}
|
||||||
|
files["compose.yaml"] = """services:
|
||||||
|
streamscope:
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- '127.0.0.1:8080:8080'
|
||||||
|
environment:
|
||||||
|
ADMIN_PASSWORD: "${ADMIN_PASSWORD:?required}"
|
||||||
|
SESSION_SECRET: "${SESSION_SECRET:?required}"
|
||||||
|
volumes:
|
||||||
|
- /app-config/speedtest/data:/data
|
||||||
|
cap_add:
|
||||||
|
- NET_RAW
|
||||||
|
"""
|
||||||
|
files["Dockerfile"] = "FROM python:3.13-slim\nRUN apt-get install -y mtr-tiny\n"
|
||||||
|
commands = []
|
||||||
|
|
||||||
|
monkeypatch.setattr(app, "_remote_python", lambda script: (0, "", ""))
|
||||||
|
|
||||||
|
def fake_ssh(host, command, timeout=600):
|
||||||
|
commands.append(command)
|
||||||
|
return 0, "ok", ""
|
||||||
|
|
||||||
|
monkeypatch.setattr(app, "_ssh", fake_ssh)
|
||||||
|
result = app._deploy_speedtest_compose(
|
||||||
|
files,
|
||||||
|
"correct-horse-battery-staple",
|
||||||
|
"streamscope-session-secret-with-entropy",
|
||||||
|
)
|
||||||
|
|
||||||
|
deploy = next(command for command in commands if "compose up -d --remove-orphans" in command)
|
||||||
|
assert "docker rm -f speedtest" in deploy
|
||||||
|
assert result["application"] == "streamscope"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue