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:
Bernd (Hermes)
2026-08-04 16:52:09 +02:00
parent d25b3a00a1
commit 20aae149c8
3 changed files with 104 additions and 69 deletions
+17 -9
View File
@@ -84,6 +84,11 @@ def test_05_contextvar_isolation_parallel_load(
posted_ids_test: list = []
posted_ids_target: 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 05: 10s startup grace — letting rate-limit window reset")
time.sleep(10.0)
# ── Step 1: Cursor für beide Räume holen ───────────────────────────
cursor_test = get_latest_timestamp(
rc_client, test_room_id, rate_limiter=rate_limiter
@@ -114,7 +119,10 @@ def test_05_contextvar_isolation_parallel_load(
long_msg_id[:12], long_cursor[:19],
)
# ── Step 3: Sofort kurze Keyword-Nachricht in test-rc-target ───────
# ── 5s Delay: RC-Rate-Limit atmen lassen vor zweitem Post ──────────
time.sleep(5.0)
# ── Step 3: Kurze Keyword-Nachricht in test-rc-target ──────────────
# "rocketchat ddp bug" — 100% keyword match für #Rocketchat-Plugin
short_text = "rocketchat ddp bug"
short_msg_id, short_cursor = post_test_message(
@@ -130,22 +138,22 @@ def test_05_contextvar_isolation_parallel_load(
# Zuerst die kurze Antwort (sollte schneller kommen), dann die lange.
# Reihenfolge ist nicht-deterministisch — das ist OK.
# 4a: Kurze Antwort in test-rc-target
# 4a: Kurze Antwort in test-rc-target (initial_interval=8s, timeout=120s)
try:
short_answer = wait_for_bot_message(
client=rc_client,
room_id=target_room,
bot_username=bot_username,
cursor=short_cursor,
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 target_room within 60s. Error: {e}"
f"Bot did not respond in target_room within 120s. Error: {e}"
)
short_text_answer = short_answer.get("msg", "")
@@ -156,22 +164,22 @@ def test_05_contextvar_isolation_parallel_load(
)
posted_ids_target.append(short_answer.get("_id", ""))
# 4b: Lange Antwort in test_room (timeout 90s für langen Stream)
# 4b: Lange Antwort in test_room (timeout 120s für langen Stream)
try:
long_answer = wait_for_bot_message(
client=rc_client,
room_id=test_room_id,
bot_username=bot_username,
cursor=long_cursor,
timeout=90.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 90s. "
f"Bot did not respond in test_room within 120s. "
f"The long answer may have timed out. Error: {e}"
)