From efff37bdf695a8f648a7af141e64fd6bed3bd080 Mon Sep 17 00:00:00 2001 From: Nick Tobey Date: Wed, 15 Nov 2023 01:21:13 -0800 Subject: [PATCH] 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. --- integration-tests/bats/cherry-pick.bats | 17 ++++------------- integration-tests/bats/sql-local-remote.bats | 3 ++- .../test_files/bats/compatibility.bats | 8 ++++---- .../compatibility/test_files/setup_repo.sh | 2 ++ 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/integration-tests/bats/cherry-pick.bats b/integration-tests/bats/cherry-pick.bats index 9703afd5ef..bc891a3aab 100644 --- a/integration-tests/bats/cherry-pick.bats +++ b/integration-tests/bats/cherry-pick.bats @@ -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" { diff --git a/integration-tests/bats/sql-local-remote.bats b/integration-tests/bats/sql-local-remote.bats index b44138721a..95366a0239 100644 --- a/integration-tests/bats/sql-local-remote.bats +++ b/integration-tests/bats/sql-local-remote.bats @@ -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)" diff --git a/integration-tests/compatibility/test_files/bats/compatibility.bats b/integration-tests/compatibility/test_files/bats/compatibility.bats index d4290d2ef1..0d8aacc5f4 100755 --- a/integration-tests/compatibility/test_files/bats/compatibility.bats +++ b/integration-tests/compatibility/test_files/bats/compatibility.bats @@ -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 | diff --git a/integration-tests/compatibility/test_files/setup_repo.sh b/integration-tests/compatibility/test_files/setup_repo.sh index 2ccca19b85..6e4772708a 100755 --- a/integration-tests/compatibility/test_files/setup_repo.sh +++ b/integration-tests/compatibility/test_files/setup_repo.sh @@ -45,6 +45,7 @@ dolt branch init dolt branch other dolt sql <