Allow dolt sql command line access to always log in as the root superuser account, even if the root account was assigned a password

This commit is contained in:
Jason Fulghum
2025-01-14 13:27:37 -08:00
parent 9fb0046d34
commit 63c5ce1adb

View File

@@ -132,6 +132,19 @@ teardown() {
[[ $output =~ "| root | % " ]] || false
}
# Asserts that `dolt sql` can always be used to access the database as a superuser. For example, if the root
# user is assigned a password, `dolt sql` should still be able to log in as a superuser, since the user
# already has access to the host and data directory.
@test "sql-privs: superuser access is always available from dolt sql" {
# Create a root@% user with a password set
dolt sql -q "CREATE USER root@'%' identified by 'pass1'; grant all on *.* to root@'%' with grant option;"
# Make sure dolt sql can still log in as root, even though root has a password set now
run dolt sql -q "select user();"
[ $status -eq 0 ]
[[ $output =~ "root@localhost" ]] || false
}
# Asserts that creating users via 'dolt sql' before starting a sql-server causes the privileges.db to be
# initialized and prevents the root superuser from being created, since the customer has already started
# manually managing user accounts.