mirror of
https://github.com/nearai/ironclaw.git
synced 2026-09-03 08:06:01 +08:00
* Add Telegram local regression test harness * Add local Telegram smoke test runner * test: add high-priority Telegram regression tests Cover 6 previously untested API-level flows using fake axum Telegram servers: photo attachment download, voice attachment download, long message splitting (>4096 chars), Markdown parse error fallback to plain text, sendChatAction typing indicator, and polling mode (getUpdates with offset tracking). Test count: 13 → 19. All use real WASM channel execution with env-var URL override. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test: add full-process Telegram E2E tests Add 4 end-to-end tests that boot IronClaw, activate the Telegram WASM channel via the setup API, POST webhook updates, and verify the sendMessage round-trip through the mock LLM to a fake Telegram API. Tests cover: - DM round-trip (setup → webhook → LLM → sendMessage) - Edited message handling - Unauthorized user rejection (dm_policy = pairing) - Invalid webhook secret rejection (401) New files: - fake_telegram_api.py: aiohttp server faking the Telegram Bot API - test_telegram_e2e.py: the 4 test scenarios conftest.py changes: - Add fake_telegram_server and telegram_e2e_server fixtures - Extend _wasm_build_symlinks to also cover channels-src/ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test: expand Telegram E2E coverage with 8 new regression tests Add 8 new tests covering core functionality gaps and high-priority error resilience scenarios for the Telegram WASM channel: Round 1 (functionality): - Group mention filtering (ignore without @bot, reply with @bot) - Long message chunking (>4096 chars split correctly) - Polling mode roundtrip (getUpdates picks up queued messages) - Markdown fallback (400 parse error triggers plain-text retry) Round 2 (resilience): - Missing webhook secret header (401 rejection) - 429 rate limit resilience (system survives, recovers) - Document download failure (getFile 500, text still processed) - Malformed payload resilience (invalid JSON handled, bot continues) Also extends fake_telegram_api.py with reject_markdown, rate_limit, and fail_downloads simulation flags plus control endpoints, and adds a "long response" canned pattern to mock_llm.py. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve CI failures in Telegram test suite - Add #[cfg(feature = "integration")] gate to test_bot_mention_detection_case_insensitive and build_telegram_update_value (fixes compilation on default/libsql) - Run cargo fmt on telegram_auth_integration.rs - Fix race condition in fake_telegram_api.py get_updates - Increase rate_limit_count from 5 to 20 for retry resilience - Move helper functions to proper section in test_telegram_e2e.py Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
37 lines
1.3 KiB
Bash
37 lines
1.3 KiB
Bash
# Copy to scripts/telegram_smoke/config.env and fill in your own values.
|
|
#
|
|
# The smoke runner logs in as a real Telegram user via Telethon and talks to a
|
|
# dedicated test bot/chat/group. Use a disposable test account, not your
|
|
# primary personal account.
|
|
|
|
# Telegram API credentials for the human test account.
|
|
TG_SMOKE_API_ID=12345678
|
|
TG_SMOKE_API_HASH=0123456789abcdef0123456789abcdef
|
|
|
|
# Local Telethon session name/path. A .session file will be created on first login.
|
|
TG_SMOKE_SESSION=scripts/telegram_smoke/.sessions/release-smoke
|
|
|
|
# Bot under test. Prefer the public @username.
|
|
TG_SMOKE_BOT_USERNAME=@your_test_bot
|
|
|
|
# Optional: numeric bot user id, if you prefer that over username.
|
|
# TG_SMOKE_BOT_USER_ID=123456789
|
|
|
|
# DM target. If unset, the bot username/user id is used directly.
|
|
# TG_SMOKE_DM_TARGET=@your_test_bot
|
|
|
|
# Optional: group or supergroup for mention tests.
|
|
# Use either a numeric id (-100...) or a public username/link target.
|
|
TG_SMOKE_GROUP_TARGET=-1001234567890
|
|
|
|
# Optional: exact substring expected in every bot reply.
|
|
# Leave unset if you only want to assert "bot replied at all".
|
|
# TG_SMOKE_EXPECT_SUBSTRING=SMOKE-ACK
|
|
|
|
# Optional: local ironclaw health endpoint to check before sending Telegram traffic.
|
|
# TG_SMOKE_HEALTHCHECK_URL=http://127.0.0.1:3000/api/health
|
|
|
|
# Optional tuning.
|
|
# TG_SMOKE_TIMEOUT_SECS=45
|
|
# TG_SMOKE_POLL_INTERVAL_SECS=1.0
|