Fixes#5631.
The test has three logical phases:
Phase 1 Admin SQLite3 extension validation for MYSQL_NATIVE_PASSWORD()
and CACHING_SHA2_PASSWORD() — pure hash computation inside
ProxySQL, does not touch the backend.
Phase 2 MySQL/Admin hash compatibility — creates USER_GEN_COUNT (100)
users on the backend, half with mysql_native_password and half
with caching_sha2_password, then compares the backend's
authentication_string with the hash that ProxySQL's Admin
SQLite3 function produces.
Phase 3 End-to-end connection test — creates RAND_USERS_GEN (100)
users with the same 50/50 split and attempts to connect
through ProxySQL.
On MySQL 9.0+ the mysql_native_password plugin is not loadable, so the
first CREATE USER IDENTIFIED WITH 'mysql_native_password' in Phase 2
fails with ER_PLUGIN_IS_NOT_LOADED and the test bails after only 10
assertions (all of Phase 1 passes — ProxySQL's internal hash extensions
work fine on 9.x; this was a good green signal).
Fix:
- Add g_mysql_supports_native_password; set to false on server_version
>= 9.0.
- Adjust actual_test_count so plan() matches reality:
if (has_native) {
count += USER_GEN_COUNT + RAND_USERS_GEN;
} else {
count += USER_GEN_COUNT / 2 + RAND_USERS_GEN / 2;
}
- Wrap the Phase 2 native_password loop in 'if (has_native)'.
- Phase 3 uses 'for (i = 0 .. RAND_USERS_GEN)' with 'i < 50 ? native
: sha2'. Skip the native half by starting the loop at
RAND_USERS_GEN/2 when has_native is false.
Phase 1 coverage is fully preserved — the ProxySQL Admin SQLite3 hash
functions (including MYSQL_NATIVE_PASSWORD()) still work on 9.x; only
the backend-side CREATE USER path is skipped.