fix(account): close deletion cache gap
Require authenticated sidecar cache purge before a deletion can complete and keep failures retryable. Mount tombstones outside restored application data while leaving deletion disabled by default.
This commit is contained in:
@@ -510,6 +510,22 @@ def test_health_stays_open_so_probes_and_healthchecks_work(monkeypatch):
|
||||
assert client.get("/health").status_code == 200
|
||||
|
||||
|
||||
def test_cache_purge_requires_service_token_and_clears_content(monkeypatch):
|
||||
module = load_app_module(monkeypatch, service_token="s3cret")
|
||||
module.cache["synthetic-key"] = "synthetic-summary"
|
||||
client = TestClient(module.app)
|
||||
|
||||
assert client.delete("/maintenance/cache").status_code == 401
|
||||
response = client.delete(
|
||||
"/maintenance/cache",
|
||||
headers={"X-Ai-Service-Token": "s3cret"},
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {"cleared": 1}
|
||||
assert len(module.cache) == 0
|
||||
|
||||
|
||||
def test_endpoints_stay_open_when_no_token_is_configured(monkeypatch):
|
||||
module = load_app_module(monkeypatch)
|
||||
client = TestClient(module.app)
|
||||
|
||||
Reference in New Issue
Block a user