merchant: TestPurchaseSessionGuardHoldsThroughTheOutcomeUnknownWindow fails deterministically without ndsctl on PATH — harness installs no fake (needs installRenewalNdsctl)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 72/100
Direzione di ricerca
Inizia da src/merchant/purchasesession_duplicate_guard_test.go, dove newDuplicateGuardMerchant costruisce l'harness e non installa mai un ndsctl fittizio. Guarda installRenewalNdsctl, che altri test del pacchetto già usano, e richiamalo dall'harness. Esegui go test -race -count=3 -tags testenv . -run TestPurchaseSessionGuardHoldsThroughTheOutcomeUnknownWindow in src/merchant senza ndsctl nel PATH. È completato quando il test passa su un host senza ndsctl.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
TestPurchaseSessionGuardHoldsThroughTheOutcomeUnknownWindow (src/merchant/purchasesession_duplicate_guard_test.go:239) fails deterministically on any host without an ndsctl binary on PATH — in isolation and in every full-suite run. The harness newDuplicateGuardMerchant never installs a fake ndsctl (unlike ~10 other tests in the package that call installRenewalNdsctl), so the test's final assertion — the one assertion in the file that requires a successful grant — walks the real valve.OpenGate → authorizeMAC → exec ndsctl path and dies with "executable file not found".
Verified on
- Commits:
cb4db7f(main) andad6b22e(PR #718 head) — identical behavior; unrelated to #718 (test-file-local harness gap, pre-existing). - linux/amd64, go1.26.8, bare host, no ndsctl on PATH.
- 0/3 isolated runs and 0/4 full-suite runs passed on this host across both commits.
Evidence (verbatim)
--- FAIL: TestPurchaseSessionGuardHoldsThroughTheOutcomeUnknownWindow (1.78s)
purchasesession_duplicate_guard_test.go:307: the third submission must grant a session, got {"kind":21023,...,["code","payment-received-grant-pending"]...,"content":"Your payment was received, but this TollGate could not open your access just now (the portal manager did not answer). ..."}
Discriminator experiment — identical command with a trivial fake ndsctl (auth → exit 0) prepended to PATH:
--- PASS: TestPurchaseSessionGuardHoldsThroughTheOutcomeUnknownWindow (0.72s) # ×3, -race -count=3
Mechanism
- Third submission:
Receivesucceeds (scripted wallet,wallet.calls == 2holds), thengrantSessionAccess→openGateForSession→valve.OpenGate→authorizeMAC→runNdsctl("auth", ...)→exec: "ndsctl": executable file not found in $PATH. valve.AuthDelayis only ever set inmain.gofrom config; in tests it is always 0, soOpenGatealways takes the synchronous ndsctl branch (theAuthDelay > 0deferred-auth branch is the only one that does not exec synchronously).- The failure surfaces as the owed-grant notice (21023
payment-received-grant-pending) instead of the expected kind-1022 session event. - The sibling tests in the same file (e.g.
TestPurchaseSessionGuardFailsOpenOnUnserializableNote, the sequential-resubmit test) pass on ndsctl-less hosts because their assertions end in refusal notices — a failed grant still produces an acceptable 21023 there. Only this test asserts the successful grant, which is why the file looks "half green" and the failure reads like a flake of a different class.
Reproduce
cd src/merchant
go test -race -count=3 -tags testenv . -run 'TestPurchaseSessionGuardHoldsThroughTheOutcomeUnknownWindow' # 3/3 FAIL on a bare host
# then prepend any auth-success ndsctl stub to PATH and re-run # 3/3 PASS
Impact
Any ndsctl-less CI runner or dev box has a permanently red make go-battery/full suite regardless of other fixes — including main after #718 merges. It also produces misleading full-suite noise (grant-pending notices, owed-grant reconciler activity) that pollutes the log other flaky investigations (#731/#732/#733) read.
Suggested fix
Have newDuplicateGuardMerchant call the existing in-package installRenewalNdsctl(t) (it already scopes a fake via t.Setenv("PATH", ...) and restores it), so the grant path is exercised for real and the file's assertions stop depending on host state. Alternatively, tolerate payment-received-grant-pending at line 306 when ndsctl is absent — weaker, since it stops testing the grant at all.
References
- Found while independently verifying #718 (evidence comment: https://github.com/OpenTollGate/tollgate-module-basic-go/pull/718#issuecomment-6047968619)
- Same validation train as #731/#732/#733; note #731's host was also ndsctl-less, so this red was likely present (unreported) in those full-suite runs too
- Lingua principale
- Go
- Stelle
- 12
- Fork
- 14
- Merge medio
- 3g 20h
- PR unite (30g)
- 261
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di OpenTollGate/tollgate-module-basic-go
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
OpenTollGate/tollgate-module-basic-go#1159 ·
I maintainer di solito rispondono entro 1 giorno
-
Degraded-mode hygiene follow-ups: dead walletNotInitializedError() + main.go's startup log still over-promises mint recoveryForse già presa @Amperstrand l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
OpenTollGate/tollgate-module-basic-go#1135 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
setup_uhttpd_portal hardcodes the GUEST portal docroot to the TollGate path — the brand token cannot select a re-brand guest portalForse già presa @Amperstrand l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
OpenTollGate/tollgate-module-basic-go#1122 ·
I maintainer di solito rispondono entro 1 giorno
-
changelog: dependency-security sweep missing from [Unreleased] [Amperstrand fork #105 review debt]Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
OpenTollGate/tollgate-module-basic-go#1055 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
OpenTollGate/tollgate-module-basic-go#1027 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di OpenTollGate/tollgate-module-basic-go
Issue simili
-
needs-area
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Azure/typespec-azure#5936 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 70/100
-
Fix mode unpins a reusable workflow call when the same repository is also used as a step actionAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
github/gh-actions-lock#261 ·
I maintainer di solito rispondono entro 1 giorno
-
bug documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
labmonkeys-space/nl6#974 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100