Skip to content

Commit

Permalink
Merge pull request #135353 from cockroachdb/blathers/backport-release…
Browse files Browse the repository at this point in the history
…-24.3-135319

release-24.3: pkg/ccl/testccl/sqlccl/sqlccl_test: TestShowTransferState flake fix
  • Loading branch information
Dedej-Bergin authored Nov 18, 2024
2 parents 667305a + 35668fd commit e52098a
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions pkg/ccl/testccl/sqlccl/show_transfer_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ func TestShowTransferState(t *testing.T) {
_, err = tenantDB.Exec("GRANT SELECT ON tab TO testuser")
require.NoError(t, err)

testutils.SucceedsSoon(t, func() error {
// Waiting for the cluster setting to propagate to the tenant.
var enabled bool
if err := tenantDB.QueryRow(
`SHOW CLUSTER SETTING server.user_login.session_revival_token.enabled`,
).Scan(&enabled); err != nil {
return err
}
if !enabled {
return errors.New("cluster setting not yet propagated")
}
return nil
})

testUserConn := tenant.SQLConn(t, serverutils.User(username.TestUser))

t.Run("without_transfer_key", func(t *testing.T) {
Expand Down Expand Up @@ -211,19 +225,7 @@ func TestShowTransferState(t *testing.T) {
t.Run("root_user", func(t *testing.T) {
var key string
var errVal, sessionState, sessionRevivalToken gosql.NullString
testutils.SucceedsSoon(t, func() error {
// Waiting for the cluster setting to propagate to the tenant.
var enabled bool
if err := tenantDB.QueryRow(
`SHOW CLUSTER SETTING server.user_login.session_revival_token.enabled`,
).Scan(&enabled); err != nil {
return err
}
if !enabled {
return errors.New("cluster setting not yet propagated")
}
return nil
})

err := tenantDB.QueryRow(`SHOW TRANSFER STATE WITH 'bar'`).Scan(&errVal, &sessionState, &sessionRevivalToken, &key)
require.NoError(t, err)
require.True(t, errVal.Valid)
Expand Down

0 comments on commit e52098a

Please sign in to comment.