RHIDP-14000: update tests for vector stores#1912
Conversation
Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>
WalkthroughThis PR adds comprehensive test coverage for the vector stores API across three levels: end-to-end feature tests that define expected behavior, unit tests validating endpoint error handling and file operations, and unit tests for request model validation constraints. ChangesVector Stores API Test Coverage
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/e2e/features/vector_stores.feature`:
- Line 8: Replace the hardcoded JWT in the step "I set the Authorization header
to Bearer eyJhbGci..." with a non-secret placeholder or env-driven value: update
the feature step to use a placeholder token like "I set the Authorization header
to Bearer <TEST_TOKEN>" (or call a step that reads from test config/env), and
update the corresponding step definition to inject process.env.TEST_TOKEN or a
fixture value so no real JWT is committed in the feature file.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: a8fa371a-4b72-4cf9-b4c1-e17c9f9ddc78
📒 Files selected for processing (4)
tests/e2e/features/vector_stores.featuretests/e2e/test_list.txttests/unit/app/endpoints/test_vector_stores.pytests/unit/models/requests/test_vector_store_requests.py
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
- GitHub Check: E2E: library mode / ci / group 3
- GitHub Check: E2E: server mode / ci / group 3
- GitHub Check: E2E: server mode / ci / group 2
- GitHub Check: E2E: library mode / ci / group 2
- GitHub Check: E2E: server mode / ci / group 1
- GitHub Check: E2E: library mode / ci / group 1
- GitHub Check: E2E Tests for Lightspeed Evaluation job
- GitHub Check: spectral
- GitHub Check: unit_tests (3.12)
- GitHub Check: unit_tests (3.13)
- GitHub Check: build-pr
- GitHub Check: Pylinter
- GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-0-6-on-pull-request
- GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-on-pull-request
🧰 Additional context used
📓 Path-based instructions (2)
tests/e2e/**/*.{py,feature}
📄 CodeRabbit inference engine (AGENTS.md)
Use behave (BDD) framework for end-to-end testing with Gherkin feature files
Files:
tests/e2e/features/vector_stores.feature
tests/**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
tests/**/*.py: Use pytest for all unit and integration tests; do not use unittest
Usepytest.mark.asynciomarker for async tests
Files:
tests/unit/models/requests/test_vector_store_requests.pytests/unit/app/endpoints/test_vector_stores.py
🪛 Betterleaks (1.3.1)
tests/e2e/features/vector_stores.feature
[high] 8-8: Uncovered a JSON Web Token, which may lead to unauthorized access to web applications and sensitive user data.
(jwt)
🔇 Additional comments (4)
tests/e2e/features/vector_stores.feature (1)
1-7: LGTM!Also applies to: 9-46
tests/e2e/test_list.txt (1)
32-32: LGTM!tests/unit/app/endpoints/test_vector_stores.py (1)
1186-1284: LGTM!tests/unit/models/requests/test_vector_store_requests.py (1)
6-10: LGTM!Also applies to: 13-70
| Background: | ||
| Given The service is started locally | ||
| And The system is in default state | ||
| And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c |
There was a problem hiding this comment.
Remove hardcoded bearer token from test feature data.
Line 8 commits a JWT-like token directly in the feature file. Even for test fixtures, this creates secret-scanner noise and weakens security hygiene in-repo. Replace with a non-token placeholder step/fixture value (or load from test config/env).
🧰 Tools
🪛 Betterleaks (1.3.1)
[high] 8-8: Uncovered a JSON Web Token, which may lead to unauthorized access to web applications and sensitive user data.
(jwt)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tests/e2e/features/vector_stores.feature` at line 8, Replace the hardcoded
JWT in the step "I set the Authorization header to Bearer eyJhbGci..." with a
non-secret placeholder or env-driven value: update the feature step to use a
placeholder token like "I set the Authorization header to Bearer <TEST_TOKEN>"
(or call a step that reads from test config/env), and update the corresponding
step definition to inject process.env.TEST_TOKEN or a fixture value so no real
JWT is committed in the feature file.
Source: Linters/SAST tools
Description
Confirmed standalone DELETE /v1/files/{fileId} endpoint does not exist
Added 3 unit tests to test_vector_stores.py covering previously untested error/edge-case paths:
Added 8 VectorStoreCreateRequest model validation tests
Added 5 E2E Gherkin scenarios in vector_stores.feature for HTTP-level validation (list 200, empty body 422, extra fields 422, empty update 422, empty file-add 422)
Type of change
Tools used to create PR
Identify any AI code assistants used in this PR (for transparency and review context)
Related Tickets & Documents
Checklist before requesting a review
Testing
Summary by CodeRabbit