mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-15 00:11:59 +00:00
测试:隔离之后重新登记、收拾旧身份的两条用虚构的旧身份(不拿本进程真的身份当旧身份收拾,免得删到同一个测试进程里前面留下的、属主是它的行)
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user