/{.github,integration-tests}: split long bats files so temp dirs are cleaned up more often, split go tests by package

This commit is contained in:
Dustin Brown
2021-04-16 11:22:49 -07:00
parent 8dd73a8cb6
commit f7429e7780
6 changed files with 979 additions and 931 deletions

View File

@@ -5,10 +5,14 @@ on:
branches: [ master ]
paths:
- 'go/**'
workflow_dispatch:
jobs:
test:
name: Go tests
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
@@ -23,4 +27,24 @@ jobs:
- uses: actions/checkout@v2
- name: Test All
working-directory: ./go
run: go test -timeout 30m -race ./...
run: |
files=$(go list ./...)
SAVEIFS=$IFS
IFS=$'\n'
file_arr=($files)
IFS=$SAVEIFS
file_list=
for (( i=0; i<${#file_arr[@]}; i++ ))
do
echo "Testing Package: ${file_arr[$i]}"
go test -timeout 30m -race "${file_arr[$i]}"
succeeded=$(echo "$?")
if [ "$succeeded" -ne 0 ]; then
echo "Testing failed in package ${file_arr[$i]}"
exit 1;
fi
done

View File

@@ -0,0 +1,470 @@
#!/usr/bin/env bats
load $BATS_TEST_DIRNAME/helper/common.bash
setup() {
setup_common
}
teardown() {
teardown_common
}
# Altering types and properties of the schema are not really supported by the
# command line. Have to upload schema files for these next few tests.
@test "conflict-detection-2: two branches change type of same column to same type. merge. no conflict" {
skip "type changes are not allowed without changing tag"
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
c1 BIGINT COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk)
);
SQL
dolt add test
dolt commit -m "table created"
dolt branch change-types
dolt table rm test
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
c1 BIGINT UNSIGNED COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk)
);
SQL
dolt add test
dolt commit -m "changed c1 to type uint"
dolt checkout change-types
dolt table rm test
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
c1 BIGINT UNSIGNED COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk)
);
SQL
dolt add test
dolt commit -m "changed c1 to type uint again"
dolt checkout master
run dolt merge change-types
[ $status -eq 0 ]
[[ "$output" =~ "Updating" ]] || false
[[ ! "$output" =~ "CONFLICT" ]] || false
}
@test "conflict-detection-2: two branches change type of same column to different type. merge. conflict" {
skip "type changes are not allowed without changing tag"
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
c1 BIGINT COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk)
);
SQL
dolt add test
dolt commit -m "table created"
dolt branch change-types
dolt table rm test
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
c1 BIGINT UNSIGNED COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk)
);
SQL
dolt add test
dolt commit -m "changed c1 to type uint"
dolt checkout change-types
dolt table rm test
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
c1 DOUBLE COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk)
);
SQL
skip "I think changing a type to two different types should throw a conflict"
dolt add test
dolt commit -m "changed c1 to type float"
dolt checkout master
run dolt merge change-types
[ $status -eq 1 ]
[[ "$output" =~ "Bad merge" ]] || false
[ $status -eq 0 ]
[[ "$output" =~ "CONFLICT" ]] || false
}
@test "conflict-detection-2: two branches make same column primary key. merge. no conflict" {
skip "cannot resuse tags on table drop/add"
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
c1 BIGINT COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk)
);
SQL
dolt add test
dolt commit -m "table created"
dolt branch add-pk
dolt table rm test
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
c1 BIGINT COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk,c1)
);
SQL
dolt add test
dolt commit -m "made c1 a pk"
dolt checkout add-pk
dolt table rm test
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
c1 BIGINT COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk,c1)
);
SQL
dolt add test
dolt commit -m "made c1 a pk again"
dolt checkout master
run dolt merge add-pk
[ $status -eq 0 ]
[[ "$output" =~ "Updating" ]] || false
[[ ! "$output" =~ "CONFLICT" ]] || false
}
@test "conflict-detection-2: two branches add same primary key column. merge. no conflict" {
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
c1 BIGINT COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk)
);
SQL
dolt add test
dolt commit -m "table created"
dolt branch add-pk
dolt table rm test
skip "cannot add change primary keys"
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
pk1 BIGINT NOT NULL COMMENT 'tag:6',
c1 BIGINT COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk,pk1)
);
SQL
dolt add test
dolt commit -m "added pk pk1"
dolt checkout add-pk
dolt table rm test
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
pk1 BIGINT NOT NULL COMMENT 'tag:6',
c1 BIGINT COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk,pk1)
);
SQL
dolt add test
dolt commit -m "added pk pk1 again"
dolt checkout master
run dolt merge add-pk
[ $status -eq 0 ]
[[ "$output" =~ "Updating" ]] || false
[[ ! "$output" =~ "CONFLICT" ]] || false
}
@test "conflict-detection-2: two branches make different columns primary key. merge. conflict" {
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
c1 BIGINT COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk)
);
SQL
dolt add test
dolt commit -m "table created"
dolt branch add-pk
dolt table rm test
skip "cannot change primary keys"
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
pk1 BIGINT NOT NULL COMMENT 'tag:6',
c1 BIGINT COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk,pk1)
);
SQL
dolt add test
dolt commit -m "added pk pk1"
dolt checkout add-pk
dolt table rm test
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
pk2 BIGINT NOT NULL COMMENT 'tag:7',
c1 BIGINT COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk,pk2)
);
SQL
dolt add test
dolt commit -m "added pk pk2"
dolt checkout master
run dolt merge add-pk
[ $status -eq 0 ]
skip "This merges fine right now. Should throw conflict."
[[ "$output" =~ "CONFLICT" ]] || false
}
@test "conflict-detection-2: two branches both create different tables. merge. no conflict" {
dolt branch table1
dolt branch table2
dolt checkout table1
dolt sql <<SQL
CREATE TABLE table1 (
pk BIGINT NOT NULL,
c1 BIGINT,
c2 BIGINT,
c3 BIGINT,
c4 BIGINT,
c5 BIGINT,
PRIMARY KEY (pk)
);
SQL
dolt add table1
dolt commit -m "first table"
dolt checkout table2
dolt sql <<SQL
CREATE TABLE table2 (
pk1 BIGINT NOT NULL,
pk2 BIGINT NOT NULL,
c1 BIGINT,
c2 BIGINT,
c3 BIGINT,
c4 BIGINT,
c5 BIGINT,
PRIMARY KEY (pk1,pk2)
);
SQL
dolt add table2
dolt commit -m "second table"
dolt checkout master
run dolt merge table1
[ "$status" -eq 0 ]
[[ "$output" =~ "Fast-forward" ]] || false
run dolt merge table2
[ "$status" -eq 0 ]
[[ "$output" =~ "Updating" ]] || false
[[ ! "$output" =~ "CONFLICT" ]] || false
}
@test "conflict-detection-2: two branches drop different tables. merge. no conflict" {
dolt sql <<SQL
CREATE TABLE foo (
pk BIGINT NOT NULL PRIMARY KEY
);
CREATE TABLE bar (
pk BIGINT NOT NULL PRIMARY KEY
);
SQL
dolt add .
dolt commit -m "created two tables"
dolt branch other
dolt sql -q 'drop table foo'
dolt add .
dolt commit -m "dropped table foo"
dolt checkout other
dolt sql -q 'drop table bar'
dolt add .
dolt commit -m "dropped table bar"
dolt checkout master
skip "test currently panics on merge at doltcore/env/actions/merge.go:79"
run dolt merge other
[ "$status" -eq 0 ]
[[ "$output" =~ "Updating" ]] || false
[[ ! "$output" =~ "CONFLICT" ]] || false
}
@test "conflict-detection-2: two branch rename different tables. merge. no conflict" {
dolt sql <<SQL
CREATE TABLE foo (
pk BIGINT NOT NULL PRIMARY KEY
);
CREATE TABLE bar (
pk BIGINT NOT NULL PRIMARY KEY
);
SQL
dolt add .
dolt commit -m "created two tables"
dolt branch other
dolt sql -q 'alter table foo rename to foofoo;'
dolt add .
dolt commit -m "renamed table foo to foofoo"
dolt checkout other
dolt sql -q 'alter table bar rename to barbar'
dolt add .
dolt commit -m "renamed table bar to barbar"
dolt checkout master
skip "test currently panics on merge at doltcore/env/actions/merge.go:79"
run dolt merge other
[ "$status" -eq 0 ]
[[ "$output" =~ "Updating" ]] || false
[[ ! "$output" =~ "CONFLICT" ]] || false
}
@test "conflict-detection-2: two branches, one deletes rows, one modifies those same rows. merge. conflict" {
dolt sql <<SQL
CREATE TABLE foo (
pk INT PRIMARY KEY,
val INT
);
INSERT INTO foo VALUES (1, 1), (2, 1), (3, 1), (4, 1), (5, 1);
SQL
dolt add foo
dolt commit -m 'initial commit.'
dolt checkout -b deleter
dolt sql -q 'delete from foo'
dolt add foo
dolt commit -m 'delete commit.'
dolt checkout -b modifier master
dolt sql -q 'update foo set val = val + 1 where pk in (1, 3, 5);'
dolt add foo
dolt commit -m 'modify commit.'
dolt checkout -b merge-into-modified modifier
run dolt merge deleter
[ "$status" -eq 0 ]
[[ "$output" =~ "CONFLICT" ]] || false
dolt merge --abort
# Accept theirs deletes all rows.
dolt checkout master
dolt branch -d -f merge-into-modified
dolt checkout -b merge-into-modified modifier
dolt merge deleter
# Test resolve nonexistant key
run dolt conflicts resolve foo 999
[ "$status" -eq 1 ]
[[ "$output" =~ "no conflicts resolved" ]] || false
dolt conflicts resolve --theirs foo
run dolt sql -q 'select count(*) from foo'
[ "$status" -eq 0 ]
[[ "$output" =~ "| 0 |" ]] || false
dolt merge --abort
dolt reset --hard
# Accept ours deletes two rows.
dolt checkout master
dolt branch -d -f merge-into-modified
dolt checkout -b merge-into-modified modifier
dolt merge deleter
dolt conflicts resolve --ours foo
run dolt sql -q 'select count(*) from foo'
[ "$status" -eq 0 ]
[[ "$output" =~ "| 3 |" ]] || false
dolt merge --abort
dolt reset --hard
dolt checkout -b merge-into-deleter deleter
run dolt merge modifier
[ "$status" -eq 0 ]
[[ "$output" =~ "CONFLICT" ]] || false
dolt merge --abort
# Accept ours deletes all rows.
dolt checkout master
dolt branch -d -f merge-into-deleter
dolt checkout -b merge-into-deleter deleter
dolt merge modifier
dolt conflicts resolve --ours foo
run dolt sql -q 'select count(*) from foo'
[ "$status" -eq 0 ]
[[ "$output" =~ "| 0 |" ]] || false
dolt merge --abort
dolt reset --hard
# Accept theirs adds modified.
dolt checkout master
dolt branch -d -f merge-into-deleter
dolt checkout -b merge-into-deleter deleter
dolt merge modifier
dolt conflicts resolve --theirs foo
run dolt sql -q 'select count(*) from foo'
[ "$status" -eq 0 ]
[[ "$output" =~ "| 3 |" ]] || false
dolt merge --abort
dolt reset --hard
}

