fix(live_rc): 429 rate-limiting + test_04 Butler-mode restructure
test_05 (ContextVar-Isolation): - 10s startup grace before posting (rate-limit window reset) - 5s delay between long/short posts (was: immediate) - Timeout 60s→120s, initial_interval 5s→8s test_06 (Concurrent Isolation): - 10s startup grace before posting - /reset wait 5s→8s, inter-post delay 3s→8s - Timeout 60s→120s, initial_interval 5s→8s test_04 (Multi-Room): - Restructured from keywords_100 auto-route to keywords_context Butler-mode - Uses only keywords_context words (plugin, deployment, archivar, hermes, gateway, sync, button) — no keywords_100 matches - Added /reset step, 10s startup grace, 8s initial_interval - Verifies Butler Move-Request button detection - Copy-to-project-room check uses 'plugin' instead of 'rocketchat'
This commit is contained in:
@@ -85,6 +85,11 @@ def test_06_concurrent_isolation(
|
||||
posted_ids_test: list = []
|
||||
posted_ids_source: list = []
|
||||
|
||||
# ── Startup grace: 10s Pause für Bot-Startup und Rate-Limit-Reset ──
|
||||
# Vermeidet 429-Kaskaden durch zu schnelles Posten nach Test-Start.
|
||||
logger.info("Test 06: 10s startup grace — letting rate-limit window reset")
|
||||
time.sleep(10.0)
|
||||
|
||||
# ── Step 1: /reset in beiden Räumen ────────────────────────────────
|
||||
# Clear sticky topics from previous tests.
|
||||
_reset_test_id, _ = post_test_message(
|
||||
@@ -99,8 +104,8 @@ def test_06_concurrent_isolation(
|
||||
"Test 06: sent /reset to test_room (msg %s) and source_room (msg %s)",
|
||||
_reset_test_id[:12], _reset_source_id[:12],
|
||||
)
|
||||
# Wait for /reset responses
|
||||
time.sleep(5.0)
|
||||
# Wait for /reset responses (increased from 5s to 8s for rate-limit headroom)
|
||||
time.sleep(8.0)
|
||||
|
||||
# ── Step 2: Cursor für beide Räume holen ───────────────────────────
|
||||
cursor_test = get_latest_timestamp(
|
||||
@@ -114,10 +119,11 @@ def test_06_concurrent_isolation(
|
||||
cursor_test[:19], cursor_source[:19],
|
||||
)
|
||||
|
||||
# ── Step 3: Beide Nachrichten sequenziell mit 3s Delay posten ──────
|
||||
# 3s Delay zur Interrupt-Recursion-Vermeidung:
|
||||
# ── Step 3: Beide Nachrichten sequenziell mit 8s Delay posten ──────
|
||||
# 8s Delay zur Interrupt-Recursion-Vermeidung UND Rate-Limit-Entlastung:
|
||||
# Hermes-Core serialisiert eingehende Nachrichten pro Bot-Instanz
|
||||
# mit Tiefe-3-Limit. Zwei Posts ohne Delay triggern Interrupt-Recursion.
|
||||
# RC's 30/min-Bucket braucht Atempausen zwischen Posts.
|
||||
# Nachricht A: test_room — "lan subnetz maskieren" (keyword "lan" → #LAN-Dokumentation)
|
||||
text_a = "lan subnetz maskieren"
|
||||
msg_a_id, cursor_a = post_test_message(
|
||||
@@ -125,9 +131,9 @@ def test_06_concurrent_isolation(
|
||||
posted_ids_test, rate_limiter,
|
||||
)
|
||||
|
||||
# 3s Delay: Kern-Antwort auf Nachricht A beginnen lassen,
|
||||
# bevor Nachricht B gepostet wird (Interrupt-Recursion-Vermeidung)
|
||||
time.sleep(3.0)
|
||||
# 8s Delay: Kern-Antwort auf Nachricht A beginnen lassen,
|
||||
# bevor Nachricht B gepostet wird (Interrupt-Recursion-Vermeidung + Rate-Limit)
|
||||
time.sleep(8.0)
|
||||
|
||||
# Nachricht B: test-rc-source — "rocketchat ddp bug" (keyword "rocketchat" → #Rocketchat-Plugin)
|
||||
text_b = "rocketchat ddp bug"
|
||||
@@ -144,22 +150,22 @@ def test_06_concurrent_isolation(
|
||||
# ── Step 4: Auf Bot-Antworten warten (sequenziell) ─────────────────
|
||||
start_time = time.monotonic()
|
||||
|
||||
# 4a: Antwort in test_room (LAN-Routing)
|
||||
# 4a: Antwort in test_room (LAN-Routing) — timeout 120s, initial_interval 8s
|
||||
try:
|
||||
answer_a = wait_for_bot_message(
|
||||
client=rc_client,
|
||||
room_id=test_room_id,
|
||||
bot_username=bot_username,
|
||||
cursor=cursor_a,
|
||||
timeout=60.0,
|
||||
timeout=120.0,
|
||||
rate_limiter=rate_limiter,
|
||||
initial_interval=5.0,
|
||||
initial_interval=8.0,
|
||||
)
|
||||
except RateLimitSkip as e:
|
||||
pytest.skip(f"Rate limit triggered: {e}")
|
||||
except PollTimeout as e:
|
||||
pytest.fail(
|
||||
f"Bot did not respond in test_room within 60s. Error: {e}"
|
||||
f"Bot did not respond in test_room within 120s. Error: {e}"
|
||||
)
|
||||
|
||||
answer_a_text = answer_a.get("msg", "")
|
||||
@@ -170,22 +176,22 @@ def test_06_concurrent_isolation(
|
||||
)
|
||||
posted_ids_test.append(answer_a.get("_id", ""))
|
||||
|
||||
# 4b: Antwort in test-rc-source (Rocketchat-Routing)
|
||||
# 4b: Antwort in test-rc-source (Rocketchat-Routing) — timeout 120s, initial_interval 8s
|
||||
try:
|
||||
answer_b = wait_for_bot_message(
|
||||
client=rc_client,
|
||||
room_id=source_room,
|
||||
bot_username=bot_username,
|
||||
cursor=cursor_b,
|
||||
timeout=60.0,
|
||||
timeout=120.0,
|
||||
rate_limiter=rate_limiter,
|
||||
initial_interval=5.0,
|
||||
initial_interval=8.0,
|
||||
)
|
||||
except RateLimitSkip as e:
|
||||
pytest.skip(f"Rate limit triggered: {e}")
|
||||
except PollTimeout as e:
|
||||
pytest.fail(
|
||||
f"Bot did not respond in source_room within 60s. Error: {e}"
|
||||
f"Bot did not respond in source_room within 120s. Error: {e}"
|
||||
)
|
||||
|
||||
answer_b_text = answer_b.get("msg", "")
|
||||
|
||||
Reference in New Issue
Block a user