Test for auto increment on a newly cloned database

This commit is contained in:
Zach Musgrave
2023-04-12 12:53:50 -07:00
parent e31d29ba61
commit 62592b4384

View File

@@ -776,3 +776,43 @@ SQL
[[ "$output" =~ "5,5" ]] || false
[[ "$output" =~ "6,6" ]] || false
}
@test "auto_increment: newly cloned database" {
dolt sql <<SQL
call dolt_add('.');
call dolt_commit('-am', 'empty table');
call dolt_branch('branch1');
call dolt_branch('branch2');
insert into test (c0) values (1), (2);
call dolt_commit('-am', 'main values');
call dolt_checkout('branch1');
insert into test (c0) values (3), (4);
call dolt_commit('-am', 'branch1 values');
call dolt_checkout('branch2');
insert into test (c0) values (5), (6);
call dolt_commit('-am', 'branch2 values');
SQL
dolt remote add remote1 file://./remote1
dolt push remote1 main
dolt push remote1 branch1
dolt push remote1 branch2
dolt clone file://./remote1 clone
cd clone
# The clone should find the values on the remote branches that haven't been
# checked out locally
dolt sql <<SQL
insert into test (c0) values (7), (8);
SQL
run dolt sql -q 'select * from test' -r csv
[ $status -eq 0 ]
[[ "$output" =~ "7,7" ]] || false
[[ "$output" =~ "8,8" ]] || false
}