mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
Fix socket leak, clean up single use postgres databases (#2413)
* Fix socket leak, clean up single use postgres databases Signed-off-by: Spike Curtis <spike@coder.com> * Move migrate close defer until after we know it is not nil Signed-off-by: Spike Curtis <spike@coder.com>
This commit is contained in:
+6
-4
@@ -5,7 +5,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/coder/coder/cli/clitest"
|
||||
"github.com/coder/coder/coderd/coderdtest"
|
||||
@@ -30,13 +30,15 @@ func TestList(t *testing.T) {
|
||||
pty := ptytest.New(t)
|
||||
cmd.SetIn(pty.Input())
|
||||
cmd.SetOut(pty.Output())
|
||||
errC := make(chan error)
|
||||
done := make(chan any)
|
||||
go func() {
|
||||
errC <- cmd.ExecuteContext(ctx)
|
||||
errC := cmd.ExecuteContext(ctx)
|
||||
assert.NoError(t, errC)
|
||||
close(done)
|
||||
}()
|
||||
pty.ExpectMatch(workspace.Name)
|
||||
pty.ExpectMatch("Running")
|
||||
cancelFunc()
|
||||
require.NoError(t, <-errC)
|
||||
<-done
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user