mirror of
https://github.com/dolthub/dolt.git
synced 2025-12-30 16:12:39 -06:00
Update bats tests. These tests test handling data conflicts, but the behavior that was in the test (row deletion + column deletion) is no longer a conflict. This commit changes the behavior to something else that is a conflict.
This commit is contained in:
@@ -179,9 +179,10 @@ teardown() {
|
||||
dolt commit -am "add row 100 to other (on branch2)"
|
||||
|
||||
# This ALTER TABLE statement modifies other rows that aren't included in the cherry-picked
|
||||
# commit – row (100, 200, 300) is modified to (100, 300). This shows up as a conflict
|
||||
# commit – row (100, 200, 300) is modified to (100, 400). This shows up as a conflict
|
||||
# in the cherry-pick (modified row on one side, row doesn't exist on the other side).
|
||||
dolt sql -q "ALTER TABLE other DROP COLUMN c1;"
|
||||
dolt sql -q "UPDATE other SET c2 = 400 WHERE pk = 100"
|
||||
dolt sql -q "INSERT INTO other VALUES (10, 30);"
|
||||
dolt sql -q "INSERT INTO test VALUES (100, 'q');"
|
||||
dolt commit -am "alter table, add row 10 to other, add row 100 to test (on branch2)"
|
||||
@@ -203,7 +204,7 @@ teardown() {
|
||||
run dolt conflicts cat .
|
||||
[ $status -eq 0 ]
|
||||
[[ $output =~ "| - | ours | 100 | 200 | 300 |" ]] || false
|
||||
[[ $output =~ "| * | theirs | 100 | NULL | 300 |" ]] || false
|
||||
[[ $output =~ "| * | theirs | 100 | NULL | 400 |" ]] || false
|
||||
|
||||
# Asert the data we expect is in the table
|
||||
run dolt sql -r csv -q "SELECT * from other;"
|
||||
@@ -577,24 +578,14 @@ teardown() {
|
||||
dolt commit -am "alter table test drop column v"
|
||||
|
||||
# Dropping column v on branch1 modifies all rows in the table, and those rows
|
||||
# don't exist on main, so they are reported as conflicts – the rows were modified in
|
||||
# the target commit, but they don't exist on the target root.
|
||||
# don't exist on main, so they would be a conflict. However, cell-wise merging is able to resolve the conflict.
|
||||
dolt checkout main
|
||||
run dolt cherry-pick branch1
|
||||
[ $status -eq 1 ]
|
||||
run dolt conflicts cat .
|
||||
[ $status -eq 0 ]
|
||||
[[ $output =~ '| | base | 1 | a |' ]] || false
|
||||
[[ $output =~ '| - | ours | 1 | a |' ]] || false
|
||||
[[ $output =~ '| * | theirs | 1 | NULL |' ]] || false
|
||||
|
||||
# Resolve and assert that column v is dropped
|
||||
dolt conflicts resolve --ours .
|
||||
run dolt sql -q "SHOW CREATE TABLE test;"
|
||||
[ $status -eq 0 ]
|
||||
[[ ! $output =~ '`v` varchar(10)' ]] || false
|
||||
|
||||
dolt commit -am "cherry-picked column drop"
|
||||
}
|
||||
|
||||
@test "cherry-pick: commit with ALTER TABLE rename column" {
|
||||
|
||||
@@ -1038,9 +1038,10 @@ SQL
|
||||
dolt sql -q "INSERT INTO other VALUES (100, 200, 300);"
|
||||
dolt commit -am "add row 100 to other (on branch2)"
|
||||
# This ALTER TABLE statement modifies other rows that aren't included in the cherry-picked
|
||||
# commit – row (100, 200, 300) is modified to (100, 300). This shows up as a conflict
|
||||
# commit – row (100, 200, 300) is modified to (100, 400). This shows up as a conflict
|
||||
# in the cherry-pick (modified row on one side, row doesn't exist on the other side).
|
||||
dolt sql -q "ALTER TABLE other DROP COLUMN c1;"
|
||||
dolt sql -q "UPDATE other SET c2 = 400 WHERE pk = 100"
|
||||
dolt sql -q "INSERT INTO other VALUES (10, 30);"
|
||||
dolt sql -q "INSERT INTO test VALUES (100, 'q');"
|
||||
dolt commit -am "alter table, add row 10 to other, add row 100 to test (on branch2)"
|
||||
|
||||
@@ -92,7 +92,7 @@ teardown() {
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${lines[1]}" =~ "| pk | a | b | x | y |" ]] || false
|
||||
[[ "${lines[2]}" =~ "+----+------+-----+---+-----+" ]] || false
|
||||
[[ "${lines[3]}" =~ "| 0 | asdf | 1.1 | 0 | 121 |" ]] || false
|
||||
[[ "${lines[3]}" =~ "| 0 | asdf | 1.1 | 1 | 121 |" ]] || false
|
||||
[[ "${lines[4]}" =~ "| 2 | asdf | 1.1 | 0 | 121 |" ]] || false
|
||||
[[ "${lines[5]}" =~ "| 3 | data | 1.1 | 0 | 121 |" ]] || false
|
||||
}
|
||||
@@ -119,7 +119,7 @@ teardown() {
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${lines[1]}" =~ "| pk | a | b | w | z |" ]] || false
|
||||
[[ "${lines[2]}" =~ "+----+------+-----+---+-----+" ]] || false
|
||||
[[ "${lines[3]}" =~ "| 0 | asdf | 1.1 | 0 | 122 |" ]] || false
|
||||
[[ "${lines[3]}" =~ "| 0 | asdf | 1.1 | 1 | 122 |" ]] || false
|
||||
[[ "${lines[4]}" =~ "| 1 | asdf | 1.1 | 0 | 122 |" ]] || false
|
||||
[[ "${lines[5]}" =~ "| 4 | data | 1.1 | 0 | 122 |" ]] || false
|
||||
|
||||
@@ -153,8 +153,8 @@ EOF
|
||||
+---+----+------+-----+------+------+------+------+
|
||||
| | pk | a | b | w | z | x | y |
|
||||
+---+----+------+-----+------+------+------+------+
|
||||
| < | 0 | asdf | 1.1 | 0 | 122 | NULL | NULL |
|
||||
| > | 0 | asdf | 1.1 | NULL | NULL | 0 | 121 |
|
||||
| < | 0 | asdf | 1.1 | 1 | 122 | NULL | NULL |
|
||||
| > | 0 | asdf | 1.1 | NULL | NULL | 1 | 121 |
|
||||
| - | 1 | asdf | 1.1 | 0 | 122 | NULL | NULL |
|
||||
| + | 2 | asdf | 1.1 | NULL | NULL | 0 | 121 |
|
||||
| + | 3 | data | 1.1 | NULL | NULL | 0 | 121 |
|
||||
|
||||
@@ -45,6 +45,7 @@ dolt branch init
|
||||
dolt branch other
|
||||
dolt sql <<SQL
|
||||
DELETE FROM abc WHERE pk=1;
|
||||
UPDATE abc SET x = 1 WHERE pk = 0;
|
||||
INSERT INTO abc VALUES (3, 'data', 1.1, 0, 0);
|
||||
ALTER TABLE abc DROP COLUMN w;
|
||||
ALTER TABLE abc ADD COLUMN y BIGINT;
|
||||
@@ -56,6 +57,7 @@ dolt commit -m "made changes to $DEFAULT_BRANCH"
|
||||
dolt checkout other
|
||||
dolt sql <<SQL
|
||||
DELETE FROM abc WHERE pk=2;
|
||||
UPDATE abc SET w = 1 WHERE pk = 0;
|
||||
INSERT INTO abc VALUES (4, 'data', 1.1, 0, 0);
|
||||
ALTER TABLE abc DROP COLUMN x;
|
||||
ALTER TABLE abc ADD COLUMN z BIGINT;
|
||||
|
||||
Reference in New Issue
Block a user