|
286 | 286 | end
|
287 | 287 | end
|
288 | 288 |
|
| 289 | + describe 'plugin=' do |
| 290 | + context 'auth_socket' do |
| 291 | + context 'MySQL < 5.7.6' do |
| 292 | + it 'changes the authentication plugin' do |
| 293 | + provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.7.1'][:string]) |
| 294 | + 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') |
| 295 | + |
| 296 | + provider.expects(:plugin).returns('auth_socket') |
| 297 | + provider.plugin = 'auth_socket' |
| 298 | + end |
| 299 | + end |
| 300 | + |
| 301 | + context 'MySQL >= 5.7.6' do |
| 302 | + it 'changes the authentication plugin' do |
| 303 | + provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.7.6'][:string]) |
| 304 | + provider.expects(:mysql).with([defaults_file, system_database, '-e', "ALTER USER 'joe'@'localhost' IDENTIFIED WITH 'auth_socket'"]).returns('0') |
| 305 | + |
| 306 | + provider.expects(:plugin).returns('auth_socket') |
| 307 | + provider.plugin = 'auth_socket' |
| 308 | + end |
| 309 | + end |
| 310 | + end |
| 311 | + |
| 312 | + context 'mysql_native_password' do |
| 313 | + context 'MySQL < 5.7.6' do |
| 314 | + it 'changes the authentication plugin' do |
| 315 | + provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.7.1'][:string]) |
| 316 | + 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') |
| 317 | + |
| 318 | + provider.expects(:plugin).returns('mysql_native_password') |
| 319 | + provider.plugin = 'mysql_native_password' |
| 320 | + end |
| 321 | + end |
| 322 | + |
| 323 | + context 'MySQL >= 5.7.6' do |
| 324 | + it 'changes the authentication plugin' do |
| 325 | + provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.7.6'][:string]) |
| 326 | + provider.expects(:mysql).with([defaults_file, system_database, '-e', "ALTER USER 'joe'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4'"]).returns('0') |
| 327 | + |
| 328 | + provider.expects(:plugin).returns('mysql_native_password') |
| 329 | + provider.plugin = 'mysql_native_password' |
| 330 | + end |
| 331 | + end |
| 332 | + end |
| 333 | + end |
| 334 | + |
289 | 335 | describe 'tls_options=' do
|
290 | 336 | it 'adds SSL option grant in mysql 5.5' do
|
291 | 337 | provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.5'][:string])
|
|
0 commit comments