View File

@@ -517,463 +517,3 @@ SQL
[ $status -eq 0 ]
[[ "$output" =~ "CONFLICT" ]] || false
}
# Altering types and properties of the schema are not really supported by the
# command line. Have to upload schema files for these next few tests.
@test "conflict-detection: two branches change type of same column to same type. merge. no conflict" {
skip "type changes are not allowed without changing tag"
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
c1 BIGINT COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk)
);
SQL
dolt add test
dolt commit -m "table created"
dolt branch change-types
dolt table rm test
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
c1 BIGINT UNSIGNED COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk)
);
SQL
dolt add test
dolt commit -m "changed c1 to type uint"
dolt checkout change-types
dolt table rm test
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
c1 BIGINT UNSIGNED COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk)
);
SQL
dolt add test
dolt commit -m "changed c1 to type uint again"
dolt checkout master
run dolt merge change-types
[ $status -eq 0 ]
[[ "$output" =~ "Updating" ]] || false
[[ ! "$output" =~ "CONFLICT" ]] || false
}
@test "conflict-detection: two branches change type of same column to different type. merge. conflict" {
skip "type changes are not allowed without changing tag"
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
c1 BIGINT COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk)
);
SQL
dolt add test
dolt commit -m "table created"
dolt branch change-types
dolt table rm test
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
c1 BIGINT UNSIGNED COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk)
);
SQL
dolt add test
dolt commit -m "changed c1 to type uint"
dolt checkout change-types
dolt table rm test
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
c1 DOUBLE COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk)
);
SQL
skip "I think changing a type to two different types should throw a conflict"
dolt add test
dolt commit -m "changed c1 to type float"
dolt checkout master
run dolt merge change-types
[ $status -eq 1 ]
[[ "$output" =~ "Bad merge" ]] || false
[ $status -eq 0 ]
[[ "$output" =~ "CONFLICT" ]] || false
}
@test "conflict-detection: two branches make same column primary key. merge. no conflict" {
skip "cannot resuse tags on table drop/add"
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
c1 BIGINT COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk)
);
SQL
dolt add test
dolt commit -m "table created"
dolt branch add-pk
dolt table rm test
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
c1 BIGINT COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk,c1)
);
SQL
dolt add test
dolt commit -m "made c1 a pk"
dolt checkout add-pk
dolt table rm test
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
c1 BIGINT COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk,c1)
);
SQL
dolt add test
dolt commit -m "made c1 a pk again"
dolt checkout master
run dolt merge add-pk
[ $status -eq 0 ]
[[ "$output" =~ "Updating" ]] || false
[[ ! "$output" =~ "CONFLICT" ]] || false
}
@test "conflict-detection: two branches add same primary key column. merge. no conflict" {
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
c1 BIGINT COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk)
);
SQL
dolt add test
dolt commit -m "table created"
dolt branch add-pk
dolt table rm test
skip "cannot add change primary keys"
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
pk1 BIGINT NOT NULL COMMENT 'tag:6',
c1 BIGINT COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk,pk1)
);
SQL
dolt add test
dolt commit -m "added pk pk1"
dolt checkout add-pk
dolt table rm test
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
pk1 BIGINT NOT NULL COMMENT 'tag:6',
c1 BIGINT COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk,pk1)
);
SQL
dolt add test
dolt commit -m "added pk pk1 again"
dolt checkout master
run dolt merge add-pk
[ $status -eq 0 ]
[[ "$output" =~ "Updating" ]] || false
[[ ! "$output" =~ "CONFLICT" ]] || false
}
@test "conflict-detection: two branches make different columns primary key. merge. conflict" {
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
c1 BIGINT COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk)
);
SQL
dolt add test
dolt commit -m "table created"
dolt branch add-pk
dolt table rm test
skip "cannot change primary keys"
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
pk1 BIGINT NOT NULL COMMENT 'tag:6',
c1 BIGINT COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk,pk1)
);
SQL
dolt add test
dolt commit -m "added pk pk1"
dolt checkout add-pk
dolt table rm test
dolt sql <<SQL
CREATE TABLE test (
pk BIGINT NOT NULL COMMENT 'tag:0',
pk2 BIGINT NOT NULL COMMENT 'tag:7',
c1 BIGINT COMMENT 'tag:1',
c2 BIGINT COMMENT 'tag:2',
c3 BIGINT COMMENT 'tag:3',
c4 BIGINT COMMENT 'tag:4',
c5 BIGINT COMMENT 'tag:5',
PRIMARY KEY (pk,pk2)
);
SQL
dolt add test
dolt commit -m "added pk pk2"
dolt checkout master
run dolt merge add-pk
[ $status -eq 0 ]
skip "This merges fine right now. Should throw conflict."
[[ "$output" =~ "CONFLICT" ]] || false
}
@test "conflict-detection: two branches both create different tables. merge. no conflict" {
dolt branch table1
dolt branch table2
dolt checkout table1
dolt sql <<SQL
CREATE TABLE table1 (
pk BIGINT NOT NULL,
c1 BIGINT,
c2 BIGINT,
c3 BIGINT,
c4 BIGINT,
c5 BIGINT,
PRIMARY KEY (pk)
);
SQL
dolt add table1
dolt commit -m "first table"
dolt checkout table2
dolt sql <<SQL
CREATE TABLE table2 (
pk1 BIGINT NOT NULL,
pk2 BIGINT NOT NULL,
c1 BIGINT,
c2 BIGINT,
c3 BIGINT,
c4 BIGINT,
c5 BIGINT,
PRIMARY KEY (pk1,pk2)
);
SQL
dolt add table2
dolt commit -m "second table"
dolt checkout master
run dolt merge table1
[ "$status" -eq 0 ]
[[ "$output" =~ "Fast-forward" ]] || false
run dolt merge table2
[ "$status" -eq 0 ]
[[ "$output" =~ "Updating" ]] || false
[[ ! "$output" =~ "CONFLICT" ]] || false
}
@test "conflict-detection: two branches drop different tables. merge. no conflict" {
dolt sql <<SQL
CREATE TABLE foo (
pk BIGINT NOT NULL PRIMARY KEY
);
CREATE TABLE bar (
pk BIGINT NOT NULL PRIMARY KEY
);
SQL
dolt add .
dolt commit -m "created two tables"
dolt branch other
dolt sql -q 'drop table foo'
dolt add .
dolt commit -m "dropped table foo"
dolt checkout other
dolt sql -q 'drop table bar'
dolt add .
dolt commit -m "dropped table bar"
dolt checkout master
skip "test currently panics on merge at doltcore/env/actions/merge.go:79"
run dolt merge other
[ "$status" -eq 0 ]
[[ "$output" =~ "Updating" ]] || false
[[ ! "$output" =~ "CONFLICT" ]] || false
}
@test "conflict-detection: two branch rename different tables. merge. no conflict" {
dolt sql <<SQL
CREATE TABLE foo (
pk BIGINT NOT NULL PRIMARY KEY
);
CREATE TABLE bar (
pk BIGINT NOT NULL PRIMARY KEY
);
SQL
dolt add .
dolt commit -m "created two tables"
dolt branch other
dolt sql -q 'alter table foo rename to foofoo;'
dolt add .
dolt commit -m "renamed table foo to foofoo"
dolt checkout other
dolt sql -q 'alter table bar rename to barbar'
dolt add .
dolt commit -m "renamed table bar to barbar"
dolt checkout master
skip "test currently panics on merge at doltcore/env/actions/merge.go:79"
run dolt merge other
[ "$status" -eq 0 ]
[[ "$output" =~ "Updating" ]] || false
[[ ! "$output" =~ "CONFLICT" ]] || false
}
@test "conflict-detection: two branches, one deletes rows, one modifies those same rows. merge. conflict" {
dolt sql <<SQL
CREATE TABLE foo (
pk INT PRIMARY KEY,
val INT
);
INSERT INTO foo VALUES (1, 1), (2, 1), (3, 1), (4, 1), (5, 1);
SQL
dolt add foo
dolt commit -m 'initial commit.'
dolt checkout -b deleter
dolt sql -q 'delete from foo'
dolt add foo
dolt commit -m 'delete commit.'
dolt checkout -b modifier master
dolt sql -q 'update foo set val = val + 1 where pk in (1, 3, 5);'
dolt add foo
dolt commit -m 'modify commit.'
dolt checkout -b merge-into-modified modifier
run dolt merge deleter
[ "$status" -eq 0 ]
[[ "$output" =~ "CONFLICT" ]] || false
dolt merge --abort
# Accept theirs deletes all rows.
dolt checkout master
dolt branch -d -f merge-into-modified
dolt checkout -b merge-into-modified modifier
dolt merge deleter
# Test resolve nonexistant key
run dolt conflicts resolve foo 999
[ "$status" -eq 1 ]
[[ "$output" =~ "no conflicts resolved" ]] || false
dolt conflicts resolve --theirs foo
run dolt sql -q 'select count(*) from foo'
[ "$status" -eq 0 ]
[[ "$output" =~ "| 0 |" ]] || false
dolt merge --abort
dolt reset --hard
# Accept ours deletes two rows.
dolt checkout master
dolt branch -d -f merge-into-modified
dolt checkout -b merge-into-modified modifier
dolt merge deleter
dolt conflicts resolve --ours foo
run dolt sql -q 'select count(*) from foo'
[ "$status" -eq 0 ]
[[ "$output" =~ "| 3 |" ]] || false
dolt merge --abort
dolt reset --hard
dolt checkout -b merge-into-deleter deleter
run dolt merge modifier
[ "$status" -eq 0 ]
[[ "$output" =~ "CONFLICT" ]] || false
dolt merge --abort
# Accept ours deletes all rows.
dolt checkout master
dolt branch -d -f merge-into-deleter
dolt checkout -b merge-into-deleter deleter
dolt merge modifier
dolt conflicts resolve --ours foo
run dolt sql -q 'select count(*) from foo'
[ "$status" -eq 0 ]
[[ "$output" =~ "| 0 |" ]] || false
dolt merge --abort
dolt reset --hard
# Accept theirs adds modified.
dolt checkout master
dolt branch -d -f merge-into-deleter
dolt checkout -b merge-into-deleter deleter
dolt merge modifier
dolt conflicts resolve --theirs foo
run dolt sql -q 'select count(*) from foo'
[ "$status" -eq 0 ]
[[ "$output" =~ "| 3 |" ]] || false
dolt merge --abort
dolt reset --hard
}

