From 5a2a858b84c3e189c7d4ab7db94205c0a2ef480f Mon Sep 17 00:00:00 2001 From: haran2001 <56040092+haran2001@users.noreply.github.com> Date: Sun, 17 May 2026 02:29:27 -0700 Subject: [PATCH] test(restart_drain): assert i18n catalog resolved (#22266) The restart-drain test previously asserted equality between two calls to t("gateway.draining", count=1), which masked the original xdist failure mode in #22266: if the locale catalog is not resolved from the worker's import path, t() returns the bare key path and both sides of the equality still match. Add a guard that the resolved value is not the raw catalog key and contains the English placeholder substitution. This keeps the test loudly failing when locale resolution silently degrades. --- tests/gateway/test_restart_drain.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/gateway/test_restart_drain.py b/tests/gateway/test_restart_drain.py index 844af427308..9000e4d4820 100644 --- a/tests/gateway/test_restart_drain.py +++ b/tests/gateway/test_restart_drain.py @@ -33,7 +33,16 @@ async def test_restart_command_while_busy_requests_drain_without_interrupt(monke result = await runner._handle_message(event) - assert result == t("gateway.draining", count=1) + expected = t("gateway.draining", count=1) + assert result == expected + # Guard against the silent-degradation regression in #22266: if the i18n + # catalog cannot be resolved (e.g. xdist workers losing the locales path) + # then ``t("gateway.draining", count=1)`` returns the bare key + # ``"gateway.draining"`` instead of the formatted English string, and both + # sides of the equality above would still match. Assert on the catalog + # output explicitly so a broken locale resolution fails loudly here. + assert expected != "gateway.draining" + assert "Draining" in expected and "1" in expected running_agent.interrupt.assert_not_called() runner.request_restart.assert_called_once_with(detached=True, via_service=False)