1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
|
--echo #
--echo # WL#12261 Control (enforce and disable) table encryption
--echo #
--source include/have_debug.inc
--echo # Pre-define user u1, which is used in different tests below.
CREATE USER u1@localhost;
GRANT ALL ON db1.* TO u1@localhost;
GRANT CREATE TABLESPACE, PROCESS, SYSTEM_VARIABLES_ADMIN ON *.* TO u1@localhost;
SET GLOBAL debug= '+d,skip_table_encryption_admin_check_for_set';
connect (con1, localhost, u1);
--echo # This test run CREATE/ALTER TABLESPACE in different configurations,
--echo #
--echo # - Setting table_encryption_privilege_check to true/false.
--echo # - Setting default_table_encryption to true/false.
--echo # - With and without ENCRYPTION clause.
--echo # - With and without user holding TABLE_ENCRYPTION_ADMIN privilege.
--echo # - Test INFORMATION_SCHEMA.INNODB_TABLESPACES
--echo # - Check for warnings generated.
--echo #
--let expected_error=0
--let caseno=0
--echo `````````````````````````````````````````````````````````
--echo # CREATE TABLESPACE with explicit ENCRYPTION clause
--echo # table_encryption_privilege_check=false
--let explicit_encryption_clause=false
--let privilege_check=false
--let global_database_encryption_default=false
--source ./create_tablespace.inc
--let global_database_encryption_default=true
--source ./create_tablespace.inc
--echo `````````````````````````````````````````````````````````
--echo # table_encryption_privilege_check=true
--let privilege_check=true
--let global_database_encryption_default=false
--source ./create_tablespace.inc
--let global_database_encryption_default=true
--source ./create_tablespace.inc
--echo `````````````````````````````````````````````````````````
--echo # CREATE TABLESPACE with explicit ENCRYPTION clause
--echo # table_encryption_privilege_check=false
--let explicit_encryption_clause=true
--let privilege_check=false
--let global_database_encryption_default=false
--let tablespace_encryption='y'
--source ./create_tablespace.inc
--let tablespace_encryption='n'
--source ./create_tablespace.inc
--let global_database_encryption_default=true
--let tablespace_encryption='y'
--source ./create_tablespace.inc
--let tablespace_encryption='n'
--source ./create_tablespace.inc
--echo `````````````````````````````````````````````````````````
--echo # table_encryption_privilege_check=true
--let privilege_check=true
--let global_database_encryption_default=false
--let expected_error=ER_CANNOT_SET_TABLESPACE_ENCRYPTION
--let tablespace_encryption='y'
--source ./create_tablespace.inc
--let expected_error=0
--let tablespace_encryption='n'
--source ./create_tablespace.inc
--let global_database_encryption_default=true
--let tablespace_encryption='y'
--source ./create_tablespace.inc
--let expected_error=ER_CANNOT_SET_TABLESPACE_ENCRYPTION
--let tablespace_encryption='n'
--source ./create_tablespace.inc
--echo `````````````````````````````````````````````````````````
--echo # Check for invalid ENCRYPTION clause value.
--let privilege_check=false
--let global_database_encryption_default=false
--let expected_error=ER_INVALID_ENCRYPTION_OPTION
--let tablespace_encryption='k'
--source ./create_tablespace.inc
--echo `````````````````````````````````````````````````````````
--echo # The test cases run ALTER TABLESPACE (with no tables)
--echo # See test tablespace_with_tables.test.
--let caseno=0
--echo `````````````````````````````````````````````````````````
--echo # Unencrypted TABLESPACE to Unencrypted TABLESPACE (Nop)
--echo #
--let global_database_encryption_default=false
--let tablespace_encryption='n'
--let alter_encryption='n'
--let privilege_check=false
--let expected_error=0
--source ./alter_empty_tablespace.inc
--let privilege_check=true
--let expected_error=0
--source ./alter_empty_tablespace.inc
--echo `````````````````````````````````````````````````````````
--echo # Encrypted TABLESPACE to Encrypted TABLESPACE (Nop)
--echo #
--let global_database_encryption_default=true
--let tablespace_encryption='y'
--let alter_encryption='y'
--let privilege_check=false
--let expected_error=0
--source ./alter_empty_tablespace.inc
--let privilege_check=true
--let expected_error=0
--source ./alter_empty_tablespace.inc
--echo `````````````````````````````````````````````````````````
--echo # Unencrypted TABLESPACE to encrypted TABLESPACE
--echo # with database encryption default 'n'
--echo #
--let global_database_encryption_default=false
--let tablespace_encryption='n'
--let alter_encryption='y'
--let privilege_check=false
--let expected_error=0
--source ./alter_empty_tablespace.inc
--let privilege_check=true
--let expected_error=ER_CANNOT_SET_TABLESPACE_ENCRYPTION
--source ./alter_empty_tablespace.inc
--echo `````````````````````````````````````````````````````````
--echo # Unencrypted TABLESPACE to encrypted TABLESPACE
--echo # with database encryption default 'y'
--echo #
--let global_database_encryption_default=true
--let tablespace_encryption='n'
--let alter_encryption='y'
--let privilege_check=false
--let expected_error=0
--source ./alter_empty_tablespace.inc
--let privilege_check=true
--let expected_error=0
--source ./alter_empty_tablespace.inc
--echo `````````````````````````````````````````````````````````
--echo # Encrypted TABLESPACE to unencrypted TABLESPACE
--echo # with database encryption default 'n'
--echo #
--let global_database_encryption_default=false
--let tablespace_encryption='y'
--let alter_encryption='n'
--let privilege_check=false
--let expected_error=0
--source ./alter_empty_tablespace.inc
--let privilege_check=true
--let expected_error=0
--source ./alter_empty_tablespace.inc
--echo `````````````````````````````````````````````````````````
--echo # Encrypted TABLESPACE to unencrypted TABLESPACE
--echo # with database encryption default 'y'
--echo #
--let global_database_encryption_default=true
--let tablespace_encryption='y'
--let alter_encryption='n'
--let privilege_check=false
--let expected_error=0
--source ./alter_empty_tablespace.inc
--let privilege_check=true
--let expected_error=ER_CANNOT_SET_TABLESPACE_ENCRYPTION
--source ./alter_empty_tablespace.inc
--echo `````````````````````````````````````````````````````````
--echo # Check for Invalid encryption option.
--let privilege_check=false
--let global_database_encryption_default=false
--let expected_error=ER_INVALID_ENCRYPTION_OPTION
--let alter_encryption='k'
--source ./alter_empty_tablespace.inc
--echo # Cleanup
disconnect con1;
connection default;
DROP USER u1@localhost;
SET GLOBAL debug= '-d,skip_table_encryption_admin_check_for_set';
|