Skip to content

Commit

Permalink
add test case for healthcheck.sh variants
Browse files Browse the repository at this point in the history
  • Loading branch information
grooverdan committed Sep 2, 2024
1 parent afbf442 commit 14244b6
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,43 @@ zstd "${initdb}"/*zst*
mariadbclient -u root -psoverysecret -e 'select current_user() as connected_ok'

docker exec "$cname" healthcheck.sh --connect --innodb_initialized
# healthcheck shouldn't return true on insufficient connection information

# Enforce fallback to tcp in healthcheck.
docker exec "$cname" sed -i -e 's/\(socket=\)/\1breakpath/' /var/lib/mysql/.my-healthcheck.cnf

# select @@skip-networking via tcp successful
docker exec "$cname" healthcheck.sh --connect

mariadbclient -u root -psoverysecret -e 'alter user healthcheck@`127.0.0.1` ACCOUNT LOCK'
mariadbclient -u root -psoverysecret -e 'alter user healthcheck@`::1` ACCOUNT LOCK'

# ERROR 4151 (HY000): Access denied, this account is locked
docker exec "$cname" healthcheck.sh --connect

mariadbclient -u root -psoverysecret -e 'alter user healthcheck@`127.0.0.1` WITH MAX_QUERIES_PER_HOUR 1 ACCOUNT UNLOCK'
mariadbclient -u root -psoverysecret -e 'alter user healthcheck@`::1` WITH MAX_QUERIES_PER_HOUR 1 ACCOUNT UNLOCK'

# ERROR 1226 (42000) at line 1: User '\''healthcheck'\'' has exceeded the '\''max_queries_per_hour'\'' resource (current value: 1)'
docker exec "$cname" healthcheck.sh --connect
docker exec "$cname" healthcheck.sh --connect

mariadbclient -u root -psoverysecret -e 'alter user healthcheck@`127.0.0.1` WITH MAX_QUERIES_PER_HOUR 2000 PASSWORD EXPIRE'
mariadbclient -u root -psoverysecret -e 'alter user healthcheck@`::1` WITH MAX_QUERIES_PER_HOUR 2000 PASSWORD EXPIRE'
# ERROR 1820 (HY000) at line 1: You must SET PASSWORD before executing this statement
docker exec "$cname" healthcheck.sh --connect

mariadbclient -u root -psoverysecret -e 'set password for healthcheck@`127.0.0.1` = PASSWORD("mismatch")'
mariadbclient -u root -psoverysecret -e 'set password for healthcheck@`::1` = PASSWORD("mismatch")'

# ERROR 1045 (28000): Access denied
docker exec "$cname" healthcheck.sh --connect


# break port
docker exec "$cname" sed -i -e 's/\(port=\)/\14/' /var/lib/mysql/.my-healthcheck.cnf

docker exec "$cname" healthcheck.sh --connect || echo "ok, broken port is a connection failure"

killoff

Expand Down

0 comments on commit 14244b6

Please sign in to comment.