Push builds have been RED on the lint step since ~build 209 from accumulated formatting drift. This is the mechanical cleanup: ruff format + ruff --fix (UP038 isinstance unions, SIM105 contextlib.suppress, UP031 f-strings, SIM115 tempfile context manager), shfmt -i 2 -ci, nixpkgs-fmt/statix/deadnix (merged attrsets, dropped unused lib args), yamllint, and shell quoting fixes in tests/lasuite-docs/setup_custom_tests.sh. No behaviour changes intended; lint: PASS, unit tests: 138 passed.
39 lines
1.8 KiB
Python
39 lines
1.8 KiB
Python
"""mumble — recipe-specific functional test #2 (Phase 2 P3, beyond parity).
|
|
|
|
Server-limit config round-trip via the ServerConfig protocol message. The harness deploys with a
|
|
distinctive USERS value (recipe_meta.EXTRA_ENV -> MUMBLE_CONFIG_USERS, the server's max-users cap,
|
|
set to a non-default 42). A client that completes the handshake receives a ServerConfig message
|
|
carrying the server's enforced limits (max_users, allow_html, message_length, ...). Asserting
|
|
max_users == our configured value proves the recipe wires deploy-time limits into the running
|
|
server and enforces them — a distinctive, characteristic mumble behaviour (server capacity policy),
|
|
not health-only. Version-independent (asserts OUR configured value).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import sys
|
|
|
|
sys.path.insert(0, os.path.dirname(__file__))
|
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
|
import _mumble_proto # noqa: E402
|
|
import recipe_meta # noqa: E402
|
|
|
|
|
|
def test_configured_max_users_surfaces_in_serverconfig(live_app):
|
|
r = _mumble_proto.retry_handshake(attempts=12, interval=5.0)
|
|
|
|
assert r["server_sync"], f"ServerSync handshake did not complete — {r.get('error')}"
|
|
cfg = r["server_config"]
|
|
assert cfg, f"server did not send a ServerConfig message — {r!r}"
|
|
assert cfg.get("max_users") == recipe_meta.MAX_USERS, (
|
|
f"ServerConfig.max_users={cfg.get('max_users')!r} does not match the configured "
|
|
f"USERS={recipe_meta.MAX_USERS} — deploy-time server-limit config did not propagate"
|
|
)
|
|
# allow_html defaults true in the recipe; assert it is present/boolean to prove the field set
|
|
# is the real ServerConfig (not an empty/garbled decode).
|
|
assert cfg.get("allow_html") in (
|
|
0,
|
|
1,
|
|
), f"ServerConfig.allow_html unexpected: {cfg.get('allow_html')!r}"
|