polardbxengine/mysql-test/suite/x/t/connection_auth_mechanism_m...

76 lines
2.2 KiB
Plaintext

## Test cases for authorization plugins
--source include/xplugin_preamble.inc
--source include/xplugin_create_user.inc
#
## Setup
#
--write_file $MYSQL_TMP_DIR/try_login_using_memory.tmp
-->import connection_auth_mechanism_memory_helpers.macro
callmacro Try_to_login_all_xusers_using_memory %RESULT%;
EOF
--write_file $MYSQL_TMP_DIR/login_using_plain.tmp
-->import connection_auth_mechanism_memory_helpers.macro
callmacro Login_all_xusers_using_plain_to_fill_the_cache;
EOF
--let $MYSQLXTEST=$MYSQLXTEST -ux_root --ssl-cipher='AES256-SHA'
--let $memory_login_fail= --file=$MYSQL_TMP_DIR/try_login_using_memory.tmp -v%RESULT%=Login_failed
--let $plain_login_ok= --file=$MYSQL_TMP_DIR/login_using_plain.tmp
# Create and configure xuser_* accounts that use native, sha256 and
# cache_sha2 authentication plugins.
--source ../include/create_mysql_accounts_for_xplugin_tests.inc
GRANT ALL ON *.* TO xuser_native@localhost;
GRANT ALL ON *.* TO xuser_sha256@localhost;
GRANT ALL ON *.* TO xuser_cache2@localhost;
#
## Test starts here
#
--echo
--echo #######################################################################
--echo ## 1. Memory mechanism fails
--echo ##
--echo ## when:
--echo ## * The cache is empty
--echo ## * The the mysqlx_cache_cleaner plugin is not installed
--echo ## then the cache is not filled with data.
--echo ##
--echo ## Requirements: F1
--echo #
--echo #######################################################################
--echo # Cache is empty, the sha256_memory request must fail
exec $MYSQLXTEST $memory_login_fail 2>&1;
--echo
--echo #######################################################################
--echo # Plain auth work as expected, anyway it doesnt fill the cache
exec $MYSQLXTEST $plain_login_ok 2>&1;
--echo
--echo #######################################################################
--echo # Recheck that the cache is empty after plain auth, the sha256_memory request must fail:
exec $MYSQLXTEST $memory_login_fail 2>&1;
#
# Postamble
#
--remove_file $MYSQL_TMP_DIR/try_login_using_memory.tmp
--remove_file $MYSQL_TMP_DIR/login_using_plain.tmp
--source ../include/remove_mysql_accounts_for_xplugin_tests.inc
--source include/xplugin_drop_user.inc