Fix more failing bats tests

This commit is contained in:
Tan Yong Zhi
2022-08-21 13:21:18 +08:00
parent 7dd5d6b4d6
commit 9b4b805268
25 changed files with 108 additions and 0 deletions

View File

@@ -15,6 +15,7 @@ teardown() {
create table test(a int primary key);
insert into test values (1);
SQL
dolt add .
dolt commit -am "Initial table with one row"
dolt branch feature
@@ -59,6 +60,7 @@ create table test(a int primary key);
insert into test values (1);
SQL
dolt add .
dolt commit -am "Initial table with one row"
dolt branch feature

View File

@@ -16,6 +16,7 @@ INSERT INTO t VALUES (1, 1);
INSERT INTO t VALUES (2, 2);
INSERT INTO t VALUES (3, 3);
SQL
dolt add .
dolt commit -am 'create table with rows'
dolt checkout -b other
@@ -55,6 +56,7 @@ SQL
@test "conflict-cat: conflicts should show using the union-schema (new schema on right)" {
dolt sql -q "CREATE TABLE t (a INT PRIMARY KEY, b INT);"
dolt add .
dolt commit -am "base"
dolt checkout -b right
@@ -78,6 +80,7 @@ SQL
@test "conflict-cat: conflicts should show using the union-schema (new schema on left)" {
dolt sql -q "CREATE TABLE t (a INT PRIMARY KEY, b INT);"
dolt add .
dolt commit -am "base"
dolt checkout -b right

View File

@@ -77,6 +77,7 @@ create table test (pk int primary key, c1 int, c2 int);
insert into test values (1,2,3);
insert into test values (4,5,6);
SQL
dolt add .
dolt commit -am "First commit"
dolt sql <<SQL
@@ -153,6 +154,7 @@ EOF
}
@test "diff: data diff only" {
dolt add .
dolt commit -am "First commit"
dolt sql -q "insert into test (pk) values (10);"
@@ -166,6 +168,7 @@ EOF
}
@test "diff: schema changes only" {
dolt add .
dolt commit -am "First commit"
dolt sql <<SQL
@@ -541,6 +544,7 @@ SQL
@test "diff: diff summary incorrect primary key set change regression test" {
dolt sql -q "create table testdrop (col1 varchar(20), id int primary key, col2 varchar(20))"
dolt add .
dolt sql -q "insert into testdrop values ('test1', 1, 'test2')"
dolt commit -am "Add testdrop table"
@@ -682,6 +686,7 @@ SQL
@test "diff: sql update queries only show changed columns" {
dolt sql -q "create table t(pk int primary key, val1 int, val2 int)"
dolt add .
dolt sql -q "INSERT INTO t VALUES (1, 1, 1)"
dolt commit -am "cm1"
@@ -718,6 +723,7 @@ SQL
@test "diff: keyless sql diffs" {
dolt sql -q "create table t(pk int, val int)"
dolt add .
dolt commit -am "cm1"
dolt sql -q "INSERT INTO t values (1, 1)"
@@ -780,6 +786,7 @@ SQL
create table t(pk int, val int);
insert into t values (1,1);
SQL
dolt add .
dolt commit -am "creating table"
dolt sql -q "alter table t add primary key (pk)"
@@ -816,6 +823,7 @@ SQL
@test "diff: created and dropped tables include schema and data changes in results" {
dolt sql -q "create table a(pk int primary key)"
dolt add .
dolt commit -am "creating table a"
dolt sql -q "insert into a values (1), (2)"
dolt commit -am "inserting data into table a"
@@ -840,6 +848,7 @@ SQL
@test "diff: large diff does not drop rows" {
dolt sql -q "create table t(pk int primary key, val int)"
dolt add .
VALUES=""
for i in {1..1000}

View File

@@ -111,6 +111,7 @@ if rows[2] != "9,8,7,6,5,4".split(","):
# string columns
dolt sql -q "create table strings (a varchar(10) primary key, b char(10))"
dolt sql -q "insert into strings values ('abc', '123'), ('def', '456')"
dolt add .
dolt commit -am "Checkpoint"
dolt table export strings -f export.sql
@@ -122,6 +123,7 @@ if rows[2] != "9,8,7,6,5,4".split(","):
# enum columns
dolt sql -q "create table enums (a varchar(10) primary key, b enum('one','two','three'))"
dolt sql -q "insert into enums values ('abc', 'one'), ('def', 'two')"
dolt add .
dolt commit -am "Checkpoint"
dolt table export enums -f export.sql
@@ -137,6 +139,7 @@ create table sets (a varchar(10) primary key, b set('one','two','three'));
insert into sets values ('abc', 'one,two'), ('def', 'two,three');
SQL
dolt add .
dolt commit -am "Checkpoint"
dolt table export sets -f export.sql
@@ -148,6 +151,7 @@ SQL
# json columns
dolt sql -q "create table json_vals (a varchar(10) primary key, b json)"
dolt add .
dolt sql <<SQL
insert into json_vals values ('abc', '{"key": "value"}'), ('def', '[{"a": "b"},{"conjuction": "it\'s"}]');
SQL
@@ -192,6 +196,7 @@ alter table one add foreign key (b) references two (c);
alter table two add foreign key (d) references one (a);
SQL
dolt add .
dolt commit -am "Added tables and data"
dolt table export one one.sql

View File

@@ -10,6 +10,7 @@ create table b (x int, y int, primary key (y,x), foreign key (y) references a(y)
insert into a values (4,0), (3,1), (2,2);
insert into b values (2,1), (4,2), (3,0);
SQL
dolt add .
}
teardown() {

View File

@@ -344,6 +344,7 @@ DELIM
dolt sql < 1pk5col-ints-sch.sql
dolt table import -u --continue test 1pk5col-rpt-ints.csv
dolt add .
dolt commit -am "cm1"
run dolt table import -u --continue test 1pk5col-rpt-ints.csv

View File

@@ -18,6 +18,7 @@ CREATE TABLE twopk (
PRIMARY KEY(pk1, pk2)
);
SQL
dolt add .
}
teardown() {

View File

@@ -123,6 +123,7 @@ teardown() {
@test "log: Log on a table has basic functionality" {
dolt sql -q "create table test (pk int PRIMARY KEY)"
dolt add .
dolt commit -am "first commit"
run dolt log test
@@ -140,6 +141,7 @@ teardown() {
[[ ! "$output" =~ "Initialize data repository" ]] || false
dolt sql -q "create table test2 (pk int PRIMARY KEY)"
dolt add .
dolt commit -am "third commit"
# Validate we only look at the right commits
@@ -153,6 +155,7 @@ teardown() {
@test "log: Log on a table works with -n" {
dolt sql -q "create table test (pk int PRIMARY KEY)"
dolt add .
dolt commit -am "first commit"
run dolt log -n 1 test
@@ -168,6 +171,7 @@ teardown() {
[[ "$output" =~ "first commit" ]] || false
dolt sql -q "create table test2 (pk int PRIMARY KEY)"
dolt add .
dolt commit -am "third commit"
dolt sql -q "insert into test2 values (4)"

View File

@@ -448,6 +448,7 @@ CREATE TABLE test (
);
INSERT INTO test VALUES (1, 0, 0);
SQL
dolt add .
dolt commit -am "initial data"
dolt branch right
@@ -490,6 +491,7 @@ SQL
create table test3 (a int primary key);
INSERT INTO test3 VALUES (0), (1);
SQL
dolt add .
dolt commit -am "new table test3"
dolt checkout main
@@ -656,6 +658,7 @@ CREATE table child (pk int PRIMARY KEY, parent_fk int, FOREIGN KEY (parent_fk) R
CREATE table other (pk int);
INSERT INTO parent VALUES (1, 1);
SQL
dolt add .
dolt commit -am "create table with data";
dolt branch right
dolt sql -q "DELETE FROM parent where pk = 1;"
@@ -686,6 +689,7 @@ CREATE table parent (pk int PRIMARY KEY, col1 int);
CREATE table child (pk int PRIMARY KEY, parent_fk int, FOREIGN KEY (parent_fk) REFERENCES parent(pk));
INSERT INTO parent VALUES (1, 1), (2, 1);
SQL
dolt add .
dolt commit -am "create table with data";
dolt branch other
dolt branch other2
@@ -745,6 +749,7 @@ CREATE table parent (pk int PRIMARY KEY, col1 int);
CREATE table child (pk int PRIMARY KEY, parent_fk int, FOREIGN KEY (parent_fk) REFERENCES parent(pk));
INSERT INTO parent VALUES (1, 1), (2, 1);
SQL
dolt add .
dolt commit -am "create table with data";
dolt branch other
dolt branch other2
@@ -832,6 +837,7 @@ SQL
dolt checkout main
dolt sql -q "ALTER TABLE test1 RENAME TO new_name"
dolt add .
dolt commit -am "rename test1"
run dolt merge merge_branch
@@ -842,6 +848,7 @@ SQL
@test "merge: ourRoot modifies, theirRoot renames" {
dolt checkout -b merge_branch
dolt sql -q "ALTER TABLE test1 RENAME TO new_name"
dolt add .
dolt commit -am "rename test1"
dolt checkout main

View File

@@ -100,6 +100,7 @@ teardown() {
}
@test "multiple-tables: dolt commit with -a flag adds all changes" {
dolt add .
dolt sql -q "insert into test1 values (0, 1, 2, 3, 4, 5)"
dolt sql -q "insert into test2 values (0, 1, 2, 3, 4, 5)"
run dolt commit -a -m "Commit1"

View File

@@ -220,6 +220,7 @@ teardown() {
@test "primary-key-changes: ff merge with primary key schema differences correctly works" {
dolt sql -q "create table t(pk int PRIMARY KEY, val1 int, val2 int)"
dolt add .
dolt sql -q "INSERT INTO t values (1,1,1)"
dolt commit -am "cm1"
@@ -238,6 +239,7 @@ teardown() {
@test "primary-key-changes: merge on branch with primary key dropped throws an error" {
dolt sql -q "create table t(pk int PRIMARY KEY, val1 int, val2 int)"
dolt add .
dolt sql -q "INSERT INTO t values (1,1,1)"
dolt commit -am "cm1"
dolt checkout -b test
@@ -264,6 +266,7 @@ teardown() {
@test "primary-key-changes: merge on branch with primary key added throws an error" {
dolt sql -q "create table t(pk int, val1 int, val2 int)"
dolt add .
dolt sql -q "INSERT INTO t values (1,1,1)"
dolt commit -am "cm1"
dolt checkout -b test
@@ -290,6 +293,7 @@ teardown() {
@test "primary-key-changes: diff on primary key schema change shows schema level diff but does not show row level diff" {
dolt sql -q "CREATE TABLE t (pk int PRIMARY KEY, val int)"
dolt add .
dolt sql -q "INSERT INTO t VALUES (1, 1)"
dolt commit -am "cm1"
@@ -312,6 +316,7 @@ teardown() {
@test "primary-key-changes: diff on composite schema" {
dolt sql -q "CREATE TABLE t (pk int PRIMARY KEY, val int)"
dolt add .
dolt sql -q "INSERT INTO t VALUES (1, 1)"
dolt commit -am "cm1"
@@ -413,6 +418,7 @@ SQL
@test "primary-key-changes: test whether dolt_commit_diff correctly returns a diff whether there is or isn't a schema change" {
dolt sql -q "CREATE TABLE t (pk int PRIMARY KEY, val int)"
dolt add .
dolt commit -am "cm0"
dolt sql -q "INSERT INTO t VALUES (1, 1)"
@@ -455,6 +461,7 @@ SQL
@test "primary-key-changes: dolt constraints verify works gracefully with schema violations" {
dolt sql -q "CREATE table t (pk int primary key, val int)"
dolt add .
dolt commit -am "cm1"
dolt sql -q "alter table t drop primary key"
@@ -469,6 +476,7 @@ SQL
@test "primary-key-changes: add/drop primary key in different order" {
dolt sql -q "CREATE table t (pk int primary key, val int)"
dolt add .
dolt commit -am "cm1"
dolt sql -q "alter table t drop primary key"
@@ -494,6 +502,7 @@ SQL
@test "primary-key-changes: same primary key set in different order is detected and blocked on merge" {
dolt sql -q "CREATE table t (pk int, val int, primary key (pk, val))"
dolt add .
dolt commit -am "cm1"
dolt checkout -b test
@@ -553,6 +562,7 @@ SQL
@test "primary-key-changes: column with duplicates throws an error when added as pk" {
dolt sql -q "CREATE table t (pk int, val int)"
dolt add .
dolt sql -q "INSERT INTO t VALUES (1,1),(2,1)"
dolt commit -am "cm1"

View File

@@ -25,6 +25,7 @@ setup() {
dolt remote add remote1 file://../rem1
cd ../repo1
dolt sql -q "create table test (pk int primary key)"
dolt add .
dolt sql -q "insert into test values (0),(1),(2)"
cd ..

View File

@@ -186,6 +186,7 @@ teardown() {
dolt init
dolt remote add origin file://../remote
dolt sql -q "CREATE TABLE a (pk int)"
dolt add .
dolt commit -am "add table a"
dolt push --set-upstream origin main
dolt checkout -b other
@@ -226,6 +227,7 @@ teardown() {
dolt init
dolt remote add test-remote http://localhost:50051/test-org/test-repo
dolt sql -q "CREATE TABLE test (pk INT)"
dolt add .
dolt commit -am "main commit"
dolt push test-remote main
run dolt branch -a
@@ -276,6 +278,7 @@ SQL
dolt init
dolt remote add origin file://../remote
dolt sql -q "CREATE TABLE a (pk int)"
dolt add .
dolt commit -am "add table a"
dolt push --set-upstream origin main
dolt checkout -b other
@@ -365,6 +368,7 @@ SQL
dolt remote add test-remote http://localhost:50051/test-org/test-repo
dolt checkout -b test-branch
dolt sql -q "create table t1(c0 varchar(100));"
dolt add .
dolt commit -am "adding table t1"
run dolt push test-remote test-branch
[ "$status" -eq 0 ]
@@ -1829,6 +1833,7 @@ setup_ref_test() {
cd repo2
dolt checkout -b other
dolt sql -q "create table t (i int)"
dolt add .
dolt commit -am "adding table from other"
dolt push origin other
@@ -1893,6 +1898,7 @@ SQL
dolt checkout main
dolt sql -q "CREATE TABLE a(pk int primary key)"
dolt add .
dolt commit -am "add table a"
dolt push
@@ -1917,6 +1923,7 @@ SQL
cd repo2
dolt sql -q "CREATE TABLE test (id int primary key)"
dolt add .
dolt commit -am "create table"
run dolt push
[ "$status" -eq "0" ]
@@ -2021,6 +2028,7 @@ SQL
dolt init
dolt remote add origin file://../remote
dolt sql -q "CREATE TABLE a (pk int)"
dolt add .
dolt commit -am "add table a"
dolt push --set-upstream origin main
dolt checkout -b other
@@ -2135,6 +2143,7 @@ create table new_table(a int primary key);
insert into new_table values (1), (2);
SQL
cd repo2
dolt add .
dolt commit -am "a commit for main from repo2"
dolt push origin main
cd ..

View File

@@ -5,6 +5,7 @@ setup() {
setup_common
dolt sql -q "create table t1 (a bigint primary key, b bigint)"
dolt add .
dolt sql -q "insert into t1 values (0,0), (1,1)"
dolt commit -am "Init"
dolt sql -q "drop table t1"

View File

@@ -26,6 +26,7 @@ teardown() {
@test "replication: default no replication" {
cd repo1
dolt sql -q "create table t1 (a int primary key)"
dolt add .
dolt commit -am "cm"
[ ! -d "../bac1/.dolt" ] || false
@@ -36,6 +37,7 @@ teardown() {
cd repo1
dolt config --local --add sqlserver.global.dolt_replicate_to_remote backup1
dolt sql -q "create table t1 (a int primary key)"
dolt add .
dolt commit -am "cm"
cd ..
@@ -139,6 +141,7 @@ teardown() {
dolt clone file://./rem1 repo2
cd repo2
dolt sql -q "create table t1 (a int primary key)"
dolt add .
dolt commit -am "new commit"
dolt push origin main
@@ -235,6 +238,7 @@ teardown() {
cd repo2
dolt checkout -b new_feature
dolt sql -q "create table t1 (a int)"
dolt add .
dolt commit -am "cm"
dolt push origin new_feature
@@ -253,6 +257,7 @@ teardown() {
cd repo2
dolt checkout -b new_feature
dolt sql -q "create table t1 (a int)"
dolt add .
dolt commit -am "cm"
dolt push origin new_feature
@@ -271,10 +276,12 @@ teardown() {
cd repo2
dolt checkout -b new_feature
dolt sql -q "create table t1 (a int)"
dolt add .
dolt commit -am "cm"
dolt push origin new_feature
dolt checkout main
dolt sql -q "create table t2 (a int)"
dolt add .
dolt commit -am "cm"
dolt push origin main
@@ -390,6 +397,7 @@ teardown() {
dolt checkout feat
dolt sql -q "create table t1 (a int)"
dolt sql -q "create table t2 (a int)"
dolt add .
dolt commit -am "cm"
# remote1 has tables
dolt push remote1 feat
@@ -414,6 +422,7 @@ SQL
cd repo2
dolt checkout -b new_feature
dolt sql -q "create table t1 (a int)"
dolt add .
dolt commit -am "cm"
dolt push origin new_feature
@@ -520,6 +529,7 @@ SQL
cd repo2
dolt checkout -b feature-branch
dolt sql -q "create table t1 (a int primary key)"
dolt add .
dolt commit -am "new commit"
dolt push origin feature-branch
@@ -547,6 +557,7 @@ SQL
cd ../repo2
dolt checkout feature-branch
dolt sql -q "create table t1 (a int primary key)"
dolt add .
dolt commit -am "new commit"
dolt push origin feature-branch

View File

@@ -309,6 +309,7 @@ SQL
# Commit is important here because we are testing column reuse on
# drop / add, we want to be sure that we don't re-use any old
# values from before the column was dropped
dolt add .
dolt commit -am "Committing test table"
dolt sql -q "alter table test2 drop column v1"
@@ -336,6 +337,7 @@ CREATE TABLE test2(
insert into test2 values (1, 1, 1), (2, 2, 2);
SQL
dolt add .
# Commit is important here because we are testing column reuse on
# drop / add, we want to be sure that we don't re-use any old
# values from before the column was dropped

View File

@@ -10,6 +10,7 @@ CREATE TABLE test (
);
SQL
dolt add .
dolt commit -a -m "Add a table"
}

View File

@@ -22,6 +22,7 @@ setup() {
# table and comits only present on repo1, rem1 at start
cd $TMPDIRS/repo1
dolt sql -q "create table t1 (a int primary key, b int)"
dolt add .
dolt commit -am "First commit"
dolt sql -q "insert into t1 values (0,0)"
dolt commit -am "Second commit"
@@ -360,6 +361,7 @@ teardown() {
# reverse information flow for force fetch repo1->rem1->repo2
cd repo2
dolt sql -q "create table t2 (a int)"
dolt add .
dolt commit -am "forced commit"
dolt push --force origin main
@@ -385,6 +387,7 @@ teardown() {
# reverse information flow for force fetch repo1->rem1->repo2
cd repo2
dolt sql -q "create table t2 (a int)"
dolt add .
dolt commit -am "forced commit"
dolt push --force origin main

View File

@@ -11,6 +11,7 @@ CREATE TABLE test (
INSERT INTO test VALUES (0),(1),(2);
SQL
dolt add .
}
teardown() {
@@ -1375,6 +1376,7 @@ SQL
@test "sql-merge: adding and dropping primary keys any number of times not produce schema merge conflicts" {
dolt commit -am "commit all changes"
dolt sql -q "create table test_null (i int)"
dolt add .
dolt commit -am "initial"
dolt checkout -b b1
@@ -1395,6 +1397,7 @@ SQL
@test "sql-merge: identical schema changes with data changes merges correctly" {
dolt sql -q "create table t (i int primary key)"
dolt add .
dolt commit -am "initial commit"
dolt branch b1
dolt branch b2
@@ -1416,6 +1419,7 @@ SQL
# TODO: what happens when the data conflicts with new check?
@test "sql-merge: non-conflicting data and constraint changes are preserved" {
dolt sql -q "create table t (i int)"
dolt add .
dolt commit -am "initial commit"
dolt checkout -b other
@@ -1445,6 +1449,7 @@ SQL
@test "sql-merge: non-overlapping check constraints merge successfully" {
dolt sql -q "create table t (i int, j int)"
dolt add .
dolt commit -am "initial commit"
dolt checkout -b other
@@ -1472,6 +1477,7 @@ SQL
@test "sql-merge: different check constraints on same column throw conflict" {
dolt sql -q "create table t (i int)"
dolt add .
dolt commit -am "initial commit"
dolt checkout -b other
@@ -1496,6 +1502,7 @@ SQL
# TODO: what happens when the new data conflicts with modified check?
@test "sql-merge: non-conflicting constraint modification is preserved" {
dolt sql -q "create table t (i int)"
dolt add .
dolt sql -q "alter table t add constraint c check (i > 0)"
dolt commit -am "initial commit"
@@ -1531,6 +1538,7 @@ SQL
# TODO: expected behavior for dropping constraints?
@test "sql-merge: dropping constraint in one branch drops from both" {
dolt sql -q "create table t (i int)"
dolt add .
dolt sql -q "alter table t add constraint c check (i > 0)"
dolt commit -am "initial commit"
@@ -1564,6 +1572,7 @@ SQL
@test "sql-merge: dropping constraint on both branches merges successfully" {
dolt sql -q "create table t (i int)"
dolt add .
dolt sql -q "alter table t add constraint c check (i > 0)"
dolt commit -am "initial commit"
@@ -1591,6 +1600,7 @@ SQL
@test "sql-merge: dropping constraint in one branch and modifying same in other results in conflict" {
dolt sql -q "create table t (i int)"
dolt add .
dolt sql -q "alter table t add constraint c check (i > 0)"
dolt commit -am "initial commit"
@@ -1616,6 +1626,7 @@ SQL
@test "sql-merge: merging with not null and check constraints preserves both constraints" {
dolt sql -q "create table t (i int)"
dolt add .
dolt commit -am "initial commit"
dolt branch b1
@@ -1649,6 +1660,7 @@ SQL
@test "sql-merge: check constraint with name collision" {
dolt sql -q "create table t (i int)"
dolt add .
dolt commit -am "initial commit"
dolt branch b1
@@ -1678,6 +1690,7 @@ SQL
@test "sql-merge: check constraint for deleted column in another table" {
dolt sql -q "create table t (i int primary key, j int)"
dolt add .
dolt commit -am "initial commit"
dolt branch b1

View File

@@ -25,6 +25,7 @@ setup() {
# table and commits only present on repo1, rem1 at start
cd $TMPDIRS/repo1
dolt sql -q "create table t1 (a int primary key, b int)"
dolt add .
dolt commit -am "First commit"
dolt sql -q "insert into t1 values (0,0)"
dolt commit -am "Second commit"
@@ -424,6 +425,7 @@ teardown() {
dolt checkout feature
dolt sql -q "create table t2 (a int)"
dolt add .
dolt commit -am "feature commit"
dolt tag v3
dolt push origin v3
@@ -446,6 +448,7 @@ teardown() {
dolt checkout feature
dolt sql -q "create table t2 (a int)"
dolt add .
dolt commit -am "feature commit"
dolt tag v3
dolt push origin v3

View File

@@ -23,6 +23,7 @@ setup() {
# table and comits only present on repo1, rem1 at start
cd $TMPDIRS/repo1
dolt sql -q "create table t1 (a int primary key, b int)"
dolt add .
dolt commit -am "First commit"
dolt sql -q "insert into t1 values (0,0)"
dolt commit -am "Second commit"
@@ -189,6 +190,7 @@ teardown() {
@test "sql-push: dolt_push --force flag" {
cd repo2
dolt sql -q "create table t2 (a int)"
dolt add .
dolt commit -am "commit to override"
dolt push origin main
@@ -203,6 +205,7 @@ teardown() {
@test "sql-push: CALL dolt_push --force flag" {
cd repo2
dolt sql -q "create table t2 (a int)"
dolt add .
dolt commit -am "commit to override"
dolt push origin main

View File

@@ -10,6 +10,7 @@ CREATE TABLE test (
);
SQL
dolt add .
dolt commit -a -m "Add a table"
}

View File

@@ -838,6 +838,7 @@ SQL
cd repo1
dolt sql -q "create table test (pk int primary key)"
dolt add .
dolt commit -a -m "Created new table"
dolt sql -q "insert into test values (1), (2), (3)"
dolt commit -a -m "Inserted 3 values"
@@ -1428,6 +1429,7 @@ END""")
cd ../repo2
dolt sql -q "create table test (a int)"
dolt add .
dolt commit -am "new commit"
dolt push -u remote1 main
@@ -1456,6 +1458,7 @@ databases:
dolt sql -q "create table r1t_one (id1 int primary key, col1 varchar(20));"
dolt sql -q "insert into r1t_one values (1,'aaaa'), (2,'bbbb'), (3,'cccc');"
dolt sql -q "create table r1t_two (id2 int primary key, col2 varchar(20));"
dolt add .
dolt commit -am "create two tables"
cd ../repo2
@@ -1463,6 +1466,7 @@ databases:
dolt sql -q "create table r2t_two (id2 int primary key, col2 varchar(20));"
dolt sql -q "create table r2t_three (id3 int primary key, col3 varchar(20));"
dolt sql -q "insert into r2t_three values (4,'dddd'), (3,'gggg'), (2,'eeee'), (1,'ffff');"
dolt add .
dolt commit -am "create three tables"
cd ..

View File

@@ -218,6 +218,7 @@ SQL
@test "status: dolt reset hard with ~ works" {
dolt sql -q "CREATE TABLE test (pk int PRIMARY KEY);"
dolt add .
dolt commit -am "cm1"
dolt sql -q "INSERT INTO test values (1);"
@@ -261,6 +262,7 @@ SQL
@test "status: dolt reset soft with ~ works" {
dolt sql -q "CREATE TABLE test (pk int PRIMARY KEY);"
dolt add .
dolt commit -am "cm1"
dolt sql -q "INSERT INTO test values (1);"
@@ -306,6 +308,7 @@ CREATE TABLE one (
v2 BIGINT
);
SQL
dolt add .
dolt commit -am "added table"
dolt sql -q "rename table one to one_super"
@@ -316,18 +319,21 @@ SQL
@test "status: dolt reset works with commit hash ref" {
dolt sql -q "CREATE TABLE tb1 (pk int PRIMARY KEY);"
dolt sql -q "INSERT INTO tb1 values (1);"
dolt add .
dolt commit -am "cm1"
cm1=$(get_head_commit)
dolt sql -q "CREATE TABLE tb2 (pk int PRIMARY KEY);"
dolt sql -q "INSERT INTO tb2 values (11);"
dolt add .
dolt commit -am "cm2"
cm2=$(get_head_commit)
dolt sql -q "CREATE TABLE tb3 (pk int PRIMARY KEY);"
dolt sql -q "INSERT INTO tb3 values (11);"
dolt add .
dolt commit -am "cm3"
cm3=$(get_head_commit)
@@ -354,6 +360,7 @@ SQL
run dolt sql -q "SELECT COUNT(*) FROM dolt_log"
[[ "$output" =~ "3" ]] || false # includes init commit
dolt add .
dolt commit -am "commit 3"
# Do a soft reset to commit 1
@@ -372,6 +379,7 @@ SQL
@test "status: dolt reset works with branch ref" {
dolt sql -q "CREATE TABLE tbl(pk int);"
dolt add .
dolt sql -q "INSERT into tbl VALUES (1)"
dolt commit -am "cm1"
@@ -379,6 +387,7 @@ SQL
dolt checkout -b test
dolt sql -q "INSERT INTO tbl VALUES (2),(3)"
dolt sql -q "CREATE TABLE tbl2(pk int);"
dolt add .
dolt commit -am "test cm1"
# go back to main and merge
@@ -401,6 +410,7 @@ SQL
@test "status: dolt reset ref properly manages staged changes as well" {
dolt sql -q "CREATE TABLE tbl(pk int);"
dolt add .
dolt sql -q "INSERT into tbl VALUES (1)"
dolt commit -am "cm1"

View File

@@ -536,6 +536,7 @@ SQL
@test "system-tables: dolt diff includes changes from initial commit" {
dolt sql -q "CREATE TABLE test(pk int primary key, val int)"
dolt sql -q "INSERT INTO test VALUES (1,1)"
dolt add .
dolt commit -am "cm1"
dolt sql -q "INSERT INTO test VALUES (2,2)"
@@ -549,6 +550,7 @@ SQL
@test "system-tables: query dolt_tags" {
dolt sql -q "CREATE TABLE test(pk int primary key, val int)"
dolt add .
dolt sql -q "INSERT INTO test VALUES (1,1)"
dolt commit -am "cm1"
dolt tag v1 head -m "tag v1 from main"