6ede33ccdb
Build and Push Docker Images / create_manifest (web, surfsense-web, , cpu) (push) Has been cancelled
Build and Push Docker Images / finalize_release (push) Has been cancelled
Obsidian Plugin Lint / lint (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-24.04-arm, linux/arm64, arm64, , runner, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-latest, linux/amd64, amd64, , runner, false, cpu) (push) Has been cancelled
Build and Push Docker Images / compute_version (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, , production, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, , production, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda126, production, true, cuda126) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda126, production, true, cuda126) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda, production, true, cuda) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda, production, true, cuda) (push) Has been cancelled
Build and Push Docker Images / verify_digests (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, , cpu) (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda, cuda) (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda126, cuda126) (push) Has been cancelled
48 lines
1.3 KiB
Python
48 lines
1.3 KiB
Python
from __future__ import annotations
|
|
|
|
import asyncio
|
|
|
|
import pytest
|
|
|
|
from app.gateway import inbox_worker
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_inbox_worker_claims_and_processes_in_fastapi_process(
|
|
mocker, monkeypatch
|
|
):
|
|
claim = mocker.AsyncMock(return_value=7)
|
|
process = mocker.AsyncMock(side_effect=asyncio.CancelledError)
|
|
monkeypatch.setattr(inbox_worker, "claim_next_inbound_event", claim)
|
|
monkeypatch.setattr(inbox_worker, "process_inbound_event", process)
|
|
|
|
with pytest.raises(asyncio.CancelledError):
|
|
await inbox_worker._process_inbox_forever()
|
|
|
|
claim.assert_awaited_once()
|
|
process.assert_awaited_once_with(7)
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_start_stop_gateway_inbox_worker(mocker, monkeypatch):
|
|
started = asyncio.Event()
|
|
stopped = asyncio.Event()
|
|
monkeypatch.setattr(inbox_worker.config, "GATEWAY_ENABLED", True)
|
|
|
|
async def run_forever():
|
|
started.set()
|
|
try:
|
|
await asyncio.Event().wait()
|
|
finally:
|
|
stopped.set()
|
|
|
|
monkeypatch.setattr(inbox_worker, "_process_inbox_forever", run_forever)
|
|
inbox_worker._task = None
|
|
|
|
await inbox_worker.start_gateway_inbox_worker()
|
|
await asyncio.wait_for(started.wait(), timeout=1)
|
|
await inbox_worker.stop_gateway_inbox_worker()
|
|
|
|
assert stopped.is_set()
|
|
assert inbox_worker._task is None
|