Skip to content

Commit bd9de74

Browse files
limjoobinhillarytohvishal-bala
authored
test: Add regression coverage for RedisVL CLI foundation contracts (#596)
### Changes In this PR, we reinforce our test coverage of redisVL CLI foundation contracts. For CLI foundation contracts, the following were verified for correctness: - sydout/stderr output - system exit codes - usage errors - runtime failures - human-readable success paths - JSON success paths Note: This PR merges commits from: - fix/cli-exit-codes-and-streams (#592) - feat/RAAE-1557/cli-json (#593) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Changes are limited to unit tests; they document and guard existing CLI behavior without modifying runtime code in this diff. > > **Overview** > This PR **expands CLI regression tests only** (no production `redisvl/cli` changes in the diff). It replaces shallow fake-Redis tests with **contract-focused coverage** for `rvl`, `rvl index`, and `rvl stats`. > > **Top-level CLI** (`test_cli_main.py`): new tests assert help lists `index`, `mcp`, `version`, and `stats` (in-process and via `python -m redisvl.cli.runner`), and that unknown commands exit **2** with errors on stderr and empty stdout. > > **Index CLI** (`test_cli_index.py`): adds help/subprocess help checks, a real Redis index fixture for `listall`/`info`, success assertions for `create` (exact success banner; `--json` does not add JSON), JSON shape checks for `listall` and `info`, human-output smoke tests, and parametrized **usage errors (exit 2)** vs **runtime/Redis failures (exit 1, no stdout JSON)**. > > **Stats CLI** (`test_cli_stats.py`): mirrors the same patterns—help, runner subprocess, real-index JSON/table success, `_stats_rows` ordering, usage **exit 2**, and runtime **`RedisSearchError`/generic errors exit 1** with empty stdout on `--json` failure paths. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit c7d67fad3917807bd96c71eab53b5d6f56e1dc41. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: ht <121932573+hillarytoh@users.noreply.github.com> Co-authored-by: Vishal Bala <vishal-bala@users.noreply.github.com>
1 parent 027a130 commit bd9de74

3 files changed

Lines changed: 659 additions & 230 deletions

File tree

0 commit comments

Comments
 (0)