Commit 876bd38
Paul Demarecaux
test(tools): add dedicated unit tests for Snowflake, OpenObserve, OpenSearch tools (#790)
Per the issue's proposed coverage list, adds three new dedicated test files
under tests/tools/:
- test_snowflake_query_history_tool.py (26 tests)
is_available + extract_params, account/token validation, default vs
custom SQL with LIMIT enforcement, optional session params (warehouse/
role/database/schema), bounded limit cap, row normalization for both
dict-rows and tabular rows + resultSetMetaData, HTTP failure handling.
- test_openobserve_logs_tool.py (36 tests)
is_available across token-only / basic-auth-only / both, extract_params,
bearer vs basic Authorization header behavior (bearer wins), endpoint
org templating, default SQL fallback, time window + size payload shape,
stream_name only when set, bounded limit cap, record extraction across
the four supported response shapes (top-level hits list, Elastic-style
hits.hits._source, records, data), HTTP failure handling.
- test_opensearch_analytics_tool.py (26 tests)
is_available + extract_params, ElasticsearchConfig normalization (URL
trim, blank api_key -> None, blank index -> '*'), search call shape
(query default, time_range floor 1, bounded limit, _MAX_HARD_LIMIT cap),
log filtering (non-dict items dropped), missing/non-list logs field,
client error propagation (with and without 'error' field).
Each file inherits from BaseToolContract for the shared metadata/contract
checks and uses pytest's monkeypatch to stub httpx.post or
ElasticsearchClient — no live HTTP calls.
tests/tools/ -> 1541 passed (was 1453; +88 new tests, no regressions).1 parent ae53af1 commit 876bd38
3 files changed
Lines changed: 1319 additions & 0 deletions
0 commit comments