mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +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.
|
// The user is responsible for calling the returned cleanup function.
|
||||||
func OpenContainerized(t TBSubset, opts DBContainerOptions) (string, func(), error) {
|
func OpenContainerized(t TBSubset, opts DBContainerOptions) (string, func(), error) {
|
||||||
container, containerCleanup, err := openContainer(t, opts)
|
container, containerCleanup, err := openContainer(t, opts)
|
||||||
|
if err != nil {
|
||||||
|
return "", nil, xerrors.Errorf("open container: %w", err)
|
||||||
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
containerCleanup()
|
containerCleanup()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
if err != nil {
|
|
||||||
return "", nil, xerrors.Errorf("open container: %w", err)
|
|
||||||
}
|
|
||||||
dbURL := ConnectionParams{
|
dbURL := ConnectionParams{
|
||||||
Username: "postgres",
|
Username: "postgres",
|
||||||
Password: "postgres",
|
Password: "postgres",
|
||||||
|
Reference in New Issue
Block a user