Skip to content

test(ocpp): wait for the boot probe before testing later - #2085

Merged
frahlg merged 1 commit into
masterfrom
ocpp-later-flake
Nov 25, 2026
Merged

frahlg merged 1 commit into
masterfrom
ocpp-later-flake

Conversation

@frahlg

@frahlg frahlg commented Nov 25, 2026

Copy link
Copy Markdown
Member

TestLaterRunsAfterTheSlotIsFree failed now and then in CI (once on #2072).

Cause: right after connectCharger, the capability probe from connect and boot can still hold the charger's slot. The probe's answer runs in a boundCall on the library's goroutine. While a boundCall holds the slot, later queues its func instead of running it at once, so the test's first assertion sometimes saw a queued func where it expected one that had run.

Fix: the test waits until the probe has finished and no boundCall holds the slot (waitSlotIdle, at most 2 s) before it starts. Production code is unchanged.

  • go test -race -count=30 -run TestLaterRunsAfterTheSlotIsFree ./internal/ocpp/: ok.
  • go test -count=1 ./internal/ocpp/: ok.

Test only, so no changeset (no-changeset label).

🤖 Generated with Claude Code

TestLaterRunsAfterTheSlotIsFree assumed the slot was free right after
connect. The capability probe answers in a boundCall on the library's
goroutine, so the "runs at once" step sometimes found the slot held and
queued instead. Under -race that failed 22 times in 900 runs (PR #2072
CI). Wait until the probe has finished and no boundCall holds the slot;
900 runs then pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
@frahlg frahlg added the no-changeset PR intentionally exempt from the changeset requirement (dev tooling / non-shipping) label Nov 25, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T13:28:22.392594Z 2c456c9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@frahlg
frahlg merged commit 0dc8aae into master Nov 25, 2026
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changeset PR intentionally exempt from the changeset requirement (dev tooling / non-shipping)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant