mirror of
https://github.com/dolthub/dolt.git
synced 2026-04-25 03:34:05 -05:00
updated tests
This commit is contained in:
@@ -42,11 +42,37 @@ teardown() {
|
||||
[[ "$output" =~ "+---------------------" ]] || false
|
||||
}
|
||||
|
||||
@test "sql-shell: dolt sql shell has mysql db" {
|
||||
@test "sql-shell: dolt sql shell has mysql db and can create users" {
|
||||
# there does not exist a mysql.db file
|
||||
run ls
|
||||
! [[ "$output" =~ "mysql.db" ]] || false
|
||||
|
||||
# mysql database exists and has privilege tables
|
||||
run dolt sql <<< "show tables from mysql;"
|
||||
[ "$status" -eq "0" ]
|
||||
[[ "$output" =~ "user" ]] || false
|
||||
[[ "$output" =~ "role_edges" ]] || false
|
||||
|
||||
# show users, expect just root user
|
||||
run dolt sql <<< "select user from mysql.user;"
|
||||
[[ "$output" =~ "root" ]] || false
|
||||
! [[ "$output" =~ "new_user" ]] || false
|
||||
|
||||
# create a new user
|
||||
run dolt sql <<< "create user new_user;"
|
||||
[ "$status" -eq "0" ]
|
||||
|
||||
# there should now be a mysql.db file
|
||||
run ls
|
||||
[[ "$output" =~ "mysql.db" ]] || false
|
||||
|
||||
# show users, expect root and new_user
|
||||
run dolt sql <<< "select user from mysql.user;"
|
||||
[[ "$output" =~ "root" ]] || false
|
||||
[[ "$output" =~ "new_user" ]] || false
|
||||
|
||||
# remove mysql.db just in case
|
||||
rm -f mysql.db
|
||||
}
|
||||
|
||||
@test "sql-shell: bad sql in sql shell should error" {
|
||||
|
||||
Reference in New Issue
Block a user