|
277 | 277 | end
|
278 | 278 | end
|
279 | 279 |
|
| 280 | + describe 'plugin=' do |
| 281 | + context 'auth_socket' do |
| 282 | + context 'MySQL < 5.7.6' do |
| 283 | + it 'changes the authentication plugin' do |
| 284 | + provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.7.1'][:string]) |
| 285 | + provider.expects(:mysql).with([defaults_file, system_database, '-e', "UPDATE mysql.user SET plugin = 'auth_socket', password = '' WHERE CONCAT(user, '@', host) = 'joe@localhost'"]).returns('0') |
| 286 | + |
| 287 | + provider.expects(:plugin).returns('auth_socket') |
| 288 | + provider.plugin = 'auth_socket' |
| 289 | + end |
| 290 | + end |
| 291 | + |
| 292 | + context 'MySQL >= 5.7.6' do |
| 293 | + it 'changes the authentication plugin' do |
| 294 | + provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.7.6'][:string]) |
| 295 | + provider.expects(:mysql).with([defaults_file, system_database, '-e', "ALTER USER 'joe'@'localhost' IDENTIFIED WITH 'auth_socket'"]).returns('0') |
| 296 | + |
| 297 | + provider.expects(:plugin).returns('auth_socket') |
| 298 | + provider.plugin = 'auth_socket' |
| 299 | + end |
| 300 | + end |
| 301 | + end |
| 302 | + |
| 303 | + context 'mysql_native_password' do |
| 304 | + context 'MySQL < 5.7.6' do |
| 305 | + it 'changes the authentication plugin' do |
| 306 | + provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.7.1'][:string]) |
| 307 | + provider.expects(:mysql).with([defaults_file, system_database, '-e', "UPDATE mysql.user SET plugin = 'mysql_native_password', password = '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4' WHERE CONCAT(user, '@', host) = 'joe@localhost'"]).returns('0') |
| 308 | + |
| 309 | + provider.expects(:plugin).returns('mysql_native_password') |
| 310 | + provider.plugin = 'mysql_native_password' |
| 311 | + end |
| 312 | + end |
| 313 | + |
| 314 | + context 'MySQL >= 5.7.6' do |
| 315 | + it 'changes the authentication plugin' do |
| 316 | + provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.7.6'][:string]) |
| 317 | + provider.expects(:mysql).with([defaults_file, system_database, '-e', "ALTER USER 'joe'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4'"]).returns('0') |
| 318 | + |
| 319 | + provider.expects(:plugin).returns('mysql_native_password') |
| 320 | + provider.plugin = 'mysql_native_password' |
| 321 | + end |
| 322 | + end |
| 323 | + end |
| 324 | + end |
| 325 | + |
280 | 326 | describe 'tls_options=' do
|
281 | 327 | it 'adds SSL option grant in mysql 5.5' do
|
282 | 328 | provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.5'][:string])
|
|
0 commit comments