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)
| 103 | |
| 104 | |
| 105 | def 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" |
no test coverage detected