Skip to content

test : added unit tests for redis_cache service#815

Open
tmdeveloper007 wants to merge 1 commit into
ritesh-1918:gssocfrom
tmdeveloper007:#814
Open

test : added unit tests for redis_cache service#815
tmdeveloper007 wants to merge 1 commit into
ritesh-1918:gssocfrom
tmdeveloper007:#814

Conversation

@tmdeveloper007
Copy link
Copy Markdown

Refs #814.

Summary of What Has Been Done:
Added comprehensive unit tests for the redis_cache.py service. The tests cover the RedisInferenceCache class with 36 test cases across helper functions and all cache operations.

Changes Made:

  • Created backend/tests/test_redis_cache_new.py with 36 test cases covering:
    • _truthy: all truthy/falsy string variations
    • _text_key: md5 hashing, case normalization, whitespace handling, empty text
    • RedisInferenceCache.init: env var parsing, truthy/falsy values
    • available property: enabled/disabled states
    • connect: disabled, successful connection, failure with/without degraded mode
    • get_classification / set_classification: hits, misses, errors, unavailable states
    • get_embedding / set_embedding: hits with float conversion, misses, errors
  • Updated backend/tests/conftest.py to skip this test file from main.py import (which has a pre-existing syntax error)

Impact it Made:
This adds test coverage for the Redis caching layer, ensuring graceful degradation works correctly when Redis is unavailable and cache operations behave correctly across different states.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 31, 2026

@tmdeveloper007 is attempting to deploy a commit to the ritesh Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 31, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1f5e16ef-6579-47ee-8514-b59eb8c4b803

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant