test: stop example tests from writing SQLite files into examples/#2564
Merged
dgageot merged 2 commits intodocker:mainfrom Apr 28, 2026
Merged
Conversation
gtardif
approved these changes
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).