mirror of https://github.com/usememos/memos.git
|
|
||
|---|---|---|
| .. | ||
| README.md | ||
| activity_test.go | ||
| attachment_test.go | ||
| distributed_session_test.go | ||
| idp_test.go | ||
| inbox_test.go | ||
| memo_relation_test.go | ||
| memo_test.go | ||
| migrator_test.go | ||
| reaction_test.go | ||
| store.go | ||
| user_setting_test.go | ||
| user_test.go | ||
| workspace_setting_test.go | ||
README.md
Store tests
How to test store with MySQL?
- Create a database in your MySQL server.
- Run the following command with two environment variables set:
DRIVER=mysql DSN=root@/memos_test go test -v ./store/test/...
DRIVERshould be set tomysql.DSNshould be set to the DSN of your MySQL server.
How to test distributed caching with Redis?
- Start a Redis server locally or use a remote Redis instance.
- 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_URLshould be set to your Redis server URL.- If
REDIS_URLis 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.