Files
Viano-Core/tests/clientless/test_adventure_async_database.py
T
Nico d3273c677e
clang PCH / build (push) Canceled after 0s
GCC PCH / build (push) Canceled after 0s
Implement AdventureBot profiles, daily planning and population management
2026-10-28 18:22:13 +01:00

20 lines
1.4 KiB
Python

"""Validate database contracts used by the asynchronous native creation path."""
from pathlib import Path
import re
root=Path(__file__).resolve().parents[2]
registration=(root/'src/server/database/Database/Implementation/LoginDatabase.cpp').read_text()
for name in ('LOGIN_INS_ACCOUNT','LOGIN_REP_REALM_CHARACTERS'):
match=re.search(r'PrepareStatement\('+name+r',\s*"([^"]+)",\s*(\w+)\)',registration)
assert match and match[2] in ('CONNECTION_ASYNC','CONNECTION_BOTH'),name+' unavailable on async connection'
factory=(root/'src/server/game/World/ClientlessCharacterFactory.cpp').read_text().split('void ClientlessCharacterFactory::CreateAsync(')[1]
assert 'x.AccountID=a.id' in factory and 'x.SecurityLevel' in factory
assert 'x.gmlevel' not in factory and 'x.id=a.id' not in factory
assert '.m_future.get(' not in factory and '.wait(' not in factory
assert 'FactorySaves->AddCallback' in factory and 'if(!ok)' in factory
assert factory.index('if(!ok)')<factory.index('AddCharacterCacheEntry')<factory.index('done({guid')
loader=(root/'src/server/game/World/AdventurePopulationMgr.cpp').read_text()
assert '.m_future.get(' not in loader and '.wait(' not in loader
world=(root/'src/server/game/World/World.cpp').read_text()
assert 'sAdventurePopulationMgr->Update(diff)' in world
print('Async creation DB contracts: prepared connection masks, native security column names, no future waits, successful-save cache publication and world-update-only loader hook passed')