--- title: "ADR 0077: TestQMI exposes recording and scripting fields instead of a real queue" --- * Status: accepted * Code: [`pkg/test/concurrency/concurrency.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/test/concurrency/concurrency.go) ## Context `TestQMI` is a fake of the queue manager used by reconciler and concurrency tests. The real manager holds state across calls; tests need to observe calls and to script sequences without building it. ## Decision Each optional field of `TestQMI` serves one test need: * `Removed` records `"repoKey|prKey"` pairs passed to `RemoveFromQueue`. * `NextInQueue` is drained one key per `RemoveAndTakeItemFromQueue` call; `RepeatNext` returns the same key forever, to model a queue that never releases a slot. * `Taken` counts `RemoveAndTakeItemFromQueue` calls. * `EchoAcquired` makes `AddListToRunningQueue` return the list it was given instead of `RunningQueue`; `Passed` records the list of every call in order. * `AcquireAdmission` maps promotion mode to `RemoveAndTakeItemFromQueue`, other modes to `AddListToRunningQueue`, and `AdmissionResume` to nil. `FinishAdmission` calls `RemoveFromQueue(AdmissionRepoKey, key)` for candidates whose outcome is `queue.StartGone`. ## Consequences * The fields are pointers where mutation must survive the value receiver (`TestQMI` methods take `t TestQMI`). * `InitQueues` and `RunningPipelineRuns` panic with "implement me"; a test calling them crashes rather than getting a default. * The code does not show which tests drive `RepeatNext` beyond the field name; this record states only what the fake does.