Debian Codegraph @

mysql-test/suite/encryption/t/rename_table.test

raw
1 --echo #
2 --echo # WL#12261 Control (enforce and disable) table encryption
3 --echo #
4 --source include/have_debug.inc
5
6 --echo # Pre-define user u1, which is used in different tests below.
7 CREATE USER u1@localhost;
8 GRANT ALL ON db1.* TO u1@localhost;
9 GRANT ALL ON db2.* TO u1@localhost;
10 GRANT ALL ON sch1.* TO u1@localhost;
11 GRANT ALL ON sch2.* TO u1@localhost;
12 GRANT CREATE TABLESPACE, PROCESS, SYSTEM_VARIABLES_ADMIN ON *.* TO u1@localhost;
13 SET GLOBAL debug= '+d,skip_table_encryption_admin_check_for_set';
14 connect (con1, localhost, u1);
15
16 --echo # The test cases run RENAME TABLE to move tables from one database
17 --echo # to another, with tables using file-per-table or general
18 --echo # tablespace. And these operations are run in below configuration,
19 --echo #
20 --echo # - Setting table_encryption_privilege_check to true/false.
21 --echo # - Setting per database default encryption to 'y' and 'n'
22 --echo # - Setting table's encryption mode to 'y' and 'n'.
23 --echo # - With and without user holding TABLE_ENCRYPTION_ADMIN privilege.
24 --echo # -
25 --echo # - Check for warnings generated.
26 --echo #
27
28
29 --echo `````````````````````````````````````````````````````````
30 --echo # Test using innodb_file_per_table tablespace.
31 --let alter_tablespace_name=innodb_file_per_table
32 --let expected_error1=0
33 --let expected_error2=0
34 --let expected_error3=0
35 --let expected_error4=0
36 --let caseno=0
37
38 --echo `````````````````````````````````````````````````````````
39 --echo # table_encryption_privilege_check=false
40 --let privilege_check=false
41
42 --let table_encryption='n'
43 --source ./rename_table.inc
44 --let table_encryption='y'
45 --source ./rename_table.inc
46
47 --echo `````````````````````````````````````````````````````````
48 --echo # table_encryption_privilege_check=true
49 --let privilege_check=true
50
51 --echo `````````````````````````````````````````````````````````
52 --echo # We expect failure when the table encryption does not match
53 --echo # with default database encryption.
54 --let table_encryption='n'
55 --let expected_error2=ER_CANNOT_SET_TABLE_ENCRYPTION
56 --let expected_error4=ER_CANNOT_SET_TABLE_ENCRYPTION
57 --source ./rename_table.inc
58
59 --let has_grant=true
60 --let table_encryption='n'
61 --source ./alter_rename_table.inc
62 --let has_grant=false
63
64 --echo `````````````````````````````````````````````````````````
65 --echo # We expect failure when the table encryption does not match
66 --echo # with default database encryption.
67 --let table_encryption='y'
68 --let expected_error1=ER_CANNOT_SET_TABLE_ENCRYPTION
69 --let expected_error3=ER_CANNOT_SET_TABLE_ENCRYPTION
70 --source ./rename_table.inc
71
72 --let has_grant=true
73 --let table_encryption='y'
74 --source ./alter_rename_table.inc
75 --let has_grant=false
76
77
78 --echo `````````````````````````````````````````````````````````
79 --echo # Test using general tablespace.
80 --let alter_tablespace_name=ts1
81 --let expected_error1=0
82 --let expected_error2=0
83 --let expected_error3=0
84 --let expected_error4=0
85
86 --echo `````````````````````````````````````````````````````````
87 --echo # table_encryption_privilege_check=false
88 --let privilege_check=false
89
90 --let table_encryption='n'
91 --source ./rename_table.inc
92 --let table_encryption='y'
93 --source ./rename_table.inc
94
95 --echo `````````````````````````````````````````````````````````
96 --echo # table_encryption_privilege_check=true
97 --let privilege_check=true
98
99 --echo `````````````````````````````````````````````````````````
100 --echo # We expect failure when the table encryption does not match
101 --echo # with default database encryption.
102 --let table_encryption='n'
103 --let expected_error2=ER_CANNOT_SET_TABLE_ENCRYPTION
104 --let expected_error4=ER_CANNOT_SET_TABLE_ENCRYPTION
105 --source ./rename_table.inc
106
107 --let has_grant=true
108 --let table_encryption='n'
109 --source ./alter_rename_table.inc
110 --let has_grant=false
111
112 --echo `````````````````````````````````````````````````````````
113 --echo # We expect failure when the table encryption does not match
114 --echo # with default database encryption.
115 --let table_encryption='y'
116 --let expected_error1=ER_CANNOT_SET_TABLE_ENCRYPTION
117 --let expected_error3=ER_CANNOT_SET_TABLE_ENCRYPTION
118 --source ./rename_table.inc
119
120 --let has_grant=true
121 --let table_encryption='y'
122 --source ./alter_rename_table.inc
123 --let has_grant=false
124
125 --echo # Cleanup
126 disconnect con1;
127 connection default;
128 DROP USER u1@localhost;
129 SET GLOBAL debug= '-d,skip_table_encryption_admin_check_for_set';