From 08101af4fdfaa19a485161d85ab940717f5e9b29 Mon Sep 17 00:00:00 2001 From: caspian Date: Fri, 16 Jul 2021 11:21:50 +0800 Subject: [PATCH] add tests --- .../01999_grant_by_replace.reference | 16 +++++++++ .../0_stateless/01999_grant_by_replace.sql | 35 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 tests/queries/0_stateless/01999_grant_by_replace.reference create mode 100644 tests/queries/0_stateless/01999_grant_by_replace.sql diff --git a/tests/queries/0_stateless/01999_grant_by_replace.reference b/tests/queries/0_stateless/01999_grant_by_replace.reference new file mode 100644 index 00000000000..e2b5b320b2a --- /dev/null +++ b/tests/queries/0_stateless/01999_grant_by_replace.reference @@ -0,0 +1,16 @@ +CREATE USER test_user_01999 +A +B +GRANT SELECT ON db1.* TO test_user_01999 +GRANT SHOW TABLES, SHOW COLUMNS, SHOW DICTIONARIES ON db2.table TO test_user_01999 +C +GRANT SELECT(col1) ON db3.table TO test_user_01999 +D +GRANT SELECT(col3) ON db3.table3 TO test_user_01999 +GRANT SELECT(col1, col2) ON db4.table4 TO test_user_01999 +E +GRANT SELECT(cola) ON db5.table TO test_user_01999 +GRANT INSERT(colb) ON db6.tb61 TO test_user_01999 +GRANT SHOW ON db7.* TO test_user_01999 +F +GRANT SELECT ON all.* TO test_user_01999 diff --git a/tests/queries/0_stateless/01999_grant_by_replace.sql b/tests/queries/0_stateless/01999_grant_by_replace.sql new file mode 100644 index 00000000000..acde34a55cc --- /dev/null +++ b/tests/queries/0_stateless/01999_grant_by_replace.sql @@ -0,0 +1,35 @@ +DROP USER IF EXISTS test_user_01999; + +CREATE USER test_user_01999; +SHOW CREATE USER test_user_01999; + +SELECT 'A'; +SHOW GRANTS FOR test_user_01999; + +GRANT SELECT ON db1.* TO test_user_01999; +GRANT SHOW ON db2.table TO test_user_01999; + +SELECT 'B'; +SHOW GRANTS FOR test_user_01999; + +GRANT BY REPLACE SELECT(col1) ON db3.table TO test_user_01999; + +SELECT 'C'; +SHOW GRANTS FOR test_user_01999; + +GRANT BY REPLACE SELECT(col3) ON db3.table3, SELECT(col1, col2) ON db4.table4 TO test_user_01999; + +SELECT 'D'; +SHOW GRANTS FOR test_user_01999; + +GRANT BY REPLACE SELECT(cola) ON db5.table, INSERT(colb) ON db6.tb61, SHOW ON db7.* TO test_user_01999; + +SELECT 'E'; +SHOW GRANTS FOR test_user_01999; + +SELECT 'F'; +GRANT BY REPLACE SELECT ON all.* TO test_user_01999; +SHOW GRANTS FOR test_user_01999; + +DROP USER test_user_01999; +