mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-05 02:45:34 -05:00
adds remote test for dolt commit
This commit is contained in:
@@ -173,52 +173,82 @@ get_staged_tables() {
|
||||
}
|
||||
|
||||
@test "sql-local-remote: test 'status' and switch between server/no server" {
|
||||
start_sql_server defaultDB
|
||||
start_sql_server defaultDB
|
||||
|
||||
run dolt --user dolt status
|
||||
[ "$status" -eq 0 ] || false
|
||||
[[ "$output" =~ "On branch main" ]] || false
|
||||
[[ "$output" =~ "Changes to be committed:" ]] || false
|
||||
[[ "$output" =~ " (use \"dolt reset <table>...\" to unstage)" ]] || false
|
||||
[[ "$output" =~ " modified: table1" ]] || false
|
||||
[[ "$output" =~ "Changes not staged for commit:" ]] || false
|
||||
[[ "$output" =~ " (use \"dolt add <table>\" to update what will be committed)" ]] || false
|
||||
[[ "$output" =~ " (use \"dolt checkout <table>\" to discard changes in working directory)" ]] || false
|
||||
[[ "$output" =~ " modified: table2" ]] || false
|
||||
[[ "$output" =~ "Untracked tables:" ]] || false
|
||||
[[ "$output" =~ " (use \"dolt add <table>\" to include in what will be committed)" ]] || false
|
||||
[[ "$output" =~ " new table: table3" ]] || false
|
||||
! [[ "$output" =~ " new table: generated_foo" ]] || false
|
||||
remoteOutput=$output
|
||||
run dolt --user dolt status
|
||||
[ "$status" -eq 0 ] || false
|
||||
[[ "$output" =~ "On branch main" ]] || false
|
||||
[[ "$output" =~ "Changes to be committed:" ]] || false
|
||||
[[ "$output" =~ " (use \"dolt reset <table>...\" to unstage)" ]] || false
|
||||
[[ "$output" =~ " modified: table1" ]] || false
|
||||
[[ "$output" =~ "Changes not staged for commit:" ]] || false
|
||||
[[ "$output" =~ " (use \"dolt add <table>\" to update what will be committed)" ]] || false
|
||||
[[ "$output" =~ " (use \"dolt checkout <table>\" to discard changes in working directory)" ]] || false
|
||||
[[ "$output" =~ " modified: table2" ]] || false
|
||||
[[ "$output" =~ "Untracked tables:" ]] || false
|
||||
[[ "$output" =~ " (use \"dolt add <table>\" to include in what will be committed)" ]] || false
|
||||
[[ "$output" =~ " new table: table3" ]] || false
|
||||
! [[ "$output" =~ " new table: generated_foo" ]] || false
|
||||
remoteOutput=$output
|
||||
|
||||
run dolt --user dolt status --ignored
|
||||
[ "$status" -eq 0 ] || false
|
||||
[[ "$output" =~ "On branch main" ]] || false
|
||||
[[ "$output" =~ "Changes to be committed:" ]] || false
|
||||
[[ "$output" =~ " (use \"dolt reset <table>...\" to unstage)" ]] || false
|
||||
[[ "$output" =~ " modified: table1" ]] || false
|
||||
[[ "$output" =~ "Changes not staged for commit:" ]] || false
|
||||
[[ "$output" =~ " (use \"dolt add <table>\" to update what will be committed)" ]] || false
|
||||
[[ "$output" =~ " (use \"dolt checkout <table>\" to discard changes in working directory)" ]] || false
|
||||
[[ "$output" =~ " modified: table2" ]] || false
|
||||
[[ "$output" =~ "Untracked tables:" ]] || false
|
||||
[[ "$output" =~ " (use \"dolt add <table>\" to include in what will be committed)" ]] || false
|
||||
[[ "$output" =~ " new table: table3" ]] || false
|
||||
[[ "$output" =~ "Ignored tables:" ]] || false
|
||||
[[ "$output" =~ " (use \"dolt add -f <table>\" to include in what will be committed)" ]] || false
|
||||
[[ "$output" =~ " new table: generated_foo" ]] || false
|
||||
remoteIgnoredOutput=$output
|
||||
run dolt --user dolt status --ignored
|
||||
[ "$status" -eq 0 ] || false
|
||||
[[ "$output" =~ "On branch main" ]] || false
|
||||
[[ "$output" =~ "Changes to be committed:" ]] || false
|
||||
[[ "$output" =~ " (use \"dolt reset <table>...\" to unstage)" ]] || false
|
||||
[[ "$output" =~ " modified: table1" ]] || false
|
||||
[[ "$output" =~ "Changes not staged for commit:" ]] || false
|
||||
[[ "$output" =~ " (use \"dolt add <table>\" to update what will be committed)" ]] || false
|
||||
[[ "$output" =~ " (use \"dolt checkout <table>\" to discard changes in working directory)" ]] || false
|
||||
[[ "$output" =~ " modified: table2" ]] || false
|
||||
[[ "$output" =~ "Untracked tables:" ]] || false
|
||||
[[ "$output" =~ " (use \"dolt add <table>\" to include in what will be committed)" ]] || false
|
||||
[[ "$output" =~ " new table: table3" ]] || false
|
||||
[[ "$output" =~ "Ignored tables:" ]] || false
|
||||
[[ "$output" =~ " (use \"dolt add -f <table>\" to include in what will be committed)" ]] || false
|
||||
[[ "$output" =~ " new table: generated_foo" ]] || false
|
||||
remoteIgnoredOutput=$output
|
||||
|
||||
stop_sql_server 1
|
||||
|
||||
run dolt status
|
||||
[ "$status" -eq 0 ] || false
|
||||
localOutput=$output
|
||||
|
||||
run dolt --user dolt status --ignored
|
||||
[ "$status" -eq 0 ] || false
|
||||
localIgnoredOutput=$output
|
||||
|
||||
[[ "$remoteOutput" == "$localOutput" ]] || false
|
||||
[[ "$remoteIgnoredOutput" == "$localIgnoredOutput" ]] || false
|
||||
}
|
||||
|
||||
@test "sql-local-remote: verify dolt commit behavior is identical in switch between server/no server" {
|
||||
cd altDB
|
||||
dolt sql -q "create table test1 (pk int primary key)"
|
||||
dolt sql -q "create table test2 (pk int primary key)"
|
||||
dolt add test1
|
||||
cd ..
|
||||
|
||||
start_sql_server altDB
|
||||
|
||||
run dolt --verbose-engine-setup --user dolt commit -m "committing remotely"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
stop_sql_server 1
|
||||
|
||||
run dolt status
|
||||
[ "$status" -eq 0 ] || false
|
||||
localOutput=$output
|
||||
run dolt log
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "committing remotely" ]] || false
|
||||
|
||||
run dolt --user dolt status --ignored
|
||||
[ "$status" -eq 0 ] || false
|
||||
localIgnoredOutput=$output
|
||||
run dolt add test2
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
[[ "$remoteOutput" == "$localOutput" ]] || false
|
||||
[[ "$remoteIgnoredOutput" == "$localIgnoredOutput" ]] || false
|
||||
run dolt commit -m "committing locally"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
run dolt log
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "committing locally" ]] || false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user