Files
truf-server/tests/test_distributed_core_profile.py
T
2026-09-30 20:30:56 +03:00

53 lines
1.6 KiB
Python

import sys
from pathlib import Path
import yaml
ROOT = Path(__file__).resolve().parents[1]
APP = ROOT / 'app'
if str(APP) not in sys.path:
sys.path.insert(0, str(APP))
import lifecycle_authority
import supervisor
def _config():
return yaml.safe_load((APP / 'config.linux.yaml').read_text(encoding='utf-8'))
def test_default_distributed_core_profile_is_exact():
config = _config()
expected = list(lifecycle_authority.DISCOVERY_PRODUCER_SOURCES)
assert config['supervisor']['enabled_sources'] == expected
assert supervisor.get_enabled_sources(
config,
config['supervisor']['enabled_sources'],
config['supervisor'],
) == expected
assert 'github' not in expected
assert 'package_git' not in expected
assert 'keychecks' not in expected
def test_keychecks_are_independent_from_discovery_profile():
config = _config()
assert config['keychecks']['enabled'] is True
assert supervisor.should_manage_keychecks(
config,
config['supervisor'],
','.join(lifecycle_authority.DISCOVERY_PRODUCER_SOURCES),
) is True
config['keychecks']['enabled'] = False
assert supervisor.should_manage_keychecks(config, config['supervisor']) is False
def test_core_wrapper_selects_only_discovery_producers():
wrapper = (ROOT / 'start_core_runtime.ps1').read_text(encoding='utf-8')
assert "$CoreSources = 'gitlab,dockerhub,huggingface'" in wrapper
assignment = next(line for line in wrapper.splitlines() if line.startswith('$CoreSources = '))
assert 'github,' not in assignment
assert 'package_git' not in assignment
assert 'keychecks' not in assignment