@@ -14,7 +14,7 @@ import (
14
14
15
15
"github.com/coder/coder/v2/coderd/database"
16
16
"github.com/coder/coder/v2/coderd/database/dbgen"
17
- "github.com/coder/coder/v2/coderd/database/dbmem "
17
+ "github.com/coder/coder/v2/coderd/database/dbtestutil "
18
18
"github.com/coder/coder/v2/coderd/searchquery"
19
19
"github.com/coder/coder/v2/codersdk"
20
20
)
@@ -300,7 +300,7 @@ func TestSearchWorkspace(t *testing.T) {
300
300
t .Run (c .Name ,func (t * testing.T ) {
301
301
t .Parallel ()
302
302
// TODO: Replace this with the mock database.
303
- db := dbmem . New ( )
303
+ db , _ := dbtestutil . NewDB ( t )
304
304
if c .Setup != nil {
305
305
c .Setup (t ,db )
306
306
}
@@ -331,7 +331,8 @@ func TestSearchWorkspace(t *testing.T) {
331
331
332
332
query := ``
333
333
timeout := 1337 * time .Second
334
- values ,errs := searchquery .Workspaces (context .Background (),dbmem .New (),query , codersdk.Pagination {},timeout )
334
+ db ,_ := dbtestutil .NewDB (t )
335
+ values ,errs := searchquery .Workspaces (context .Background (),db ,query , codersdk.Pagination {},timeout )
335
336
require .Empty (t ,errs )
336
337
require .Equal (t ,int64 (timeout .Seconds ()),values .AgentInactiveDisconnectTimeoutSeconds )
337
338
})
@@ -389,7 +390,7 @@ func TestSearchAudit(t *testing.T) {
389
390
t .Parallel ()
390
391
// Do not use a real database, this is only used for an
391
392
// organization lookup.
392
- db := dbmem . New ( )
393
+ db , _ := dbtestutil . NewDB ( t )
393
394
values ,countValues ,errs := searchquery .AuditLogs (context .Background (),db ,c .Query )
394
395
if c .ExpectedErrorContains != "" {
395
396
require .True (t ,len (errs )> 0 ,"expect some errors" )
@@ -628,7 +629,7 @@ func TestSearchTemplates(t *testing.T) {
628
629
t .Parallel ()
629
630
// Do not use a real database, this is only used for an
630
631
// organization lookup.
631
- db := dbmem . New ( )
632
+ db , _ := dbtestutil . NewDB ( t )
632
633
values ,errs := searchquery .Templates (context .Background (),db ,c .Query )
633
634
if c .ExpectedErrorContains != "" {
634
635
require .True (t ,len (errs )> 0 ,"expect some errors" )