Skip to content

Commit 05cbc3c

Browse files
committed
sleep to prevent flake
1 parent c8a7c9a commit 05cbc3c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

coderd/database/pubsub/pubsub_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"database/sql"
66
"testing"
7+
"time"
78

89
"github.com/prometheus/client_golang/prometheus"
910
"github.com/stretchr/testify/assert"
@@ -179,6 +180,9 @@ func TestPGPubsubDriver(t *testing.T) {
179180

180181
// wait for the reconnect
181182
_ = testutil.RequireRecvCtx(ctx, t, subDriver.Connections)
183+
// we need to sleep because the raw connection notification
184+
// is sent before the pq.Listener can reestablish it's listeners
185+
time.Sleep(1 * time.Second)
182186

183187
// ensure our old subscription still fires
184188
err = pubber.Publish("test", []byte("hello-again"))

0 commit comments

Comments
 (0)