Skip to content

test: add CLI integration coverage for rvl commands - #681

Closed
Aryan-Pardeshi wants to merge 3 commits into
redis:mainfrom
Aryan-Pardeshi:test/cli-integration-coverage
Closed

test: add CLI integration coverage for rvl commands#681
Aryan-Pardeshi wants to merge 3 commits into
redis:mainfrom
Aryan-Pardeshi:test/cli-integration-coverage

Conversation

@Aryan-Pardeshi

@Aryan-Pardeshi Aryan-Pardeshi commented Aug 9, 2026

Copy link
Copy Markdown

Fixes #486

One correction to the issue before the diff: CLI coverage is no longer "minimal to none" at the unit layer — tests/unit/ already has test_cli_index.py, test_cli_main.py, test_cli_stats.py, test_cli_utils.py and test_cli_mcp.py, all mock-based. The gap that remains is integration: tests/integration/ has no CLI file at all, so nothing exercises rvl end to end against a real Redis. That is what this adds.

tests/integration/test_cli_integration.py runs the real entry point as a subprocess against the Docker Redis the rest of the integration suite already uses:

  • rvl version
  • the index lifecycle: createlistallinfodelete, asserting the index appears and then does not
  • error paths: info against a missing index, and any command against an unreachable Redis, both asserting a non-zero exit and no traceback in stderr

The subprocess runs with PYTHONIOENCODING=utf-8 and is decoded as UTF-8. rvl index info renders a box-drawing table, and without that the child inherits a non-UTF-8 stdout encoding on some platforms and dies with a UnicodeEncodeError before printing anything — which is a property of the test harness, not of the CLI.

Scope note: this covers the commands above but not rvl stats or rvl index destroy, which are also on the issue's checklist. Happy to add them here or in a follow-up, whichever you prefer.

3 passed locally against Redis in Docker. No shipped code is touched.


Note

Low Risk
Test-only change with no production code; risk is limited to CI/runtime and Redis test isolation via existing fixtures and teardown.

Overview
Adds tests/integration/test_cli_integration.py, the first integration suite that runs rvl via python -m redisvl.cli.runner as a subprocess against the shared Docker Redis fixtures (unit CLI tests stay mock-only).

A run_cli helper sets REDIS_URL, forces PYTHONIOENCODING=utf-8 so index info box-drawing output does not raise UnicodeEncodeError on narrow encodings, and a cli_schema_file fixture writes a temp schema with redis_test_name-scoped index/prefix names and always tears down with index destroy on fixture exit.

test_cli_index_lifecycle walks version, then createlistallinfostatsdelete, asserting listall no longer shows the index (not just exit code), recreates the index, then destroy and asserts the index is gone again. test_cli_error_paths expects non-zero exits for a missing schema file, missing index info/stats, and an invalid subcommand (exit code 2).

Reviewed by Cursor Bugbot for commit f116821. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 6e03384. Configure here.

Comment thread tests/integration/test_cli_integration.py
… indices

test_cli_index_lifecycle only checked exit codes after delete and destroy, so
a no-op that exits 0 against an already-gone index would have passed
silently. Assert listall no longer shows the index after each, and that the
re-create step in between actually recreated it rather than being a no-op
against a still-existing one.

cli_schema_file's teardown only removed the temp YAML file and never touched
the Redis index itself, so a test failing partway through the lifecycle left
the index behind for the next run. Added an unconditional destroy in
teardown, safe because destroy on an already-gone index is a no-op from the
CLI's own error handling.
@Aryan-Pardeshi

Copy link
Copy Markdown
Author

Good catch — pushed a fix. test_cli_index_lifecycle now asserts listall no longer shows the index after delete and after destroy, not just the exit code, and the fixture's teardown now destroys the index unconditionally so a test failing partway through doesn't leave it behind.

One correction to my own PR description: I wrote that rvl stats and index destroy aren't covered. That's wrong — they're both exercised in the lifecycle test (steps 4 and 7), and now with real assertions rather than exit-code checks alone. Sorry for the bad scope claim.

@vishal-bala

Copy link
Copy Markdown
Collaborator

Hi, thanks for the contribution! The issue you linked was already completed a while back but not linked to the PR that did the work. I've sorted that out now.

I'm not sure that the integration tests that this PR adds are adding enough meaningful surface to the test suite to warrant the additional bloat. The functionality is already extensively tested and the premise of this PR doesn't seem to hold up at the moment.

Closing it for now 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add CLI integration test coverage for rvl commands

2 participants