@@ -352,7 +352,7 @@ func openContainer(t TBSubset, opts DBContainerOptions) (container, func(), erro
352
352
nameHashStr := hex .EncodeToString (nameHash [:])
353
353
lock := flock .New (filepath .Join (os .TempDir (), "coder-postgres-container-" + nameHashStr [:8 ]))
354
354
if err := lock .Lock (); err != nil {
355
- return container {}, nil , xerrors .Errorf ("lock: %w" , err )
355
+ return container {}, func () {} , xerrors .Errorf ("lock: %w" , err )
356
356
}
357
357
defer func () {
358
358
err := lock .Unlock ()
@@ -364,7 +364,7 @@ func openContainer(t TBSubset, opts DBContainerOptions) (container, func(), erro
364
364
365
365
pool , err := dockertest .NewPool ("" )
366
366
if err != nil {
367
- return container {}, nil , xerrors .Errorf ("create pool: %w" , err )
367
+ return container {}, func () {} , xerrors .Errorf ("create pool: %w" , err )
368
368
}
369
369
370
370
var resource * dockertest.Resource
@@ -376,7 +376,7 @@ func openContainer(t TBSubset, opts DBContainerOptions) (container, func(), erro
376
376
if resource == nil {
377
377
tempDir , err = os .MkdirTemp (os .TempDir (), "postgres" )
378
378
if err != nil {
379
- return container {}, nil , xerrors .Errorf ("create tempdir: %w" , err )
379
+ return container {}, func () {} , xerrors .Errorf ("create tempdir: %w" , err )
380
380
}
381
381
runOptions := dockertest.RunOptions {
382
382
Repository : "gcr.io/coder-dev-1/postgres" ,
@@ -421,14 +421,14 @@ func openContainer(t TBSubset, opts DBContainerOptions) (container, func(), erro
421
421
}
422
422
})
423
423
if err != nil {
424
- return container {}, nil , xerrors .Errorf ("could not start resource: %w" , err )
424
+ return container {}, func () {} , xerrors .Errorf ("could not start resource: %w" , err )
425
425
}
426
426
}
427
427
428
428
hostAndPort := resource .GetHostPort ("5432/tcp" )
429
429
host , port , err := net .SplitHostPort (hostAndPort )
430
430
if err != nil {
431
- return container {}, nil , xerrors .Errorf ("split host and port: %w" , err )
431
+ return container {}, func () {} , xerrors .Errorf ("split host and port: %w" , err )
432
432
}
433
433
434
434
for r := retry .New (50 * time .Millisecond , 15 * time .Second ); r .Wait (context .Background ()); {
@@ -443,7 +443,7 @@ func openContainer(t TBSubset, opts DBContainerOptions) (container, func(), erro
443
443
}
444
444
}
445
445
if err != nil {
446
- return container {}, nil , xerrors .Errorf ("pg_isready: %w" , err )
446
+ return container {}, func () {} , xerrors .Errorf ("pg_isready: %w" , err )
447
447
}
448
448
449
449
return container {
@@ -470,7 +470,7 @@ func OpenContainerized(t TBSubset, opts DBContainerOptions) (string, func(), err
470
470
}
471
471
}()
472
472
if err != nil {
473
- return "" , nil , xerrors .Errorf ("open container: %w" , err )
473
+ return "" , func () {} , xerrors .Errorf ("open container: %w" , err )
474
474
}
475
475
dbURL := ConnectionParams {
476
476
Username : "postgres" ,
0 commit comments