More tests

This commit is contained in:
Zach Musgrave
2021-11-09 09:03:40 -08:00
parent f064c7abc0
commit 9873a81b54
2 changed files with 29 additions and 4 deletions
+5 -1
View File
@@ -48,7 +48,11 @@ setup_no_dolt_init() {
assert_feature_version() {
run dolt version --feature
[[ "$output" =~ "feature version: 2" ]] || exit 1
# Tests that don't end in a valid dolt dir will fail the above
# command, don't check its output in that case
if [ "$status" -eq 0 ]; then
[[ "$output" =~ "feature version: 2" ]] || exit 1
fi
}
setup_common() {
+24 -3
View File
@@ -618,6 +618,9 @@ SQL
@test "sql: run outside a dolt directory" {
mkdir new && cd new
mkdir decoy
touch decoy/file.txt
dolt sql --disable-batch <<SQL
CREATE DATABASE test1;
USE test1;
@@ -643,11 +646,29 @@ SQL
[ "$status" -eq 0 ]
[[ "$output" =~ "test1" ]] || false
[[ "$output" =~ "information_schema" ]] || false
# We have to end in a valid dolt database directory for teardown to succeed
cd ..
[[ ! "$output" =~ "decoy" ]] || false
}
@test "sql: bad dolt db" {
mkdir new && cd new
mkdir -p decoy/.dolt/noms/oldgen
mkdir -p decoy/.dolt/noms/temptf
echo '{}' > decoy/config.json
# Not doing this cd ../ results in the teardown method failing on
# a skip, not sure why. It's not part of the actual test
cd ../
skip "This results in a panic right now"
run dolt sql -q "show databases" -r csv
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 2 ]
[[ "$output" =~ "information_schema" ]] || false
[[ ! "$output" =~ "decoy" ]] || false
}
@test "sql: set head ref session var" {
dolt add .; dolt commit -m 'commit tables'
dolt checkout -b feature-branch