Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release-22.1: ccl/sqlproxyccl: fix TestConnectionMigration test flake #83478

Merged
merged 1 commit into from
Jun 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions pkg/ccl/sqlproxyccl/proxy_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1230,10 +1230,8 @@ func TestConnectionMigration(t *testing.T) {
conn, err := db.Conn(tCtx)
require.NoError(t, err)

// Spin up a goroutine to trigger the initial connection.
go func() {
_ = conn.PingContext(tCtx)
}()
// Trigger the initial connection.
require.NoError(t, conn.PingContext(tCtx))

var f *forwarder
require.Eventually(t, func() bool {
Expand Down Expand Up @@ -1283,16 +1281,10 @@ func TestConnectionMigration(t *testing.T) {
// one test.
<-goCh
time.Sleep(2 * time.Second)
// This should be an error because the transfer timed out.
// This should be an error because the transfer timed out. Connection
// should automatically be closed.
require.Error(t, f.TransferConnection())

// Connection should be closed because this is a non-recoverable error,
// i.e. timeout after sending the request, but before fully receiving
// its response.
err = conn.PingContext(tCtx)
require.Error(t, err)
require.Regexp(t, "(closed|bad connection)", err.Error())

select {
case <-time.After(10 * time.Second):
t.Fatalf("require that pg_sleep query terminates")
Expand Down