fix(remote): end a remote session from before its create to after its DELETE

This commit is contained in:
imSp4rky
2026-11-30 13:56:59 -07:00
parent 3634fc5686
commit 34a3820eb8
34 changed files with 1719 additions and 276 deletions
+3 -2
View File
@@ -44,6 +44,7 @@ from unshackle.core.utilities import close_debug_logger, init_debug_logger
pytestmark = pytest.mark.unit
KEY = "loopback-key"
OTHER_KEY = "other-key"
CODE = "1234"
@@ -157,7 +158,7 @@ def server(request: pytest.FixtureRequest, monkeypatch: pytest.MonkeyPatch, tmp_
stub_service_build(monkeypatch, lambda: StubService(beats))
app = web.Application(middlewares=[record, cors_middleware, no_5xx_middleware, api_key_authentication])
app["config"] = {"users": [KEY]}
app["config"] = {"users": [KEY, OTHER_KEY]}
setup_routes(app, remote_only=True)
loop = asyncio.new_event_loop()
runner = web.AppRunner(app)
@@ -501,7 +502,7 @@ def test_an_open_channel_keeps_the_session_alive(server: SimpleNamespace, monkey
assert count(server, "GET", SESSION_ROUTE, session_id) == 0
assert count(server, "GET", LOGS_ROUTE) == count(server, "GET", PROMPT_ROUTE) == 0
service.close_channel()
service.lifetime.close_channel()
assert wait_until(lambda: not entry.channel.attached, 5)
assert wait_until(lambda: idle_seconds(entry) > 2 * ttl, 10)
assert on_loop(server, store.cleanup_expired()) == 1