Skip to content

test(db): register the plain test driver once so -count above 1 passes - #3037

Merged
vavallee merged 1 commit into
mainfrom
test/openmemory-register-once
Oct 6, 2026
Merged

vavallee merged 1 commit into
mainfrom
test/openmemory-register-once

Conversation

@vavallee

@vavallee vavallee commented Oct 6, 2026

Copy link
Copy Markdown
Owner

TestWithRawConn_DriverWithoutSerialize (from #2983) called sql.Register in the test body, so go test -count=2 ./internal/db/ panics with "Register called twice for driver openmemory-plain". Wrapped it in a sync.Once. Test only, no changelog fragment.

Test plan

  • go test ./internal/db/ -run 'TestWithRawConn|TestOpenMemory' -count=3

🤖 Generated with Claude Code

https://claude.ai/code/session_016fJcCVbNnKsmj2MAAMwWj9

TestWithRawConn_DriverWithoutSerialize called sql.Register in the test
body, which panics with "Register called twice" on a second iteration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016fJcCVbNnKsmj2MAAMwWj9
Signed-off-by: vavallee <vavallee@protonmail.com>
@vavallee
vavallee enabled auto-merge (squash) October 6, 2026 18:02

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks clean. sync.Once is the right fix: sql.Register panics on a second call within the same process, which is exactly what -count=2 triggers by re-running tests in the same binary. No production code touched, no changelog fragment needed.

One minor note: the comment on registerPlainDriver (openmemory_test.go:92-93) is accurate and useful — no changes needed there.

— 🤖 Bindery triage bot (automated). Reply to correct me; a human will see it.

@codecov

codecov Bot commented Oct 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@vavallee
vavallee merged commit ed4daf8 into main Oct 6, 2026
39 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant