-
-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DO NOT SUBMIT test that perf test fails on old commit
- Loading branch information
Showing
1 changed file
with
157 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
#!/usr/bin/env bats | ||
load $BATS_TEST_DIRNAME/helper/common.bash | ||
|
||
setup_file() { | ||
BATS_TEST_TIMEOUT=200 | ||
run rm -rf $BATS_TMPDIR/dolt-repo-perf | ||
setup_common | ||
|
||
dolt checkout -b full | ||
|
||
dolt sql -q 'create table t (pk int primary key, c0 text default "1", c3 text default "2", c4 text default "3", c5 text default "4", c6 text default "5", c7 text default "6");' | ||
dolt commit -Am "new table t" | ||
|
||
echo "insert into t(pk) values" > import.sql | ||
for i in {1..100000} | ||
do | ||
echo " ($i)," >> import.sql | ||
done | ||
echo " (104857);" >> import.sql | ||
|
||
dolt sql < import.sql | ||
|
||
dolt add . | ||
dolt commit -m "Add all rows" | ||
|
||
cd .. | ||
mv $BATS_TMPDIR/dolt-repo-$$/ $BATS_TMPDIR/dolt-repo-perf | ||
} | ||
|
||
setup() { | ||
cd $BATS_TMPDIR/dolt-repo-perf | ||
dolt reset --hard HEAD | ||
dolt checkout full | ||
# Remove all branches except for the currently checked out branch. | ||
dolt branch | cut -w -f 2 | run xargs -L 1 dolt branch -D | ||
} | ||
|
||
@test "performance: merge with no schema change and no conflict" { | ||
pwd | ||
ls -al | ||
dolt checkout full | ||
dolt checkout -b mod2 | ||
dolt reset --soft HEAD^ | ||
|
||
dolt sql -q "delete from t where pk % 2 = 0" | ||
|
||
dolt add . | ||
dolt commit -m "Add mod2 rows" | ||
|
||
dolt checkout full | ||
dolt checkout -b mod3 | ||
dolt reset --soft HEAD^ | ||
|
||
dolt sql -q "delete from t where pk % 3 = 0" | ||
|
||
dolt add . | ||
dolt commit -m "Add mod3 rows" | ||
|
||
run dolt merge mod2 | ||
log_status_eq 0 | ||
} | ||
|
||
@test "performance: merge with no schema change and conflict" { | ||
pwd | ||
ls -al | ||
dolt checkout full | ||
dolt checkout -b mod2 | ||
dolt reset --soft HEAD^ | ||
|
||
dolt sql -q "delete from t where pk % 2 = 0" | ||
|
||
dolt add . | ||
dolt commit -m "Add mod2 rows" | ||
|
||
dolt checkout full | ||
dolt checkout -b mod3 | ||
dolt reset --soft HEAD^ | ||
|
||
dolt sql -q "delete from t where pk % 3 = 0" | ||
dolt sql -q 'update t set c0 = "conflict" where pk = 91' | ||
|
||
dolt add . | ||
dolt commit -m "Add mod3 rows" | ||
|
||
run dolt merge mod2 | ||
log_status_eq 1 | ||
[[ "$output" =~ "Merge conflict in t" ]] || false | ||
|
||
dolt conflicts resolve --ours t | ||
BATS_TEST_TIMEOUT=1 | ||
} | ||
|
||
|
||
@test "performance: merge with schema change and no conflict" { | ||
dolt checkout full | ||
dolt checkout -b mod2 | ||
dolt reset --soft HEAD^ | ||
|
||
dolt sql -q "delete from t where pk % 2 = 0" | ||
|
||
dolt add . | ||
dolt commit -m "Add mod2 rows" | ||
|
||
dolt sql -q "alter table t add column c1 int default 1" | ||
dolt add . | ||
dolt commit -m "Add column c1" | ||
|
||
dolt checkout full | ||
dolt checkout -b mod3 | ||
dolt reset --soft HEAD^ | ||
|
||
dolt sql -q "delete from t where pk % 3 = 0" | ||
|
||
dolt add . | ||
dolt commit -m "Add mod3 rows" | ||
|
||
dolt sql -q "alter table t add column c2 int default 2" | ||
dolt add . | ||
dolt commit -m "Add column c2" | ||
|
||
run dolt merge mod2 | ||
log_status_eq 0 | ||
} | ||
|
||
@test "performance: merge with schema change and conflict" { | ||
dolt checkout full | ||
dolt checkout -b mod2 | ||
dolt reset --soft HEAD^ | ||
|
||
dolt sql -q "delete from t where pk % 2 = 0" | ||
|
||
dolt add . | ||
dolt commit -m "Add mod2 rows" | ||
|
||
dolt sql -q "alter table t add column c1 int default 1" | ||
dolt add . | ||
dolt commit -m "Add column c1" | ||
|
||
dolt checkout full | ||
dolt checkout -b mod3 | ||
dolt reset --soft HEAD^ | ||
|
||
dolt sql -q "delete from t where pk % 3 = 0" | ||
dolt sql -q 'update t set c0 = "conflict" where pk = 91' | ||
|
||
dolt add . | ||
dolt commit -m "Add mod3 rows" | ||
|
||
dolt sql -q "alter table t add column c2 int default 2" | ||
dolt add . | ||
dolt commit -m "Add column c2" | ||
|
||
run dolt merge mod2 | ||
log_status_eq 1 | ||
|
||
dolt conflicts resolve --ours t | ||
} |