Retire review deploy and add live Actions
Deploy live / test (push) Successful in 23s
Deploy live / deploy (push) Failing after 1s

This commit is contained in:
2026-08-11 08:03:49 +02:00
parent c65b5c8406
commit 1ed5964554
19 changed files with 115 additions and 478 deletions
+2 -75
View File
@@ -69,7 +69,7 @@ def test_frontend_uses_required_stack_and_capabilities():
assert "lucide-react" in package
assert "@radix-ui/react-dialog" in package
assert "tailwindcss" in package
for endpoint in ("/api/jobs", "/api/settings", "/api/manual-batches", "/api/control/update", "/api/import/run-now"):
for endpoint in ("/api/jobs", "/api/settings", "/api/manual-batches", "/api/import/run-now"):
assert endpoint in app
@@ -156,7 +156,7 @@ def test_control_endpoints_require_configured_bearer_token(tmp_path, monkeypatch
monkeypatch.setattr(main.settings, "auth_token", "test-token")
client = TestClient(main.app)
for method, endpoint in (("get", "/api/control/update-check"), ("post", "/api/control/update"), ("post", "/api/control/restart")):
for method, endpoint in (("post", "/api/control/restart"),):
assert getattr(client, method)(endpoint).status_code == 401
assert getattr(client, method)(endpoint, headers={"Authorization": "Bearer wrong"}).status_code == 401
@@ -178,76 +178,3 @@ def test_tokenless_local_development_remains_available(tmp_path, monkeypatch):
monkeypatch.setattr(main.settings, "auth_token", None)
monkeypatch.setattr(main.settings, "bind_host", "127.0.0.1")
main.require_write_auth()
def test_update_schedules_exact_latest_release_tag(tmp_path, monkeypatch):
monkeypatch.setenv("IMPORTARR_STATE_PATH", str(tmp_path / "state.db"))
import importarr.main as main
monkeypatch.setattr(main, "check_update_available", lambda: {"status": "update_available", "current_version": "v1.0.0", "latest_version": "v1.2.3", "update_available": True})
monkeypatch.setattr(main.settings, "update_command", ["/opt/importarr/repo-upgrade.sh"])
scheduled = []
monkeypatch.setattr(main, "_schedule_update", scheduled.append)
response = main.update_service(expected_tag="v1.2.3")
assert scheduled == [["/opt/importarr/repo-upgrade.sh", "v1.2.3"]]
assert response["status"] == "update_scheduled"
def test_update_is_scheduled_outside_service_cgroup(tmp_path, monkeypatch):
monkeypatch.setenv("IMPORTARR_STATE_PATH", str(tmp_path / "state.db"))
import importarr.main as main
calls = []
def fake_run(command, **kwargs):
calls.append((command, kwargs))
return main.subprocess.CompletedProcess(command, 0, stdout="Running as unit", stderr="")
monkeypatch.setattr(main.subprocess, "run", fake_run)
main._schedule_update(["/bin/sh", "/opt/importarr/repo-upgrade.sh", "v1.2.3"])
assert calls[0][0] == [
"systemd-run",
"--unit=importarr-update",
"--collect",
"--no-block",
"--on-active=2s",
"--",
"/bin/sh",
"/opt/importarr/repo-upgrade.sh",
"v1.2.3",
]
def test_update_endpoint_requires_expected_tag(tmp_path, monkeypatch):
monkeypatch.setenv("IMPORTARR_STATE_PATH", str(tmp_path / "state.db"))
import importarr.main as main
from fastapi.testclient import TestClient
monkeypatch.setattr(main.settings, "auth_token", "test-token")
monkeypatch.setattr(main, "check_update_available", lambda: pytest.fail("release lookup must not run"))
response = TestClient(main.app).post(
"/api/control/update",
headers={"Authorization": "Bearer test-token"},
)
assert response.status_code == 422
assert response.json()["detail"][0]["loc"] == ["query", "expected_tag"]
def test_update_rejects_unexpected_latest_release(tmp_path, monkeypatch):
monkeypatch.setenv("IMPORTARR_STATE_PATH", str(tmp_path / "state.db"))
import importarr.main as main
from fastapi import HTTPException
monkeypatch.setattr(main, "check_update_available", lambda: {"latest_version": "v1.2.4", "update_available": True})
scheduled = []
monkeypatch.setattr(main, "_schedule_update", scheduled.append)
with pytest.raises(HTTPException) as exc_info:
main.update_service(expected_tag="v1.2.3")
assert exc_info.value.status_code == 409
assert scheduled == []