View File

@@ -0,0 +1,118 @@
two_pk_header="pk1,pk2,c1,c2"
one_pk_header="pk1,c1,c2"
two_pk="$two_pk_header
1,9,128,32
2,8,129,31
3,7,130,30
4,6,131,29
5,5,132,28"
one_pk="$one_pk_header
1,128,32
2,129,31
3,130,30
4,131,29
5,132,28"
two_pk_all_updated="$two_pk_header
1,9,128,256
2,8,129,256
3,7,130,256
4,6,131,256
5,5,132,256"
one_pk_all_updated="$one_pk_header
1,128,256
2,129,256
3,130,256
4,131,256
5,132,256"
two_pk_one_row_deleted="$two_pk_header
1,9,128,32
3,7,130,30
4,6,131,29
5,5,132,28"
one_pk_one_row_deleted="$one_pk_header
1,128,32
3,130,30
4,131,29
5,132,28"
two_pk_two_row_deleted="$two_pk_header
1,9,128,32
4,6,131,29
5,5,132,28"
one_pk_two_row_deleted="$one_pk_header
1,128,32
4,131,29
5,132,28"
two_pk_one_row_updated="$two_pk_header
1,9,128,32
2,8,129,256
3,7,130,30
4,6,131,29
5,5,132,28"
one_pk_one_row_updated="$one_pk_header
1,128,32
2,129,256
3,130,30
4,131,29
5,132,28"
two_pk_two_row_updated="$two_pk_header
1,9,128,32
2,8,129,256
3,7,130,256
4,6,131,29
5,5,132,28"
one_pk_two_row_updated="$one_pk_header
1,128,32
2,129,256
3,130,256
4,131,29
5,132,28"
min_pk1=1
max_pk1=5
min_pk2=5
max_pk2=9
min_c1=128
max_c1=132
min_c2=28
max_c2=32
create_tables() {
cat <<EOF > two_pk.csv
$two_pk
EOF
cat <<EOF > one_pk.csv
$one_pk
EOF
dolt table import -c -pk pk1,pk2 --file-type=csv two_pk two_pk.csv
dolt table import -c -pk pk1 --file-type=csv one_pk one_pk.csv
}
test_mutation() {
dml="$1"
table="$2"
expected="$3"
uses_pk="$4"
dolt sql -q "$dml"
run dolt sql -q "select * from $table" -r csv
[ "$status" -eq "0" ]
[ "$output" == "$expected" ] || (echo $output && exit 1)
dolt reset --hard
dolt sql --batch -q "$dml ; $dml"
run dolt sql -q "select * from $table" -r csv
[ "$status" -eq "0" ]
[ "$output" == "$expected" ] || (echo $output && exit 1)
run dolt sql -q "explain $dml"
[ "$status" -eq "0" ]
if ! [ -z "$uses_pk" ]; then
[[ "$output" =~ "IndexedTableAccess" ]] || exit 1
else
if [[ "$output" =~ "IndexedTableAccess" ]]; then exit 1; fi
fi
}

