mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
test: fix incorrectly placed cleanup defer in dbtestutil (#15987)
This commit is contained in:
committed by
GitHub
parent
cc98bab30f
commit
ca96e670ed
@ -464,14 +464,14 @@ func openContainer(t TBSubset, opts DBContainerOptions) (container, func(), erro
|
||||
// The user is responsible for calling the returned cleanup function.
|
||||
func OpenContainerized(t TBSubset, opts DBContainerOptions) (string, func(), error) {
|
||||
container, containerCleanup, err := openContainer(t, opts)
|
||||
if err != nil {
|
||||
return "", nil, xerrors.Errorf("open container: %w", err)
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
containerCleanup()
|
||||
}
|
||||
}()
|
||||
if err != nil {
|
||||
return "", nil, xerrors.Errorf("open container: %w", err)
|
||||
}
|
||||
dbURL := ConnectionParams{
|
||||
Username: "postgres",
|
||||
Password: "postgres",
|
||||
|
Reference in New Issue
Block a user