updated tests

This commit is contained in:
James Cor
2022-05-24 15:08:16 -07:00
parent 83b47ce74b
commit ed840e19bf
2 changed files with 54 additions and 2 deletions
+27 -1
View File
@@ -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" {