View File

@@ -0,0 +1,365 @@
#!/usr/bin/env bats
load $BATS_TEST_DIRNAME/helper/common.bash
load $BATS_TEST_DIRNAME/helper/index-on-writes-common.bash
setup() {
setup_common
create_tables
}
teardown() {
assert_feature_version
teardown_common
}
@test "index-on-writes-2: delete none two_pk, =, pk" {
test_mutation "delete from two_pk where pk1 = 1024 and pk2 = 1024" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes-2: delete none one_pk, =, pk" {
test_mutation "delete from one_pk where pk1 = 1024" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes-2: delete none two_pk, <=, pk" {
test_mutation "delete from two_pk where pk1 <= $((min_pk1-1)) and pk2 <= $((min_pk2-1))" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes-2: delete none one_pk, <=, pk" {
test_mutation "delete from one_pk where pk1 <= $((min_pk1-1))" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes-2: delete none two_pk, <, pk" {
test_mutation "delete from two_pk where pk1 < $min_pk1 and pk2 < $min_pk2" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes-2: delete none one_pk, <, pk" {
test_mutation "delete from one_pk where pk1 < $min_pk1" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes-2: delete none two_pk, >=, pk" {
test_mutation "delete from two_pk where pk1 >= $((max_pk1+1)) and pk2 >= $((max_pk2+1))" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes-2: delete none one_pk, >=, pk" {
test_mutation "delete from one_pk where pk1 >= $((max_pk1+1))" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes-2: delete none two_pk, >, pk" {
test_mutation "delete from two_pk where pk1 > $max_pk1 and pk2 > $max_pk2" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes-2: delete none one_pk, >, pk" {
test_mutation "delete from one_pk where pk1 > $max_pk1" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes-2: delete none two_pk, =, non-pk" {
test_mutation "delete from two_pk where c1 = 1024" "two_pk" "$two_pk"
}
@test "index-on-writes-2: delete none one_pk, =, non-pk" {
test_mutation "delete from one_pk where c1 = 1024" "one_pk" "$one_pk"
}
@test "index-on-writes-2: delete none two_pk, <=, non-pk" {
test_mutation "delete from two_pk where c1 <= $((min_c1-1))" "two_pk" "$two_pk"
}
@test "index-on-writes-2: delete none one_pk, <=, non-pk" {
test_mutation "delete from one_pk where c1 <= $((min_c1-1))" "one_pk" "$one_pk"
}
@test "index-on-writes-2: delete none two_pk, <, non-pk" {
test_mutation "delete from two_pk where c1 < $min_c1" "two_pk" "$two_pk"
}
@test "index-on-writes-2: delete none one_pk, <, non-pk" {
test_mutation "delete from one_pk where c1 < $min_c1" "one_pk" "$one_pk"
}
@test "index-on-writes-2: delete none two_pk, >=, non-pk" {
test_mutation "delete from two_pk where c1 >= $((max_c1+1))" "two_pk" "$two_pk"
}
@test "index-on-writes-2: delete none one_pk, >=, non-pk" {
test_mutation "delete from one_pk where c1 >= $((max_c1+1))" "one_pk" "$one_pk"
}
@test "index-on-writes-2: delete none two_pk, >, non-pk" {
test_mutation "delete from two_pk where c2 > $max_c2" "two_pk" "$two_pk"
}
@test "index-on-writes-2: delete none one_pk, >, non-pk" {
test_mutation "delete from one_pk where c2 > $max_c2" "one_pk" "$one_pk"
}
@test "index-on-writes-2: delete none two_pk, =, pk + non-pk" {
test_mutation "delete from two_pk where pk1 = 1024 and pk2 = 1024 and c1 = 1024" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes-2: delete none one_pk, =, pk + non-pk" {
test_mutation "delete from one_pk where pk1 = 1024 and c1 = 1024" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes-2: delete none two_pk, <=, pk + non-pk" {
test_mutation "delete from two_pk where pk1 <= $((min_pk1-1)) and pk2 <= $((min_pk2-1)) and c1 <= $((min_c1-1))" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes-2: delete none one_pk, <=, pk + non-pk" {
test_mutation "delete from one_pk where pk1 <= $((min_pk1-1)) and c1 <= $((min_c1-1))" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes-2: delete none two_pk, <, pk + non-pk" {
test_mutation "delete from two_pk where pk1 < $min_pk1 and pk2 < $min_pk2 and c1 < $min_c1" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes-2: delete none one_pk, <, pk + non-pk" {
test_mutation "delete from one_pk where pk1 < $min_pk1 and c1 < $min_c1" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes-2: delete none two_pk, >=, pk + non-pk" {
test_mutation "delete from two_pk where pk1 >= $((max_pk1+1)) and pk2 >= $((max_pk2+1)) and c1 >= $((max_c1+1))" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes-2: delete none one_pk, >=, pk + non-pk" {
test_mutation "delete from one_pk where pk1 >= $((max_pk1+1)) and c1 >= $((max_c1+1))" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes-2: delete none two_pk, >, pk + non-pk" {
test_mutation "delete from two_pk where pk1 > $max_pk1 and pk2 > $max_pk2 and c2 > $max_c2" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes-2: delete none one_pk, >, pk + non-pk" {
test_mutation "delete from one_pk where pk1 > $max_pk1 and c2 > $max_c2" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes-2: update none two_pk, =, pk" {
test_mutation "update two_pk set c2 = 256 where pk1 = 1024 and pk2 = 1024" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes-2: update none one_pk, =, pk" {
test_mutation "update one_pk set c2 = 256 where pk1 = 1024" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes-2: update none two_pk, <=, pk" {
test_mutation "update two_pk set c2 = 256 where pk1 <= $((min_pk1-1)) and pk2 <= $((min_pk2-1))" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes-2: update none one_pk, <=, pk" {
test_mutation "update one_pk set c2 = 256 where pk1 <= $((min_pk1-1))" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes-2: update none two_pk, <, pk" {
test_mutation "update two_pk set c2 = 256 where pk1 < $min_pk1 and pk2 < $min_pk2" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes-2: update none one_pk, <, pk" {
test_mutation "update one_pk set c2 = 256 where pk1 < $min_pk1" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes-2: update none two_pk, >=, pk" {
test_mutation "update two_pk set c2 = 256 where pk1 >= $((max_pk1+1)) and pk2 >= $((max_pk2+1))" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes-2: update none one_pk, >=, pk" {
test_mutation "update one_pk set c2 = 256 where pk1 >= $((max_pk1+1))" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes-2: update none two_pk, >, pk" {
test_mutation "update two_pk set c2 = 256 where pk1 > $max_pk1 and pk2 > $max_pk2" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes-2: update none one_pk, >, pk" {
test_mutation "update one_pk set c2 = 256 where pk1 > $max_pk1" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes-2: update none two_pk, =, non-pk" {
test_mutation "update two_pk set c2 = 256 where c1 = 1024" "two_pk" "$two_pk"
}
@test "index-on-writes-2: update none one_pk, =, non-pk" {
test_mutation "update one_pk set c2 = 256 where c1 = 1024" "one_pk" "$one_pk"
}
@test "index-on-writes-2: update none two_pk, <=, non-pk" {
test_mutation "update two_pk set c2 = 256 where c1 <= $((min_c1-1))" "two_pk" "$two_pk"
}
@test "index-on-writes-2: update none one_pk, <=, non-pk" {
test_mutation "update one_pk set c2 = 256 where c1 <= $((min_c1-1))" "one_pk" "$one_pk"
}
@test "index-on-writes-2: update none two_pk, <, non-pk" {
test_mutation "update two_pk set c2 = 256 where c1 < $min_c1" "two_pk" "$two_pk"
}
@test "index-on-writes-2: update none one_pk, <, non-pk" {
test_mutation "update one_pk set c2 = 256 where c1 < $min_c1" "one_pk" "$one_pk"
}
@test "index-on-writes-2: update none two_pk, >=, non-pk" {
test_mutation "update two_pk set c2 = 256 where c1 >= $((max_c1+1))" "two_pk" "$two_pk"
}
@test "index-on-writes-2: update none one_pk, >=, non-pk" {
test_mutation "update one_pk set c2 = 256 where c1 >= $((max_c1+1))" "one_pk" "$one_pk"
}
@test "index-on-writes-2: update none two_pk, >, non-pk" {
test_mutation "update two_pk set c2 = 256 where c2 > $max_c2" "two_pk" "$two_pk"
}
@test "index-on-writes-2: update none one_pk, >, non-pk" {
test_mutation "update one_pk set c2 = 256 where c2 > $max_c2" "one_pk" "$one_pk"
}
@test "index-on-writes-2: update none two_pk, =, pk + non-pk" {
test_mutation "update two_pk set c2 = 256 where pk1 = 1024 and pk2 = 1024 and c1 = 1024" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes-2: update none one_pk, =, pk + non-pk" {
test_mutation "update one_pk set c2 = 256 where pk1 = 1024 and c1 = 1024" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes-2: update none two_pk, <=, pk + non-pk" {
test_mutation "update two_pk set c2 = 256 where pk1 <= $((min_pk1-1)) and pk2 <= $((min_pk2-1)) and c1 <= $((min_c1-1))" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes-2: update none one_pk, <=, pk + non-pk" {
test_mutation "update one_pk set c2 = 256 where pk1 <= $((min_pk1-1)) and c1 <= $((min_c1-1))" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes-2: update none two_pk, <, pk + non-pk" {
test_mutation "update two_pk set c2 = 256 where pk1 < $min_pk1 and pk2 < $min_pk2 and c1 < $min_c1" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes-2: update none one_pk, <, pk + non-pk" {
test_mutation "update one_pk set c2 = 256 where pk1 < $min_pk1 and c1 < $min_c1" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes-2: update none two_pk, >=, pk + non-pk" {
test_mutation "update two_pk set c2 = 256 where pk1 >= $((max_pk1+1)) and pk2 >= $((max_pk2+1)) and c1 >= $((max_c1+1))" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes-2: update none one_pk, >=, pk + non-pk" {
test_mutation "update one_pk set c2 = 256 where pk1 >= $((max_pk1+1)) and c1 >= $((max_c1+1))" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes-2: update none two_pk, >, pk + non-pk" {
test_mutation "update two_pk set c2 = 256 where pk1 > $max_pk1 and pk2 > $max_pk2 and c2 > $max_c2" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes-2: update none one_pk, >, pk + non-pk" {
test_mutation "update one_pk set c2 = 256 where pk1 > $max_pk1 and c2 > $max_c2" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes-2: delete partial two_pk, =, pk" {
test_mutation "delete from two_pk where pk1 = 2 and pk2 = 8" "two_pk" "$two_pk_one_row_deleted" "yes"
}
@test "index-on-writes-2: delete partial one_pk, =, pk" {
test_mutation "delete from one_pk where pk1 = 2" "one_pk" "$one_pk_one_row_deleted" "yes"
}
@test "index-on-writes-2: delete partial two_pk, =, non-pk" {
test_mutation "delete from two_pk where c1 = 129" "two_pk" "$two_pk_one_row_deleted"
}
@test "index-on-writes-2: delete partial one_pk, =, non-pk" {
test_mutation "delete from one_pk where c1 = 129" "one_pk" "$one_pk_one_row_deleted"
}
@test "index-on-writes-2: delete partial two_pk, =, pk + non-pk" {
test_mutation "delete from two_pk where pk1 = 2 and pk2 = 8 and c1 = 129" "two_pk" "$two_pk_one_row_deleted" "yes"
}
@test "index-on-writes-2: delete partial one_pk, =, pk + non-pk" {
test_mutation "delete from one_pk where pk1 = 2 and c1 = 129" "one_pk" "$one_pk_one_row_deleted" "yes"
}
@test "index-on-writes-2: delete partial two_pk, >, pk" {
test_mutation "delete from two_pk where pk1 > 1 and pk2 > 6" "two_pk" "$two_pk_two_row_deleted" "yes"
}
@test "index-on-writes-2: delete partial two_pk, >=, pk" {
test_mutation "delete from two_pk where pk1 >= 2 and pk2 >= 7" "two_pk" "$two_pk_two_row_deleted" "yes"
}
@test "index-on-writes-2: delete partial two_pk, <, pk" {
test_mutation "delete from two_pk where pk1 < 4 and pk2 < 9" "two_pk" "$two_pk_two_row_deleted" "yes"
}
@test "index-on-writes-2: delete partial two_pk, <=, pk" {
test_mutation "delete from two_pk where pk1 <= 3 and pk2 <= 8" "two_pk" "$two_pk_two_row_deleted" "yes"
}
@test "index-on-writes-2: delete partial two_pk, >, pk + non-pk" {
test_mutation "delete from two_pk where pk1 > 1 and pk2 > 6 and c1 = 129" "two_pk" "$two_pk_one_row_deleted" "yes"
}
@test "index-on-writes-2: delete partial two_pk, >=, pk + non-pk" {
test_mutation "delete from two_pk where pk1 >= 2 and pk2 >= 7 and c1 = 129" "two_pk" "$two_pk_one_row_deleted" "yes"
}
@test "index-on-writes-2: delete partial two_pk, <, pk + non-pk" {
test_mutation "delete from two_pk where pk1 < 4 and pk2 < 9 and c1 = 129" "two_pk" "$two_pk_one_row_deleted" "yes"
}
@test "index-on-writes-2: delete partial two_pk, <=, pk + non-pk" {
test_mutation "delete from two_pk where pk1 <= 3 and pk2 <= 8 and c1 = 129" "two_pk" "$two_pk_one_row_deleted" "yes"
}
@test "index-on-writes-2: update partial two_pk, =, pk" {
test_mutation "update two_pk set c2 = 256 where pk1 = 2 and pk2 = 8" "two_pk" "$two_pk_one_row_updated" "yes"
}
@test "index-on-writes-2: update partial one_pk, =, pk" {
test_mutation "update one_pk set c2 = 256 where pk1 = 2" "one_pk" "$one_pk_one_row_updated" "yes"
}
@test "index-on-writes-2: update partial two_pk, =, non-pk" {
test_mutation "update two_pk set c2 = 256 where c1 = 129" "two_pk" "$two_pk_one_row_updated"
}
@test "index-on-writes-2: update partial one_pk, =, non-pk" {
test_mutation "update one_pk set c2 = 256 where c1 = 129" "one_pk" "$one_pk_one_row_updated"
}
@test "index-on-writes-2: update partial two_pk, =, pk + non-pk" {
test_mutation "update two_pk set c2 = 256 where pk1 = 2 and pk2 = 8 and c1 = 129" "two_pk" "$two_pk_one_row_updated" "yes"
}
@test "index-on-writes-2: update partial one_pk, =, pk + non-pk" {
test_mutation "update one_pk set c2 = 256 where pk1 = 2 and c1 = 129" "one_pk" "$one_pk_one_row_updated" "yes"
}
@test "index-on-writes-2: update partial two_pk, >, pk" {
test_mutation "update two_pk set c2 = 256 where pk1 > 1 and pk2 > 6" "two_pk" "$two_pk_two_row_updated" "yes"
}
@test "index-on-writes-2: update partial two_pk, >=, pk" {
test_mutation "update two_pk set c2 = 256 where pk1 >= 2 and pk2 >= 7" "two_pk" "$two_pk_two_row_updated" "yes"
}
@test "index-on-writes-2: update partial two_pk, <, pk" {
test_mutation "update two_pk set c2 = 256 where pk1 < 4 and pk2 < 9" "two_pk" "$two_pk_two_row_updated" "yes"
}
@test "index-on-writes-2: update partial two_pk, <=, pk" {
test_mutation "update two_pk set c2 = 256 where pk1 <= 3 and pk2 <= 8" "two_pk" "$two_pk_two_row_updated" "yes"
}
@test "index-on-writes-2: update partial two_pk, >, pk + non-pk" {
test_mutation "update two_pk set c2 = 256 where pk1 > 1 and pk2 > 6 and c1 = 129" "two_pk" "$two_pk_one_row_updated" "yes"
}
@test "index-on-writes-2: update partial two_pk, >=, pk + non-pk" {
test_mutation "update two_pk set c2 = 256 where pk1 >= 2 and pk2 >= 7 and c1 = 129" "two_pk" "$two_pk_one_row_updated" "yes"
}
@test "index-on-writes-2: update partial two_pk, <, pk + non-pk" {
test_mutation "update two_pk set c2 = 256 where pk1 < 4 and pk2 < 9 and c1 = 129" "two_pk" "$two_pk_one_row_updated" "yes"
}
@test "index-on-writes-2: update partial two_pk, <=, pk + non-pk" {
test_mutation "update two_pk set c2 = 256 where pk1 <= 3 and pk2 <= 8 and c1 = 129" "two_pk" "$two_pk_one_row_updated" "yes"
}

