From 19ffa1fa175e8c746debb58f9e53321d33eeba12 Mon Sep 17 00:00:00 2001 From: ThearchyHelios Date: Mon, 19 Oct 2026 14:40:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=EF=BC=9A=E9=9A=94=E7=A6=BB?= =?UTF-8?q?=E4=B9=8B=E5=90=8E=E9=87=8D=E6=96=B0=E7=99=BB=E8=AE=B0=E3=80=81?= =?UTF-8?q?=E6=94=B6=E6=8B=BE=E6=97=A7=E8=BA=AB=E4=BB=BD=E7=9A=84=E4=B8=A4?= =?UTF-8?q?=E6=9D=A1=E7=94=A8=E8=99=9A=E6=9E=84=E7=9A=84=E6=97=A7=E8=BA=AB?= =?UTF-8?q?=E4=BB=BD=EF=BC=88=E4=B8=8D=E6=8B=BF=E6=9C=AC=E8=BF=9B=E7=A8=8B?= =?UTF-8?q?=E7=9C=9F=E7=9A=84=E8=BA=AB=E4=BB=BD=E5=BD=93=E6=97=A7=E8=BA=AB?= =?UTF-8?q?=E4=BB=BD=E6=94=B6=E6=8B=BE=EF=BC=8C=E5=85=8D=E5=BE=97=E5=88=A0?= =?UTF-8?q?=E5=88=B0=E5=90=8C=E4=B8=80=E4=B8=AA=E6=B5=8B=E8=AF=95=E8=BF=9B?= =?UTF-8?q?=E7=A8=8B=E9=87=8C=E5=89=8D=E9=9D=A2=E7=95=99=E4=B8=8B=E7=9A=84?= =?UTF-8?q?=E3=80=81=E5=B1=9E=E4=B8=BB=E6=98=AF=E5=AE=83=E7=9A=84=E8=A1=8C?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/tests/test_cluster.py | 2 +- backend/tests/test_cluster_fence.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/tests/test_cluster.py b/backend/tests/test_cluster.py index 580e5377..dcaa42eb 100644 --- a/backend/tests/test_cluster.py +++ b/backend/tests/test_cluster.py @@ -356,7 +356,7 @@ async def test_registering_again_tidies_up_what_the_retired_identity_left(monkey from app.cluster import service as service_mod from app.cluster.fence import now as fence_now - monkeypatch.setattr(identity, "OWNER", identity.OWNER) + monkeypatch.setattr(identity, "OWNER", f"{identity.host()}:{os.getpid()}:retired0") # 测试完换回原来的身份 old = identity.owner() now = utcnow() async with SessionLocal() as session: diff --git a/backend/tests/test_cluster_fence.py b/backend/tests/test_cluster_fence.py index 5d3908bb..906db81e 100644 --- a/backend/tests/test_cluster_fence.py +++ b/backend/tests/test_cluster_fence.py @@ -5,6 +5,7 @@ from __future__ import annotations import asyncio import contextlib +import os import pytest from sqlalchemy import func, select @@ -237,7 +238,7 @@ async def test_the_lease_task_keeps_going_when_registering_again_fails(monkeypat from app.cluster import identity, service as service_mod, workers from app.cluster.version import VersionMismatch - monkeypatch.setattr(identity, "OWNER", identity.OWNER) # 测试完换回原来的身份 + monkeypatch.setattr(identity, "OWNER", f"{identity.host()}:{os.getpid()}:retired1") # 测试完换回原来的身份 monkeypatch.setattr(workers, "heartbeat_s", lambda: 0.01) monkeypatch.setattr(workers, "lease_s", lambda: 5.0) svc = service_mod._Service()