MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / check_livez_coordinator_coupling

Function check_livez_coordinator_coupling

test/http-auth/mzcompose.py:105–130  ·  view source on GitHub ↗

Regression test for SQL-343: previously having group_claim_for above the authenticator match in http_auth, so unauthenticated internal endpoints (/api/livez, /api/readyz, /metrics) began round-tripping the coordinator (`Command::GetSystemVars`) on every request for a value only the F

(c: Composition)

Source from the content-addressed store, hash-verified

103
104
105def check_livez_coordinator_coupling(c: Composition) -> None:
106 """Regression test for SQL-343: previously having group_claim_for above
107 the authenticator match in http_auth, so unauthenticated internal
108 endpoints (/api/livez, /api/readyz, /metrics) began round-tripping
109 the coordinator (`Command::GetSystemVars`) on every request for a value
110 only the Frontegg arm uses.
111 """
112 c.up("materialized")
113 base = f"http://localhost:{c.port('materialized', 6878)}"
114
115 # Coordinator-side count of GetSystemVars commands, scraped from /metrics.
116 def get_system_vars_count() -> int:
117 for line in requests.get(f"{base}/metrics").text.splitlines():
118 if (
119 line.startswith("mz_slow_message_handling_count{")
120 and "get_system_vars" in line
121 ):
122 return int(float(line.split()[-1]))
123 return 0
124
125 with c.test_case("livez_does_not_round_trip_coordinator"):
126 before = get_system_vars_count()
127 for _ in range(100):
128 assert requests.get(f"{base}/api/livez").status_code == 200
129 delta = get_system_vars_count() - before
130 assert delta < 50, f"100 liveness probes caused {delta} coordinator round-trips"

Callers 1

workflow_defaultFunction · 0.85

Calls 5

get_system_vars_countFunction · 0.85
test_caseMethod · 0.80
upMethod · 0.45
portMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected