gendesign/tradein-mvp/backend/tests/services
bot-backend 8142834555
All checks were successful
CI Trade-In / changes (pull_request) Successful in 8s
CI Trade-In / browser-tests (pull_request) Has been skipped
CI Trade-In / frontend-checks (pull_request) Has been skipped
CI / changes (pull_request) Successful in 11s
CI / backend-tests (pull_request) Has been skipped
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Has been skipped
CI Trade-In / backend-tests (pull_request) Successful in 7m27s
fix(tgbot): stop CI-hanging busy-spin in rate-limit test, isolate shared client in tests
Root cause of the red PR #3494 CI job (9% progress, 75s life, no error line):
test_send_message_rate_limits_across_different_topics_same_chat mocked
asyncio.sleep as a pure no-op without advancing time.monotonic. The 3rd send
(over the test's limit=2) entered TelegramGroupRateLimiter.acquire(), which
recomputes wait_s from the real, unmocked clock every iteration - since the
fake sleep never advances it, the window never expires and the while-loop
busy-spins forever instead of actually waiting, until pytest-timeout kills it.
Fixed by advancing a fake monotonic clock inside fake_sleep, matching the
already-correct pattern used by the other tests in this file.

Also added _reset_telegram_shared_client (tests/conftest.py, same pattern as
_reset_estimate_rate_limiter): app.services.tgbot.shared._client is a
module-level singleton whose rate limiter otherwise accumulates real
wall-clock timestamps across the whole pytest session, not per test.

Documented honestly in config.py: the API-role budget is shared between
support web-chat mirrors and GlitchTip alerts with no priority between them,
so a large alert burst can make the web-chat wait out its own timeout and
return 502 - flagged as a known follow-up, not fixed here.

NOTE: a full `pytest -q --timeout=60` run still hangs further into the suite,
at tests/test_glitchtip_webhook.py::test_telegram_failure_returns_502_not_500.
Not root-caused within this session's budget - the test's _fake_telegram_client
fixture correctly monkeypatches glitchtip_module.get_telegram_client, but the
anyio worker thread running the ASGI request is seen parked in a real
event-loop poll/select wait, consistent with an actual (non-mocked) sleep
somewhere in that path. Needs a follow-up session with a fresh time budget.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JY6iWDnGDthdvsMWgK1BMG
2026-09-12 16:10:27 +03:00
..
payments fix(tradein/payments): строгий разбор нотификации и отказ вместо догадок на враждебном входе 2026-08-06 15:48:57 +03:00
scrapers chore(tradein/scrapers): удалить весь legacy scrapers/ каталог — final E (#2397, #2277) 2026-07-04 15:58:15 +03:00
tgbot fix(tgbot): stop CI-hanging busy-spin in rate-limit test, isolate shared client in tests 2026-09-12 16:10:27 +03:00
__init__.py feat(tradein): cadastral reverse geocode via main backend cad_buildings (#492) 2026-05-24 07:31:12 +00:00
test_cadastral_reverse.py chore(tradein/geocoder): удалить Яндекс-геокодер (#2593) 2026-07-31 21:22:09 +03:00
test_dadata.py fix(tradein/geocoder): local houses fallback + downgrade DaData CLEAN-disabled noise 2026-08-15 18:08:09 +03:00
test_estimator_precision.py feat(tradein): бейдж точности адреса (qc_geo) на карточке оценки (accuracy #1) 2026-05-28 15:37:33 +05:00
test_image_sanitizer.py fix(tradein/photos): защита от pixel-flood DoS в image_sanitizer 2026-07-12 22:12:12 +03:00
test_location_index.py test(3051): tests/services/test_location_index.py переведён на _covered_region 2026-08-26 18:47:29 +05:00
test_proxy_egress.py test(scrapers): поднять caplog-фильтры под error->warning штатных исходов 2026-09-12 14:39:58 +03:00
test_proxy_pool.py fix(obs): убрать шум выключенных платежей и трейсы health-проб proxy_pool 2026-09-12 14:03:39 +03:00
test_proxy_rotation.py feat(tradein/proxy): прогон знает свой узел, а снятый бан перестаёт стирать историю (#3404) 2026-09-06 13:05:20 +03:00
test_trade_in_pdf_dual_price.py fix(tradein/pdf): МЕРА branding + 4-page report, no empty pages (#2513) 2026-07-13 18:04:07 +00:00