test (cache/search): fix NewTestServer(...) storage (#5081)
Fix ensures that the TestServer returned uses the correct directory for writing its sqlite files, which was created via t.TempDir() (cherry picked from commit 85f91043a164bdacc1c6738ae0e7c50077d55c79)
This commit is contained in:
1 parent
829ea02e6f
commit
863359aa26
2 files changed
+5
-2
No files matched your search
@@ -140,9 +140,9 @@ func TestSearch(t *testing.T) {
|
||||
assert.Nil(t, apiErr)
|
||||
assert.NotNil(t, resp)
|
||||
assert.NotNil(t, r)
|
||||
assert.EqualValues(t, r, &daemon.SearchResult{
|
||||
assert.EqualValues(t, &daemon.SearchResult{
|
||||
RefreshStatus: daemon.NotRefreshing,
|
||||
})
|
||||
}, r)
|
||||
})
|
||||
|
||||
t.Run("empty response from query", func(t *testing.T) {
|
||||
|
||||
@@ -37,6 +37,9 @@ func NewTestServer(t *testing.T, cmd Commander, opt ...Option) *TestServer {
|
||||
RecheckSupportInterval: DefaultRecheckSupportInterval,
|
||||
LogWriter: io.Discard,
|
||||
DotDirectory: dotDir,
|
||||
// we need to provide this, otherwise it will open a store in the user's
|
||||
// home dir. See db.Open(...)
|
||||
DatabaseUrl: dotDir + "cache.db?_pragma=foreign_keys(1)",
|
||||
}
|
||||
|
||||
s, err := New(ctx, cfg)
|
||||
|
||||
Reference in new issue
Block a user