View File

@@ -1,100 +1,6 @@
#!/usr/bin/env bats
load $BATS_TEST_DIRNAME/helper/common.bash
two_pk_header="pk1,pk2,c1,c2"
one_pk_header="pk1,c1,c2"
two_pk="$two_pk_header
1,9,128,32
2,8,129,31
3,7,130,30
4,6,131,29
5,5,132,28"
one_pk="$one_pk_header
1,128,32
2,129,31
3,130,30
4,131,29
5,132,28"
two_pk_all_updated="$two_pk_header
1,9,128,256
2,8,129,256
3,7,130,256
4,6,131,256
5,5,132,256"
one_pk_all_updated="$one_pk_header
1,128,256
2,129,256
3,130,256
4,131,256
5,132,256"
two_pk_one_row_deleted="$two_pk_header
1,9,128,32
3,7,130,30
4,6,131,29
5,5,132,28"
one_pk_one_row_deleted="$one_pk_header
1,128,32
3,130,30
4,131,29
5,132,28"
two_pk_two_row_deleted="$two_pk_header
1,9,128,32
4,6,131,29
5,5,132,28"
one_pk_two_row_deleted="$one_pk_header
1,128,32
4,131,29
5,132,28"
two_pk_one_row_updated="$two_pk_header
1,9,128,32
2,8,129,256
3,7,130,30
4,6,131,29
5,5,132,28"
one_pk_one_row_updated="$one_pk_header
1,128,32
2,129,256
3,130,30
4,131,29
5,132,28"
two_pk_two_row_updated="$two_pk_header
1,9,128,32
2,8,129,256
3,7,130,256
4,6,131,29
5,5,132,28"
one_pk_two_row_updated="$one_pk_header
1,128,32
2,129,256
3,130,256
4,131,29
5,132,28"
min_pk1=1
max_pk1=5
min_pk2=5
max_pk2=9
min_c1=128
max_c1=132
min_c2=28
max_c2=32
create_tables() {
cat <<EOF > two_pk.csv
$two_pk
EOF
cat <<EOF > one_pk.csv
$one_pk
EOF
dolt table import -c -pk pk1,pk2 --file-type=csv two_pk two_pk.csv
dolt table import -c -pk pk1 --file-type=csv one_pk one_pk.csv
}
load $BATS_TEST_DIRNAME/helper/index-on-writes-common.bash
setup() {
setup_common
@@ -106,29 +12,6 @@ teardown() {
teardown_common
}
test_mutation() {
dml="$1"
table="$2"
expected="$3"
uses_pk="$4"
dolt sql -q "$dml"
run dolt sql -q "select * from $table" -r csv
[ "$status" -eq "0" ]
[ "$output" == "$expected" ] || (echo $output && exit 1)
dolt reset --hard
dolt sql --batch -q "$dml ; $dml"
run dolt sql -q "select * from $table" -r csv
[ "$status" -eq "0" ]
[ "$output" == "$expected" ] || (echo $output && exit 1)
run dolt sql -q "explain $dml"
[ "$status" -eq "0" ]
if ! [ -z "$uses_pk" ]; then
[[ "$output" =~ "IndexedTableAccess" ]] || exit 1
else
if [[ "$output" =~ "IndexedTableAccess" ]]; then exit 1; fi
fi
}
@test "index-on-writes: delete all two_pk" {
test_mutation "delete from two_pk" "two_pk" "$two_pk_header"
}
@@ -384,355 +267,3 @@ test_mutation() {
@test "index-on-writes: update all one_pk, <=, pk + non-pk" {
test_mutation "update one_pk set c2 = 256 where pk1 <= $max_pk1 and c2 <= $max_c2" "one_pk" "$one_pk_all_updated" "yes"
}
@test "index-on-writes: delete none two_pk, =, pk" {
test_mutation "delete from two_pk where pk1 = 1024 and pk2 = 1024" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes: delete none one_pk, =, pk" {
test_mutation "delete from one_pk where pk1 = 1024" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes: delete none two_pk, <=, pk" {
test_mutation "delete from two_pk where pk1 <= $((min_pk1-1)) and pk2 <= $((min_pk2-1))" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes: delete none one_pk, <=, pk" {
test_mutation "delete from one_pk where pk1 <= $((min_pk1-1))" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes: delete none two_pk, <, pk" {
test_mutation "delete from two_pk where pk1 < $min_pk1 and pk2 < $min_pk2" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes: delete none one_pk, <, pk" {
test_mutation "delete from one_pk where pk1 < $min_pk1" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes: delete none two_pk, >=, pk" {
test_mutation "delete from two_pk where pk1 >= $((max_pk1+1)) and pk2 >= $((max_pk2+1))" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes: delete none one_pk, >=, pk" {
test_mutation "delete from one_pk where pk1 >= $((max_pk1+1))" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes: delete none two_pk, >, pk" {
test_mutation "delete from two_pk where pk1 > $max_pk1 and pk2 > $max_pk2" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes: delete none one_pk, >, pk" {
test_mutation "delete from one_pk where pk1 > $max_pk1" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes: delete none two_pk, =, non-pk" {
test_mutation "delete from two_pk where c1 = 1024" "two_pk" "$two_pk"
}
@test "index-on-writes: delete none one_pk, =, non-pk" {
test_mutation "delete from one_pk where c1 = 1024" "one_pk" "$one_pk"
}
@test "index-on-writes: delete none two_pk, <=, non-pk" {
test_mutation "delete from two_pk where c1 <= $((min_c1-1))" "two_pk" "$two_pk"
}
@test "index-on-writes: delete none one_pk, <=, non-pk" {
test_mutation "delete from one_pk where c1 <= $((min_c1-1))" "one_pk" "$one_pk"
}
@test "index-on-writes: delete none two_pk, <, non-pk" {
test_mutation "delete from two_pk where c1 < $min_c1" "two_pk" "$two_pk"
}
@test "index-on-writes: delete none one_pk, <, non-pk" {
test_mutation "delete from one_pk where c1 < $min_c1" "one_pk" "$one_pk"
}
@test "index-on-writes: delete none two_pk, >=, non-pk" {
test_mutation "delete from two_pk where c1 >= $((max_c1+1))" "two_pk" "$two_pk"
}
@test "index-on-writes: delete none one_pk, >=, non-pk" {
test_mutation "delete from one_pk where c1 >= $((max_c1+1))" "one_pk" "$one_pk"
}
@test "index-on-writes: delete none two_pk, >, non-pk" {
test_mutation "delete from two_pk where c2 > $max_c2" "two_pk" "$two_pk"
}
@test "index-on-writes: delete none one_pk, >, non-pk" {
test_mutation "delete from one_pk where c2 > $max_c2" "one_pk" "$one_pk"
}
@test "index-on-writes: delete none two_pk, =, pk + non-pk" {
test_mutation "delete from two_pk where pk1 = 1024 and pk2 = 1024 and c1 = 1024" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes: delete none one_pk, =, pk + non-pk" {
test_mutation "delete from one_pk where pk1 = 1024 and c1 = 1024" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes: delete none two_pk, <=, pk + non-pk" {
test_mutation "delete from two_pk where pk1 <= $((min_pk1-1)) and pk2 <= $((min_pk2-1)) and c1 <= $((min_c1-1))" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes: delete none one_pk, <=, pk + non-pk" {
test_mutation "delete from one_pk where pk1 <= $((min_pk1-1)) and c1 <= $((min_c1-1))" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes: delete none two_pk, <, pk + non-pk" {
test_mutation "delete from two_pk where pk1 < $min_pk1 and pk2 < $min_pk2 and c1 < $min_c1" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes: delete none one_pk, <, pk + non-pk" {
test_mutation "delete from one_pk where pk1 < $min_pk1 and c1 < $min_c1" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes: delete none two_pk, >=, pk + non-pk" {
test_mutation "delete from two_pk where pk1 >= $((max_pk1+1)) and pk2 >= $((max_pk2+1)) and c1 >= $((max_c1+1))" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes: delete none one_pk, >=, pk + non-pk" {
test_mutation "delete from one_pk where pk1 >= $((max_pk1+1)) and c1 >= $((max_c1+1))" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes: delete none two_pk, >, pk + non-pk" {
test_mutation "delete from two_pk where pk1 > $max_pk1 and pk2 > $max_pk2 and c2 > $max_c2" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes: delete none one_pk, >, pk + non-pk" {
test_mutation "delete from one_pk where pk1 > $max_pk1 and c2 > $max_c2" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes: update none two_pk, =, pk" {
test_mutation "update two_pk set c2 = 256 where pk1 = 1024 and pk2 = 1024" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes: update none one_pk, =, pk" {
test_mutation "update one_pk set c2 = 256 where pk1 = 1024" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes: update none two_pk, <=, pk" {
test_mutation "update two_pk set c2 = 256 where pk1 <= $((min_pk1-1)) and pk2 <= $((min_pk2-1))" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes: update none one_pk, <=, pk" {
test_mutation "update one_pk set c2 = 256 where pk1 <= $((min_pk1-1))" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes: update none two_pk, <, pk" {
test_mutation "update two_pk set c2 = 256 where pk1 < $min_pk1 and pk2 < $min_pk2" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes: update none one_pk, <, pk" {
test_mutation "update one_pk set c2 = 256 where pk1 < $min_pk1" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes: update none two_pk, >=, pk" {
test_mutation "update two_pk set c2 = 256 where pk1 >= $((max_pk1+1)) and pk2 >= $((max_pk2+1))" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes: update none one_pk, >=, pk" {
test_mutation "update one_pk set c2 = 256 where pk1 >= $((max_pk1+1))" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes: update none two_pk, >, pk" {
test_mutation "update two_pk set c2 = 256 where pk1 > $max_pk1 and pk2 > $max_pk2" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes: update none one_pk, >, pk" {
test_mutation "update one_pk set c2 = 256 where pk1 > $max_pk1" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes: update none two_pk, =, non-pk" {
test_mutation "update two_pk set c2 = 256 where c1 = 1024" "two_pk" "$two_pk"
}
@test "index-on-writes: update none one_pk, =, non-pk" {
test_mutation "update one_pk set c2 = 256 where c1 = 1024" "one_pk" "$one_pk"
}
@test "index-on-writes: update none two_pk, <=, non-pk" {
test_mutation "update two_pk set c2 = 256 where c1 <= $((min_c1-1))" "two_pk" "$two_pk"
}
@test "index-on-writes: update none one_pk, <=, non-pk" {
test_mutation "update one_pk set c2 = 256 where c1 <= $((min_c1-1))" "one_pk" "$one_pk"
}
@test "index-on-writes: update none two_pk, <, non-pk" {
test_mutation "update two_pk set c2 = 256 where c1 < $min_c1" "two_pk" "$two_pk"
}
@test "index-on-writes: update none one_pk, <, non-pk" {
test_mutation "update one_pk set c2 = 256 where c1 < $min_c1" "one_pk" "$one_pk"
}
@test "index-on-writes: update none two_pk, >=, non-pk" {
test_mutation "update two_pk set c2 = 256 where c1 >= $((max_c1+1))" "two_pk" "$two_pk"
}
@test "index-on-writes: update none one_pk, >=, non-pk" {
test_mutation "update one_pk set c2 = 256 where c1 >= $((max_c1+1))" "one_pk" "$one_pk"
}
@test "index-on-writes: update none two_pk, >, non-pk" {
test_mutation "update two_pk set c2 = 256 where c2 > $max_c2" "two_pk" "$two_pk"
}
@test "index-on-writes: update none one_pk, >, non-pk" {
test_mutation "update one_pk set c2 = 256 where c2 > $max_c2" "one_pk" "$one_pk"
}
@test "index-on-writes: update none two_pk, =, pk + non-pk" {
test_mutation "update two_pk set c2 = 256 where pk1 = 1024 and pk2 = 1024 and c1 = 1024" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes: update none one_pk, =, pk + non-pk" {
test_mutation "update one_pk set c2 = 256 where pk1 = 1024 and c1 = 1024" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes: update none two_pk, <=, pk + non-pk" {
test_mutation "update two_pk set c2 = 256 where pk1 <= $((min_pk1-1)) and pk2 <= $((min_pk2-1)) and c1 <= $((min_c1-1))" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes: update none one_pk, <=, pk + non-pk" {
test_mutation "update one_pk set c2 = 256 where pk1 <= $((min_pk1-1)) and c1 <= $((min_c1-1))" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes: update none two_pk, <, pk + non-pk" {
test_mutation "update two_pk set c2 = 256 where pk1 < $min_pk1 and pk2 < $min_pk2 and c1 < $min_c1" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes: update none one_pk, <, pk + non-pk" {
test_mutation "update one_pk set c2 = 256 where pk1 < $min_pk1 and c1 < $min_c1" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes: update none two_pk, >=, pk + non-pk" {
test_mutation "update two_pk set c2 = 256 where pk1 >= $((max_pk1+1)) and pk2 >= $((max_pk2+1)) and c1 >= $((max_c1+1))" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes: update none one_pk, >=, pk + non-pk" {
test_mutation "update one_pk set c2 = 256 where pk1 >= $((max_pk1+1)) and c1 >= $((max_c1+1))" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes: update none two_pk, >, pk + non-pk" {
test_mutation "update two_pk set c2 = 256 where pk1 > $max_pk1 and pk2 > $max_pk2 and c2 > $max_c2" "two_pk" "$two_pk" "yes"
}
@test "index-on-writes: update none one_pk, >, pk + non-pk" {
test_mutation "update one_pk set c2 = 256 where pk1 > $max_pk1 and c2 > $max_c2" "one_pk" "$one_pk" "yes"
}
@test "index-on-writes: delete partial two_pk, =, pk" {
test_mutation "delete from two_pk where pk1 = 2 and pk2 = 8" "two_pk" "$two_pk_one_row_deleted" "yes"
}
@test "index-on-writes: delete partial one_pk, =, pk" {
test_mutation "delete from one_pk where pk1 = 2" "one_pk" "$one_pk_one_row_deleted" "yes"
}
@test "index-on-writes: delete partial two_pk, =, non-pk" {
test_mutation "delete from two_pk where c1 = 129" "two_pk" "$two_pk_one_row_deleted"
}
@test "index-on-writes: delete partial one_pk, =, non-pk" {
test_mutation "delete from one_pk where c1 = 129" "one_pk" "$one_pk_one_row_deleted"
}
@test "index-on-writes: delete partial two_pk, =, pk + non-pk" {
test_mutation "delete from two_pk where pk1 = 2 and pk2 = 8 and c1 = 129" "two_pk" "$two_pk_one_row_deleted" "yes"
}
@test "index-on-writes: delete partial one_pk, =, pk + non-pk" {
test_mutation "delete from one_pk where pk1 = 2 and c1 = 129" "one_pk" "$one_pk_one_row_deleted" "yes"
}
@test "index-on-writes: delete partial two_pk, >, pk" {
test_mutation "delete from two_pk where pk1 > 1 and pk2 > 6" "two_pk" "$two_pk_two_row_deleted" "yes"
}
@test "index-on-writes: delete partial two_pk, >=, pk" {
test_mutation "delete from two_pk where pk1 >= 2 and pk2 >= 7" "two_pk" "$two_pk_two_row_deleted" "yes"
}
@test "index-on-writes: delete partial two_pk, <, pk" {
test_mutation "delete from two_pk where pk1 < 4 and pk2 < 9" "two_pk" "$two_pk_two_row_deleted" "yes"
}
@test "index-on-writes: delete partial two_pk, <=, pk" {
test_mutation "delete from two_pk where pk1 <= 3 and pk2 <= 8" "two_pk" "$two_pk_two_row_deleted" "yes"
}
@test "index-on-writes: delete partial two_pk, >, pk + non-pk" {
test_mutation "delete from two_pk where pk1 > 1 and pk2 > 6 and c1 = 129" "two_pk" "$two_pk_one_row_deleted" "yes"
}
@test "index-on-writes: delete partial two_pk, >=, pk + non-pk" {
test_mutation "delete from two_pk where pk1 >= 2 and pk2 >= 7 and c1 = 129" "two_pk" "$two_pk_one_row_deleted" "yes"
}
@test "index-on-writes: delete partial two_pk, <, pk + non-pk" {
test_mutation "delete from two_pk where pk1 < 4 and pk2 < 9 and c1 = 129" "two_pk" "$two_pk_one_row_deleted" "yes"
}
@test "index-on-writes: delete partial two_pk, <=, pk + non-pk" {
test_mutation "delete from two_pk where pk1 <= 3 and pk2 <= 8 and c1 = 129" "two_pk" "$two_pk_one_row_deleted" "yes"
}
@test "index-on-writes: update partial two_pk, =, pk" {
test_mutation "update two_pk set c2 = 256 where pk1 = 2 and pk2 = 8" "two_pk" "$two_pk_one_row_updated" "yes"
}
@test "index-on-writes: update partial one_pk, =, pk" {
test_mutation "update one_pk set c2 = 256 where pk1 = 2" "one_pk" "$one_pk_one_row_updated" "yes"
}
@test "index-on-writes: update partial two_pk, =, non-pk" {
test_mutation "update two_pk set c2 = 256 where c1 = 129" "two_pk" "$two_pk_one_row_updated"
}
@test "index-on-writes: update partial one_pk, =, non-pk" {
test_mutation "update one_pk set c2 = 256 where c1 = 129" "one_pk" "$one_pk_one_row_updated"
}
@test "index-on-writes: update partial two_pk, =, pk + non-pk" {
test_mutation "update two_pk set c2 = 256 where pk1 = 2 and pk2 = 8 and c1 = 129" "two_pk" "$two_pk_one_row_updated" "yes"
}
@test "index-on-writes: update partial one_pk, =, pk + non-pk" {
test_mutation "update one_pk set c2 = 256 where pk1 = 2 and c1 = 129" "one_pk" "$one_pk_one_row_updated" "yes"
}
@test "index-on-writes: update partial two_pk, >, pk" {
test_mutation "update two_pk set c2 = 256 where pk1 > 1 and pk2 > 6" "two_pk" "$two_pk_two_row_updated" "yes"
}
@test "index-on-writes: update partial two_pk, >=, pk" {
test_mutation "update two_pk set c2 = 256 where pk1 >= 2 and pk2 >= 7" "two_pk" "$two_pk_two_row_updated" "yes"
}
@test "index-on-writes: update partial two_pk, <, pk" {
test_mutation "update two_pk set c2 = 256 where pk1 < 4 and pk2 < 9" "two_pk" "$two_pk_two_row_updated" "yes"
}
@test "index-on-writes: update partial two_pk, <=, pk" {
test_mutation "update two_pk set c2 = 256 where pk1 <= 3 and pk2 <= 8" "two_pk" "$two_pk_two_row_updated" "yes"
}
@test "index-on-writes: update partial two_pk, >, pk + non-pk" {
test_mutation "update two_pk set c2 = 256 where pk1 > 1 and pk2 > 6 and c1 = 129" "two_pk" "$two_pk_one_row_updated" "yes"
}
@test "index-on-writes: update partial two_pk, >=, pk + non-pk" {
test_mutation "update two_pk set c2 = 256 where pk1 >= 2 and pk2 >= 7 and c1 = 129" "two_pk" "$two_pk_one_row_updated" "yes"
}
@test "index-on-writes: update partial two_pk, <, pk + non-pk" {
test_mutation "update two_pk set c2 = 256 where pk1 < 4 and pk2 < 9 and c1 = 129" "two_pk" "$two_pk_one_row_updated" "yes"
}
@test "index-on-writes: update partial two_pk, <=, pk + non-pk" {
test_mutation "update two_pk set c2 = 256 where pk1 <= 3 and pk2 <= 8 and c1 = 129" "two_pk" "$two_pk_one_row_updated" "yes"
}