Update bats tests for ignored tables in system tables.

This commit is contained in:
Nick Tobey
2026-02-19 00:39:40 -08:00
parent e27fe4e22b
commit 70dc88169e
2 changed files with 10 additions and 23 deletions

View File

@@ -19,6 +19,10 @@ teardown() {
teardown_common
}
get_head_commit() {
dolt log -n 1 | grep -m 1 commit | cut -c 13-44
}
@test "sql-reset: DOLT_RESET --hard works on unstaged and staged table changes" {
dolt sql -q "INSERT INTO test VALUES (1)"
@@ -218,7 +222,7 @@ SQL
INSERT INTO test VALUES (1);
call dolt_reset('--hard');
SQL
run dolt sql -q "SELECT count(*)=0 FROM dolt_status"
[ $status -eq 0 ]
[[ "$output" =~ "true" ]] || false
@@ -278,10 +282,6 @@ SQL
[[ "$output" = "$working_hash" ]] || false
}
get_head_commit() {
dolt log -n 1 | grep -m 1 commit | cut -c 13-44
}
@test "sql-reset: reset handles ignored tables" {
dolt sql << SQL
CREATE TABLE test2 (
@@ -299,10 +299,9 @@ SQL
run dolt sql -q "call dolt_reset('--hard')"
[ "$status" -eq 0 ]
run dolt sql -r csv -q "select * from dolt_status"
run dolt sql -r csv -q "select * from dolt_status_ignored"
[ "$status" -eq 0 ]
[[ "$output" =~ "dolt_ignore,0,new table" ]] || false
[ "${#lines[@]}" -eq 3 ]
[[ "$output" =~ "test2,0,new table,true" ]] || false
run dolt sql -q "select * from test2"
[ "$status" -eq 0 ]

View File

@@ -1172,22 +1172,18 @@ SQL
dolt add test
dolt commit -m "Added test table"
# Create an ignored table pattern
# create table matching an ignore pattern
dolt sql -q "INSERT INTO dolt_ignore VALUES ('ignored_*', true)"
# Create a table that matches the ignore pattern
dolt sql -q "CREATE TABLE ignored_table (pk INT PRIMARY KEY)"
# Create a non-ignored table with changes
dolt sql -q "INSERT INTO test VALUES (1, 1)"
# Query dolt_status - shows all tables (does not filter ignored)
# dolt_status does not show ignored tables
run dolt sql -q "SELECT table_name FROM dolt_status WHERE staged = false"
[ "$status" -eq 0 ]
[[ "$output" =~ "test" ]] || false
[[ "$output" =~ "ignored_table" ]] || false
! [[ "$output" =~ "ignored_table" ]] || false
# Query dolt_status_ignored - shows all tables with ignored column
run dolt sql -q "SELECT table_name, ignored FROM dolt_status_ignored WHERE staged = false ORDER BY table_name"
[ "$status" -eq 0 ]
[[ "$output" =~ "ignored_table" ]] || false
@@ -1202,14 +1198,6 @@ SQL
run dolt sql -r csv -q "SELECT table_name, ignored FROM dolt_status_ignored WHERE table_name = 'test'"
[ "$status" -eq 0 ]
[[ "$output" =~ "test,false" ]] || false
# Verify schema has 4 columns
run dolt sql -q "DESCRIBE dolt_status_ignored"
[ "$status" -eq 0 ]
[[ "$output" =~ "table_name" ]] || false
[[ "$output" =~ "staged" ]] || false
[[ "$output" =~ "status" ]] || false
[[ "$output" =~ "ignored" ]] || false
}
@test "system-tables: dolt_status_ignored shows staged tables without ignored flag" {