test: add CLI integration coverage for rvl commands - #681
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 6e03384. Configure here.
… 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.
|
Good catch — pushed a fix. One correction to my own PR description: I wrote that |
|
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 👍 |

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 hastest_cli_index.py,test_cli_main.py,test_cli_stats.py,test_cli_utils.pyandtest_cli_mcp.py, all mock-based. The gap that remains is integration:tests/integration/has no CLI file at all, so nothing exercisesrvlend to end against a real Redis. That is what this adds.tests/integration/test_cli_integration.pyruns the real entry point as a subprocess against the Docker Redis the rest of the integration suite already uses:rvl versioncreate→listall→info→delete, asserting the index appears and then does notinfoagainst a missing index, and any command against an unreachable Redis, both asserting a non-zero exit and no traceback in stderrThe subprocess runs with
PYTHONIOENCODING=utf-8and is decoded as UTF-8.rvl index inforenders a box-drawing table, and without that the child inherits a non-UTF-8 stdout encoding on some platforms and dies with aUnicodeEncodeErrorbefore printing anything — which is a property of the test harness, not of the CLI.Scope note: this covers the commands above but not
rvl statsorrvl 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 runsrvlviapython -m redisvl.cli.runneras a subprocess against the shared Docker Redis fixtures (unit CLI tests stay mock-only).A
run_clihelper setsREDIS_URL, forcesPYTHONIOENCODING=utf-8soindex infobox-drawing output does not raiseUnicodeEncodeErroron narrow encodings, and acli_schema_filefixture writes a temp schema withredis_test_name-scoped index/prefix names and always tears down withindex destroyon fixture exit.test_cli_index_lifecyclewalksversion, thencreate→listall→info→stats→delete, assertinglistallno longer shows the index (not just exit code), recreates the index, thendestroyand asserts the index is gone again.test_cli_error_pathsexpects non-zero exits for a missing schema file, missing indexinfo/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.