@@ -1953,7 +1953,7 @@ func TestUserPrivileges(t *testing.T) {
1953
1953
},
1954
1954
}
1955
1955
1956
- server , s , dbA , _ := setupLogicalTestServer (t , ctx , clusterArgs , 1 )
1956
+ server , s , dbA , dbB := setupLogicalTestServer (t , ctx , clusterArgs , 1 )
1957
1957
defer server .Stopper ().Stop (ctx )
1958
1958
1959
1959
dbBURL := replicationtestutils .GetExternalConnectionURI (t , s , s , serverutils .DBName ("b" ))
@@ -1966,7 +1966,8 @@ func TestUserPrivileges(t *testing.T) {
1966
1966
testuser2 := sqlutils .MakeSQLRunner (s .SQLConn (t , serverutils .User (username .TestUser + "2" ), serverutils .DBName ("a" )))
1967
1967
1968
1968
var jobAID jobspb.JobID
1969
- testuser2 .QueryRow (t , "CREATE LOGICAL REPLICATION STREAM FROM TABLE tab ON $1 INTO TABLE tab" , dbBURL .String ()).Scan (& jobAID )
1969
+ createStmt := "CREATE LOGICAL REPLICATION STREAM FROM TABLE tab ON $1 INTO TABLE tab"
1970
+ testuser2 .QueryRow (t , createStmt , dbBURL .String ()).Scan (& jobAID )
1970
1971
1971
1972
t .Run ("view-control-job" , func (t * testing.T ) {
1972
1973
showJobStmt := "select job_id from [SHOW JOBS] where job_id=$1"
@@ -2006,11 +2007,17 @@ func TestUserPrivileges(t *testing.T) {
2006
2007
testuser .Exec (t , fmt .Sprintf (testingUDFAcceptProposedBaseWithSchema , "testschema" , "tab" ))
2007
2008
})
2008
2009
2009
- t .Run ("replication" , func (t * testing.T ) {
2010
- createWithUDFStmt := "CREATE LOGICAL REPLICATION STREAM FROM TABLE tab ON $1 INTO TABLE tab WITH DEFAULT FUNCTION = 'testschema.repl_apply'"
2011
- testuser .ExpectErr (t , "user testuser does not have REPLICATION system privilege" , createWithUDFStmt , dbBURL .String ())
2010
+ t .Run ("replication-dest" , func (t * testing.T ) {
2011
+ testuser .ExpectErr (t , "user testuser does not have REPLICATION system privilege" , createStmt , dbBURL .String ())
2012
2012
dbA .Exec (t , fmt .Sprintf ("GRANT SYSTEM REPLICATION TO %s" , username .TestUser ))
2013
- testuser .QueryRow (t , createWithUDFStmt , dbBURL .String ()).Scan (& jobAID )
2013
+ testuser .QueryRow (t , createStmt , dbBURL .String ()).Scan (& jobAID )
2014
+ })
2015
+ t .Run ("replication-src" , func (t * testing.T ) {
2016
+ dbB .Exec (t , "CREATE USER testuser3" )
2017
+ dbBURL2 := replicationtestutils .GetExternalConnectionURI (t , s , s , serverutils .DBName ("b" ), serverutils .User (username .TestUser + "3" ))
2018
+ testuser .ExpectErr (t , "user testuser3 does not have REPLICATION system privilege" , createStmt , dbBURL2 .String ())
2019
+ dbB .Exec (t , fmt .Sprintf ("GRANT SYSTEM REPLICATION TO %s" , username .TestUser + "3" ))
2020
+ testuser .QueryRow (t , createStmt , dbBURL2 .String ()).Scan (& jobAID )
2014
2021
})
2015
2022
}
2016
2023
0 commit comments