Skip to content

test: stop example tests from writing SQLite files into examples/#2564

Merged
dgageot merged 2 commits intodocker:mainfrom
dgageot:board/fix-tests-writing-sqlite-files-to-disk-f2ebaec0
Apr 28, 2026
Merged

test: stop example tests from writing SQLite files into examples/#2564
dgageot merged 2 commits intodocker:mainfrom
dgageot:board/fix-tests-writing-sqlite-files-to-disk-f2ebaec0

Conversation

@dgageot
Copy link
Copy Markdown
Member

@dgageot dgageot commented Apr 28, 2026

Some examples (memory, RAG, response cache) define toolsets with relative paths
like `./funny.db`, `./bm25.db`, `./cache.json`. When `TestLoadExamples` ran,
the loader resolved those against the example file's parent directory, so the
test was creating real SQLite/JSON files inside the `examples/` tree.

Fix: in the test, wrap the example bytes in a `config.NewBytesSource` (whose
`ParentDir()` returns `""`) and set `runConfig.WorkingDir` to a per-subtest
`t.TempDir()`. The existing `cmp.Or(agentSource.ParentDir(), runConfig.WorkingDir)`
fallback in the loader then redirects every relative path into the temp dir.

Bonus: since each subtest now has its own temp dir, the previous SQLite-lock
contention between examples that share relative DB names is gone, so the
subtests run in parallel.

A second commit tidies up `TestLoadExamples` (extracts an env-gathering
helper, inlines the anonymous `versioned` struct, drops a redundant
`if err != nil` wrapper around an `errors.Is` check, and flattens the
`RuntimeConfig` literal).

@dgageot dgageot requested a review from a team as a code owner April 28, 2026 08:39
@dgageot dgageot merged commit 236cda4 into docker:main Apr 28, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants