mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-27 04:49:47 +01:00
test(api): make mock RedisUtils usable and stop aspect swallowing calls
Add @Override to the in-memory RedisUtils mock methods and enable renren.redis.open in the test profile so RedisAspect routes to the mock instead of short-circuiting cached lookups to null.
This commit is contained in:
parent
514928722d
commit
934a349cdd
2 changed files with 7 additions and 2 deletions
|
|
@ -54,14 +54,17 @@ public class TestConfig {
|
|||
private final java.util.Map<String, Object> mockCache = new java.util.concurrent.ConcurrentHashMap<>();
|
||||
private final java.util.Map<String, java.util.Map<String, Object>> mockHashCache = new java.util.concurrent.ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public void set(String key, Object value) {
|
||||
mockCache.put(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(String key, Object value, long timeout) {
|
||||
mockCache.put(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get(String key) {
|
||||
return mockCache.get(key);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,10 +58,12 @@ spring:
|
|||
enabled: true
|
||||
path: /h2-console
|
||||
|
||||
# Disable Redis for testing
|
||||
# Redis is mocked (MockRedisUtils in TestConfig), but the aspect must let
|
||||
# calls through; with open=false RedisAspect swallows every RedisUtils call
|
||||
# and returns null, so even the in-memory mock would be unreachable.
|
||||
renren:
|
||||
redis:
|
||||
open: false
|
||||
open: true
|
||||
|
||||
# MyBatis Plus configuration for testing
|
||||
mybatis-plus:
|
||||
|
|
|
|||
Loading…
Reference in a new issue