mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-05 23:45:07 +00:00
feat(remote)!: make remote serve WebSocket-only and refuse older clients with CLIENT_OUTDATED
This commit is contained in:
@@ -6,6 +6,7 @@ import asyncio
|
||||
import logging
|
||||
import sys
|
||||
import threading
|
||||
import uuid
|
||||
from collections.abc import Callable
|
||||
from datetime import UTC, datetime, timedelta
|
||||
|
||||
@@ -330,7 +331,8 @@ async def test_drain_refuses_new_work_and_warns_open_sessions(aiohttp_client, da
|
||||
await client.post("/api/dashboard/drain", headers=headers)
|
||||
assert [r["level"] for r in entry.log_buffer.since(0)] == ["WARNING"]
|
||||
|
||||
refused = await client.post("/api/session/create", json={})
|
||||
create = {"session_id": str(uuid.uuid4())}
|
||||
refused = await client.post("/api/session/create", json=create)
|
||||
assert refused.status == 409
|
||||
assert (await refused.json())["error_code"] == "SERVER_DRAINING"
|
||||
with pytest.raises(APIError, match="restarts for an update"):
|
||||
@@ -338,7 +340,7 @@ async def test_drain_refuses_new_work_and_warns_open_sessions(aiohttp_client, da
|
||||
|
||||
body = await (await client.delete("/api/dashboard/drain", headers=headers)).json()
|
||||
assert body["draining"] is False
|
||||
assert (await client.post("/api/session/create", json={})).status == 400
|
||||
assert (await client.post("/api/session/create", json=create)).status == 400
|
||||
finally:
|
||||
store.stop_drain()
|
||||
await store.delete(entry.session_id)
|
||||
|
||||
Reference in New Issue
Block a user