SilverElixir commited on
Commit
ade5ff6
·
1 Parent(s): 6324d4a

Fix flaky webhook throttle test on fresh CI machines

Browse files
Files changed (1) hide show
  1. tests/test_bot_admin.py +4 -1
tests/test_bot_admin.py CHANGED
@@ -8,6 +8,7 @@ import bot
8
  import logging
9
  import os
10
  import threading
 
11
  import pytest
12
  from unittest.mock import Mock
13
  from tests.bot_test_helpers import (
@@ -329,7 +330,9 @@ def test_webhook_denied_log_is_throttled(caplog):
329
  orig_count = lumen_admin._webhook_denied_count
330
  orig_last = lumen_admin._webhook_denied_last_log
331
  lumen_admin._webhook_denied_count = 0
332
- lumen_admin._webhook_denied_last_log = 0.0
 
 
333
  original_secret = bot.WEBHOOK_SECRET
334
  bot.WEBHOOK_SECRET = "real-webhook-secret"
335
  try:
 
8
  import logging
9
  import os
10
  import threading
11
+ import time
12
  import pytest
13
  from unittest.mock import Mock
14
  from tests.bot_test_helpers import (
 
330
  orig_count = lumen_admin._webhook_denied_count
331
  orig_last = lumen_admin._webhook_denied_last_log
332
  lumen_admin._webhook_denied_count = 0
333
+ # Ноль monotonic вместо прошлого: на свежей CI-машине uptime < 60с и первый
334
+ # отказ молча копится (прод 07.10.2026) — уводим метку в прошлое явно.
335
+ lumen_admin._webhook_denied_last_log = time.monotonic() - lumen_admin._WEBHOOK_DENIED_LOG_INTERVAL_SEC - 1.0
336
  original_secret = bot.WEBHOOK_SECRET
337
  bot.WEBHOOK_SECRET = "real-webhook-secret"
338
  try: