Skip to content

Commit 97b2e83

Browse files
committed
physical: deflake TestCreateTenantFromReplicationUsingID
We occasionally see slow quiesces on the `TestCreateTenantFromReplicationUsingID` test. This appears to be caused by shutting down the server while the source tenant is still being created. To avoid this, we wait until the SQL server on the source tenant is ready before teardown. Fixes: #155345 Release note: None
1 parent abe5ceb commit 97b2e83

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pkg/crosscluster/physical/stream_ingestion_planning_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/cockroachdb/cockroach/pkg/crosscluster/replicationtestutils"
1414
"github.com/cockroachdb/cockroach/pkg/jobs"
1515
"github.com/cockroachdb/cockroach/pkg/security/username"
16+
"github.com/cockroachdb/cockroach/pkg/testutils"
1617
"github.com/cockroachdb/cockroach/pkg/testutils/serverutils"
1718
"github.com/cockroachdb/cockroach/pkg/testutils/sqlutils"
1819
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
@@ -67,4 +68,16 @@ func TestCreateTenantFromReplicationUsingID(t *testing.T) {
6768
t.Logf("starting replication [50]->[51]")
6869
sqlB.Exec(t, "CREATE VIRTUAL CLUSTER [51] FROM REPLICATION OF 'cluster-50' ON $1", serverAURL.String())
6970
})
71+
72+
// We wait for tenant 50's SQL server to be up and running before ending the
73+
// test. This should help reduce flakes where the tenant is being setup when
74+
// the stopper begins quiescing.
75+
testutils.SucceedsSoon(t, func() error {
76+
tenantConn, err := serverA.ApplicationLayer().SQLConnE(serverutils.DBName("cluster:cluster-50"))
77+
if err != nil {
78+
return err
79+
}
80+
defer tenantConn.Close()
81+
return tenantConn.PingContext(ctx)
82+
})
7083
}

0 commit comments

Comments
 (0)