tigerquoll opened a new pull request, #1072: URL: https://github.com/apache/yunikorn-k8shim/pull/1072
### What this is A pilot using Go's `testing/synctest` to turn a probabilistic data-race soak into a deterministic millisecond test, and to document the pattern for future FSM/lock interleaving tests. JIRA: [YUNIKORN-3387](https://issues.apache.org/jira/browse/YUNIKORN-3387) ### Design Reproduce the [YUNIKORN-3376](https://issues.apache.org/jira/browse/YUNIKORN-3376) `Task.pod` race (`SetTaskPod` vs `checkPodMetadataBeforeScheduling`) deterministically. The race detector reports on any two happens-before-unordered accesses — it does not need them to overlap in real time — so the only missing ingredient is a fixed order. A synctest bubble supplies that through its fake clock: the two operations run in separate goroutines with different sleeps, and the shorter sleep is guaranteed to wake first. The file header documents the reusable recipe and two non-obvious traps (ordering must come from the fake clock, not from sequencing through the root goroutine via `synctest.Wait`; the root must durably block). ### Results On master (with the 3376 fix present) it passes. With the fix reverted it fires the race detector deterministically 5/5 runs, all three orderings — versus the old ~60s probabilistic soak. ### Constraint found (documented in the file) synctest is viable here only with go-deadlock detection **off**: go-deadlock arms a pooled `time.AfterFunc` per lock acquisition, and resetting a bubble-allocated timer outside the bubble is a fatal error that takes down the whole test binary. The test therefore skips itself when deadlock tracking is enabled (guarded on the core locking flag, which the shim's `pkg/locking` delegates to). **Consequence to weigh:** because `make test` / CI run with detection enabled, this test is skipped in CI as configured — it guards `go test -race` runs without detection. Opening as a draft so that trade-off can be discussed. Scope for future use: `looplab/fsm` starts no goroutines, so object-level FSM interleavings are in reach; anything routed through the dispatcher stays with the chaos harness. Test-only; `make lint` and `make license-check` clean. -- 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]
