memos/store/test
Harsha Rahul Boggaram f227c4040f feat: add redis session management for horizontal scaling in kubernetes and fallback to local 2025-09-06 11:04:31 -07:00
..
README.md feat: add redis session management for horizontal scaling in kubernetes and fallback to local 2025-09-06 11:04:31 -07:00
activity_test.go chore: move store test 2025-03-17 21:51:02 +08:00
attachment_test.go refactor: attachment service part2 2025-06-18 00:09:19 +08:00
distributed_session_test.go feat: add redis session management for horizontal scaling in kubernetes and fallback to local 2025-09-06 11:04:31 -07:00
idp_test.go chore: move store test 2025-03-17 21:51:02 +08:00
inbox_test.go chore: move store test 2025-03-17 21:51:02 +08:00
memo_relation_test.go chore: move store test 2025-03-17 21:51:02 +08:00
memo_test.go fix: memo filter for sqlite 2025-07-22 23:39:52 +08:00
migrator_test.go chore: tweak auth service 2025-06-24 23:31:37 +08:00
reaction_test.go chore: move store test 2025-03-17 21:51:02 +08:00
store.go chore: bump version 2025-06-24 23:06:57 +08:00
user_setting_test.go refactor: general user setting 2025-06-23 23:23:57 +08:00
user_test.go chore: move store test 2025-03-17 21:51:02 +08:00
workspace_setting_test.go chore: move store test 2025-03-17 21:51:02 +08:00

README.md

Store tests

How to test store with MySQL?

  1. Create a database in your MySQL server.
  2. Run the following command with two environment variables set:
DRIVER=mysql DSN=root@/memos_test go test -v ./store/test/...
  • DRIVER should be set to mysql.
  • DSN should be set to the DSN of your MySQL server.

How to test distributed caching with Redis?

  1. Start a Redis server locally or use a remote Redis instance.
  2. Run the following command with the Redis URL environment variable set:
REDIS_URL=redis://localhost:6379 go test -v ./store/test/ -run "Cache|Redis|Hybrid|DistributedSession"
  • REDIS_URL should be set to your Redis server URL.
  • If REDIS_URL is not set, Redis-dependent tests will be skipped.

Available cache tests

  • TestCacheInterface - Tests cache interface compliance (works without Redis)
  • TestCacheStatus - Tests cache status reporting (works without Redis)
  • TestRedisCache - Tests Redis cache implementation (requires Redis)
  • TestHybridCache - Tests hybrid local+Redis cache (requires Redis)
  • TestDistributedSessionStore - Tests session sharing across multiple store instances (requires Redis)
  • TestDistributedSessionPerformanceStore - Performance tests for distributed sessions (requires Redis)

Running comprehensive cache tests

Use the provided script for full cache testing:

./test_cache_comprehensive.sh

This script will automatically detect Redis availability and run appropriate tests.