test: Add regression coverage for RedisVL CLI foundation contracts#596
Open
limjoobin wants to merge 45 commits into
Open
test: Add regression coverage for RedisVL CLI foundation contracts#596limjoobin wants to merge 45 commits into
limjoobin wants to merge 45 commits into
Conversation
- add_json_output_flag for --json on argparse parsers - cli_print_json for single-object stdout; bytes-safe default Made-with: Cursor
Print {"version": <package>} to stdout; --json overrides --short
Made-with: Cursor
- tests for add_json_output_flag, cli_print_json, Version Made-with: Cursor
Align rvl index and stats: usage problems exit 2 with messages on stderr, Redis/search failures exit 1, success on stdout. Share schema and RedisSearchError handling via redisvl.cli.utils helpers.
Made-with: Cursor
Made-with: Cursor
Made-with: Cursor
Made-with: Cursor
Made-with: Cursor
…extending edit to cli mcp test too
Move SCHEMA_INPUT_ERRORS handling into _connect_to_index (match index CLI) so ValueError from the stats display path is not misclassified as exit 2. Made-with: Cursor
Co-authored-by: Vishal Bala <vishal-bala@users.noreply.github.com>
Co-authored-by: Vishal Bala <vishal-bala@users.noreply.github.com>
Move SCHEMA_INPUT_ERRORS, exit_schema_input_error, and exit_redis_search_error from utils into index.py and stats.py so CLI behavior is visible next to each command. utils keeps URL and argparse helpers only. Made-with: Cursor
This reverts commit ddcd751.
Made-with: Cursor
…i-regression-test
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
…odes rather than soft asserts
vishal-bala
reviewed
May 6, 2026
Collaborator
vishal-bala
left a comment
There was a problem hiding this comment.
There's a decent amount of structure in place to fake the Redis part of the tests, but when we run the tests, we typically have a Redis instance available. Would it simplify a lot of the code to just use a real Redis instance instead of faking it, or do you think that's messier than it's worth?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
In this PR, we reinforce our test coverage of redisVL CLI foundation contracts.
For CLI foundation contracts, the following were verified for correctness:
Note: This PR merges commits from:
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/clichanges in the diff). It replaces shallow fake-Redis tests with contract-focused coverage forrvl,rvl index, andrvl stats.Top-level CLI (
test_cli_main.py): new tests assert help listsindex,mcp,version, andstats(in-process and viapython -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 forlistall/info, success assertions forcreate(exact success banner;--jsondoes not add JSON), JSON shape checks forlistallandinfo, 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_rowsordering, usage exit 2, and runtimeRedisSearchError/generic errors exit 1 with empty stdout on--jsonfailure paths.Reviewed by Cursor Bugbot for commit c7d67fa. Bugbot is set up for automated code reviews on this repo. Configure here.