Loading
test(iam): prove the relationship cache against a live Redis (S25 relationship cache plan: 3/3)
Summary
- Problem: the shared relationship cache has only been tested against a stub store. Nothing shows that two pods really share one entry, that the key has the documented shape and lifetime, or that a stalled Redis falls through to IAM within the store deadline.
- Impact: the team. Users and operators see nothing change; no production code changes.
- Change: a Redis integration test for
CachingResolvercovers four cases. Twodecisionresolvers over one client make one IAM call and write one key of the shapear:iam_relationships:decision_v1:<sha256 hex>with a positivePTTLat or below the TTL. An entry lapses with its short TTL and the next read refetches. Thedecisionandverdictinstances write two separate keys. A listener that completes the handshake and never replies makes a read fall through within the derived store deadline, with the error counted.test:integration:iam-riggets aredis:7-alpineservice andARTIFACT_REGISTRY_REDIS_TEST_ADDR, so the file runs there as well as intest:integration.docs/dev/redis-testing.mdrecords whyinternal/iamstays out of the Redis topology matrix. Thechanges:list oftest:integration:iam-rignow includesinternal/redisclientandinternal/testutil, the packages the new tests depend on, so an MR that touches only one of them runs the job that covers it. - Downsides:
test:integration:iam-rigstarts one more container. An MR that changes onlyinternal/redisclientdoes not starttest:integration, because itschanges:list is shared with the datastore jobs;test:integration:iam-rigand thetest:integration:redis-*jobs run on it instead. Cache writes are detached and expire at an absolute time, so the tests poll for the key instead of reading it right after the call. The TTL-lapse test waits about three seconds.
Plan and spec amendments
- Plan
docs/plans/2026-09-15-s25-relationship-cache-key-value-store.md: the Status rows for steps 2 and 3 carry their MR links. Step 2's row was not filled when it merged. - Same plan, step 3: the claim that enrolling
internal/iamin the Redis matrix would lose coverage on the security mirror is removed.test:integrationis changes-gated and the matrix jobs also run on the mirror, so it was false.
Checklist
- Ran it: ran the four tests three times against a local
redis-server7.0, and the full unit suite is green. The new CI service and itsredisalias have not run yet; the two integration jobs on this pipeline are the check. - Interfaces and data: none. Test, CI and docs only.
- Failure: n/a, no production change. The stalled-store test asserts the failure path: the read falls through to IAM within the store deadline and counts one
event="error"per failed command. - Rollout: n/a, no production change.
- Hot path: n/a, no production change.
- Database: n/a, no migration or query change.
- Security: n/a, no input, route, permission or authentication change. The new service is a CI-only Redis with no data.
- ADRs: none govern a test or CI service.
- E2E: no scenario rows; the tests sit below the IAM client.
- Simplicity: reuses
testutil.StartIsolatedRedisClient,testutil.NewStallingRedisandtestutil.UniqueKey, with no new helper package. Enrolling the package in the topology matrix was rejected: the store issues single-keyGETandSETon a digest that cannot cross a slot, andinternal/cache/counteralready proves that wrapper shape on all three topologies.
Related to #1279
Edited by David Fernandez