test(test-e2e-playwright): read the onion multipliers through the cached loader and the role-file constant

The flavor-coverage test from 214e7e29d1 read the role's vars with
yaml.safe_load(VARS_PATH.read_text()) and spelled "vars" / "main.yml"
out by hand. test_no_uncached_file_reads forbids a direct .read_text
and test_file_spot requires the ROLE_FILE_* constants, so the file now
loads through utils.cache.yaml.load_yaml_any and joins
ROLE_FILE_VARS_MAIN. What the test asserts is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5 committed 2026-09-11 14:29:37 +02:00
1 parent 0d1db79d3d
commit 50a13c755b
1 file changed
+4 -3
@@ -1,16 +1,17 @@
import unittest
import yaml
from utils.cache.yaml import load_yaml_any
from utils.roles.mapping import ROLE_FILE_VARS_MAIN
from . import PROJECT_ROOT
VARS_PATH = PROJECT_ROOT / "roles" / "test-e2e-playwright" / "vars" / "main.yml"
VARS_PATH = PROJECT_ROOT / "roles" / "test-e2e-playwright" / ROLE_FILE_VARS_MAIN
FLAVOR_DIR = PROJECT_ROOT / "roles" / "svc-net-tor" / "tasks" / "flavor"
class TestOnionTimeoutMultipliers(unittest.TestCase):
def test_every_tor_flavor_has_a_multiplier(self):
multipliers = yaml.safe_load(VARS_PATH.read_text())[
multipliers = load_yaml_any(str(VARS_PATH))[
"TEST_E2E_PLAYWRIGHT_ONION_TIMEOUT_MULTIPLIERS"
]
flavors = {path.name for path in FLAVOR_DIR.iterdir() if path.is_dir()}