fix(test): userAppList 驱逐计数 16→18——上游 SNAPSHOT ClientEnum 增 MINIAPP(9 维度×2 格式),非本线改动

This commit is contained in:
chenxing
2026-09-28 12:44:28 +08:00
parent 257ba2dd64
commit fe19954d8b
@@ -37,8 +37,8 @@ import static org.mockito.Mockito.when;
* 关键契约(oapi 三接口缓存方案 5.2/5.3):
* <ul>
* <li>UserChangedEvent → 逐 userId 驱逐 boaUser/boaUserNull/identityCurrent 的 id: 维度 +
* userGroupRel 的 u: 维度 + userAppList 的 16 条可枚举 key
* (8 个 client 维度 × {旧格式, :s:auto},2026-09-10 起 key 含学校维度;
* userGroupRel 的 u: 维度 + userAppList 的 18 条可枚举 key
* (9 个 client 维度 × {旧格式, :s:auto},2026-09-10 起 key 含学校维度;
* 显式学校后缀不可枚举,靠 TTL 自愈);</li>
* <li>GroupChangedEvent / AppAuthzChangedEvent / ApplicationInfoCacheChangedEvent → userAppList 整清;</li>
* <li>物理删除用户(DB 查无)→ boaUser 系整清兜底。</li>
@@ -129,7 +129,7 @@ class CacheInvalidationListenerTest {
/**
* 用户变更(换组/禁用/身份切换)→ 精确驱逐:
* id:{userId}(boaUser/boaUserNull/identityCurrent)+ u:{userId}(userGroupRel)+
* 16 条 userAppList key(8 个 client 维度 × {旧格式, :s:auto})+ 按回查的 account/phone
* 18 条 userAppList key(9 个 client 维度 × {旧格式, :s:auto})+ 按回查的 account/phone
* 驱逐 login:/phone: 维度。
*/
@Test
@@ -146,9 +146,9 @@ class CacheInvalidationListenerTest {
verify(boaUserNull).evict("id:1");
verify(identityCurrent).evict("id:1");
verify(userGroupRel).evict("u:1");
// 16 条:('all' + ClientEnum 7 枚举名) × (旧格式 + ':s:auto')
// 18 条:('all' + ClientEnum 8 枚举名,SNAPSHOT 起 ClientEnum 增 MINIAPP) × (旧格式 + ':s:auto')
ArgumentCaptor<Object> keyCaptor = ArgumentCaptor.forClass(Object.class);
verify(userAppList, times(16)).evict(keyCaptor.capture());
verify(userAppList, times(18)).evict(keyCaptor.capture());
Set<String> appListKeys = new HashSet<>();
for (Object key : keyCaptor.getAllValues()) {
appListKeys.add(String.valueOf(key));