tigerquoll opened a new pull request, #1067: URL: https://github.com/apache/yunikorn-k8shim/pull/1067
### What is this PR for? A randomized property test for the shim scheduler cache (`pkg/cache/external`). It drives random sequences of the operations the cache sees in production -- informer add/update/delete with and without an assignment, assume and forget from the scheduling cycle, node add and remove -- against a small reference model, and asserts six invariants after every single operation: - an assumed pod is visible on the node it is assumed on - a pod that never bound is not assigned to a node - the assignment map and the node infos hold the same view - objects handed to the cache are never mutated (they can be owned by the informer cache) - scheduling state (assumed/assigned/orphaned) only covers cached pods - the cache matches the reference model Sequences are generated from fixed seeds and are fully deterministic; a failure reports the seed, the step number and the tail of the operation history, so it replays exactly. An extra seed can be supplied via `YUNIKORN_CACHE_FUZZ_SEED` for exploratory runs. ### This PR deliberately fails CI on master The fuzzer finds two live defects on every seed within a few dozen operations: | defect | minimal trigger | first failure per seed | |---|---|---| | YUNIKORN-3355 -- a forgotten pod keeps its assignment; informer updates are re-stamped with it (and the informer-owned pod object is mutated) | update-pending, assume, forget | steps 21-74 across the 5 seeds | | YUNIKORN-3374 -- a pod assumed on a removed node is orphaned with the shim-invented node name and re-adopted when the node returns | assume, remove node, add node | steps 94-149 with the 3355 sequences excluded | This PR is a **draft until the fixes for YUNIKORN-3355 and YUNIKORN-3374 merge**; rebased on top of them it passes (verified locally against both fixes: 5 seeds x 5,000 steps, `-race`, deadlock detection, `-count=5`) and becomes a permanent regression guard for both defects and for the cache invariants generally. ### How was this patch tested? It is a test. Determinism is itself pinned by a test (same seed replays the same operation history), and every invariant was mutation-checked: reverting either fix makes the corresponding invariant fail with a replayable report. Generated by the Author with assistance from Claude Code -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
