Skip to content

Commit ca96e67

Browse files
authored
test: fix incorrectly placed cleanup defer in dbtestutil (#15987)
1 parent cc98bab commit ca96e67

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

coderd/database/dbtestutil/postgres.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,14 +464,14 @@ func openContainer(t TBSubset, opts DBContainerOptions) (container, func(), erro
464464
// The user is responsible for calling the returned cleanup function.
465465
func OpenContainerized(t TBSubset, opts DBContainerOptions) (string, func(), error) {
466466
container, containerCleanup, err := openContainer(t, opts)
467+
if err != nil {
468+
return "", nil, xerrors.Errorf("open container: %w", err)
469+
}
467470
defer func() {
468471
if err != nil {
469472
containerCleanup()
470473
}
471474
}()
472-
if err != nil {
473-
return "", nil, xerrors.Errorf("open container: %w", err)
474-
}
475475
dbURL := ConnectionParams{
476476
Username: "postgres",
477477
Password: "postgres",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy