Skip to content

Commit a4447f0

Browse files
authored
Merge pull request #2527 from dolthub/aaron/binding_test-wait-for-stop
[no-release-notes] testing/go/binding_test.go: Fix a race condition in our Listener GetRunningServer() usage beacuse these tests were not waiting for services stop before they finished.
2 parents 5da9081 + 615fbec commit a4447f0

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

testing/go/binding_test.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ import (
2828
func TestBindingWithOidZero(t *testing.T) {
2929
// Start up a test server
3030
ctx, connection, controller := CreateServer(t, "postgres")
31-
defer controller.Stop()
31+
defer func() {
32+
connection.Close(ctx)
33+
controller.Stop()
34+
require.NoError(t, controller.WaitForStop())
35+
}()
3236
conn := connection.Default
3337

3438
// Create a table to insert into
@@ -51,7 +55,11 @@ func TestBindingWithOidZero(t *testing.T) {
5155

5256
func TestBindingWithTextArray(t *testing.T) {
5357
ctx, connection, controller := CreateServer(t, "postgres")
54-
defer controller.Stop()
58+
defer func() {
59+
connection.Close(ctx)
60+
controller.Stop()
61+
require.NoError(t, controller.WaitForStop())
62+
}()
5563
conn := connection.Default
5664

5765
m := pgtype.NewMap()

0 commit comments

Comments
 (0)