style: repo-wide lint pass — make the lint gate green again
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.
This commit is contained in:
@ -34,12 +34,12 @@ def test_federation_version_endpoint(live_app):
|
||||
assert status == 200, f"GET {url} HTTP {status} (expected 200)"
|
||||
assert isinstance(body, dict), f"federation version returned non-dict: {type(body).__name__}"
|
||||
server = body.get("server")
|
||||
assert isinstance(server, dict), (
|
||||
f"federation version response missing 'server' envelope: {body!r}"
|
||||
)
|
||||
assert isinstance(
|
||||
server, dict
|
||||
), f"federation version response missing 'server' envelope: {body!r}"
|
||||
name = server.get("name")
|
||||
assert name == "Synapse", f"server.name={name!r}, expected 'Synapse'"
|
||||
version = server.get("version")
|
||||
assert isinstance(version, str) and len(version) > 0, (
|
||||
f"server.version is not a non-empty string: {version!r}"
|
||||
)
|
||||
assert (
|
||||
isinstance(version, str) and len(version) > 0
|
||||
), f"server.version is not a non-empty string: {version!r}"
|
||||
|
||||
@ -11,7 +11,6 @@ Runs in the custom tier against the shared post-install live deployment.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
@ -24,6 +23,6 @@ def test_synapse_client_versions_returns_json(live_app):
|
||||
url = f"https://{live_app}/_matrix/client/versions"
|
||||
status, body = harness_http.retry_http_get(url, expect_status=200, max_wait=60, interval=3)
|
||||
assert status == 200, f"GET {url} HTTP {status} (expected 200)"
|
||||
assert isinstance(body, dict) and isinstance(body.get("versions"), list) and body["versions"], (
|
||||
f"GET {url} did not return Matrix client-versions document: {body!r}"
|
||||
)
|
||||
assert (
|
||||
isinstance(body, dict) and isinstance(body.get("versions"), list) and body["versions"]
|
||||
), f"GET {url} did not return Matrix client-versions document: {body!r}"
|
||||
|
||||
@ -42,7 +42,8 @@ import sys
|
||||
import uuid
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "runner"))
|
||||
from harness import http as harness_http, lifecycle # noqa: E402
|
||||
from harness import http as harness_http # noqa: E402
|
||||
from harness import lifecycle
|
||||
|
||||
|
||||
def _registration_secret(domain: str) -> str:
|
||||
@ -101,8 +102,11 @@ def _admin_register(domain: str, secret: str, username: str, password: str, admi
|
||||
r = _container_curl(domain, "GET", "/_synapse/admin/v1/register")
|
||||
if r["status"] in (500, 502, 503, 504, 0):
|
||||
last = r
|
||||
print(f" [register] {username}: nonce GET transient {r['status']} "
|
||||
f"(attempt {attempt}, synapse recovering) — retrying", flush=True)
|
||||
print(
|
||||
f" [register] {username}: nonce GET transient {r['status']} "
|
||||
f"(attempt {attempt}, synapse recovering) — retrying",
|
||||
flush=True,
|
||||
)
|
||||
time.sleep(5)
|
||||
continue
|
||||
assert r["status"] == 200, f"nonce GET failed: status={r['status']} raw={r['raw'][:200]!r}"
|
||||
@ -122,13 +126,19 @@ def _admin_register(domain: str, secret: str, username: str, password: str, admi
|
||||
r = _container_curl(domain, "POST", "/_synapse/admin/v1/register", body=payload)
|
||||
if r["status"] == 200:
|
||||
if attempt > 1:
|
||||
print(f" [register] {username}: succeeded on attempt {attempt} "
|
||||
f"(synapse recovered)", flush=True)
|
||||
print(
|
||||
f" [register] {username}: succeeded on attempt {attempt} "
|
||||
f"(synapse recovered)",
|
||||
flush=True,
|
||||
)
|
||||
return r["body"] or {}
|
||||
if r["status"] in (500, 502, 503, 504, 0):
|
||||
last = r
|
||||
print(f" [register] {username}: POST transient {r['status']} "
|
||||
f"(attempt {attempt}, synapse recovering) — retrying", flush=True)
|
||||
print(
|
||||
f" [register] {username}: POST transient {r['status']} "
|
||||
f"(attempt {attempt}, synapse recovering) — retrying",
|
||||
flush=True,
|
||||
)
|
||||
time.sleep(5)
|
||||
continue
|
||||
# a 4xx is a real rejection — fail fast, do not retry
|
||||
@ -167,9 +177,9 @@ def test_register_two_users_send_receive_message(live_app):
|
||||
create + invite + join a room; send and read a message."""
|
||||
domain = live_app
|
||||
secret = _registration_secret(domain)
|
||||
assert secret and len(secret) >= 16, (
|
||||
f"registration shared secret missing/short: len={len(secret) if secret else 0}"
|
||||
)
|
||||
assert (
|
||||
secret and len(secret) >= 16
|
||||
), f"registration shared secret missing/short: len={len(secret) if secret else 0}"
|
||||
|
||||
suffix = uuid.uuid4().hex[:8]
|
||||
user_a = f"alice{suffix}"
|
||||
|
||||
Reference in New Issue
Block a user