From 9b4b805268fc53a1b7d9fcaec0860dca5e31d58c Mon Sep 17 00:00:00 2001 From: Tan Yong Zhi Date: Sun, 21 Aug 2022 13:21:18 +0800 Subject: [PATCH] Fix more failing bats tests --- integration-tests/bats/checkout.bats | 2 ++ integration-tests/bats/conflict-cat.bats | 3 +++ integration-tests/bats/diff.bats | 9 +++++++++ integration-tests/bats/export-tables.bats | 5 +++++ integration-tests/bats/foreign-keys-invert-pk.bats | 1 + integration-tests/bats/import-update-tables.bats | 1 + integration-tests/bats/index.bats | 1 + integration-tests/bats/log.bats | 4 ++++ integration-tests/bats/merge.bats | 7 +++++++ integration-tests/bats/multiple-tables.bats | 1 + integration-tests/bats/primary-key-changes.bats | 10 ++++++++++ integration-tests/bats/remotes-sql-server.bats | 1 + integration-tests/bats/remotes.bats | 9 +++++++++ integration-tests/bats/replace.bats | 1 + integration-tests/bats/replication.bats | 11 +++++++++++ integration-tests/bats/schema-changes.bats | 2 ++ integration-tests/bats/sql-clean.bats | 1 + integration-tests/bats/sql-fetch.bats | 3 +++ integration-tests/bats/sql-merge.bats | 13 +++++++++++++ integration-tests/bats/sql-pull.bats | 3 +++ integration-tests/bats/sql-push.bats | 3 +++ integration-tests/bats/sql-reset.bats | 1 + integration-tests/bats/sql-server.bats | 4 ++++ integration-tests/bats/status.bats | 10 ++++++++++ integration-tests/bats/system-tables.bats | 2 ++ 25 files changed, 108 insertions(+) diff --git a/integration-tests/bats/checkout.bats b/integration-tests/bats/checkout.bats index e6529bd1ed..b92bb88a7f 100755 --- a/integration-tests/bats/checkout.bats +++ b/integration-tests/bats/checkout.bats @@ -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 diff --git a/integration-tests/bats/conflict-cat.bats b/integration-tests/bats/conflict-cat.bats index 56b021609c..6f9330b133 100644 --- a/integration-tests/bats/conflict-cat.bats +++ b/integration-tests/bats/conflict-cat.bats @@ -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 diff --git a/integration-tests/bats/diff.bats b/integration-tests/bats/diff.bats index 9cab858053..946687a5a2 100644 --- a/integration-tests/bats/diff.bats +++ b/integration-tests/bats/diff.bats @@ -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 <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 diff --git a/integration-tests/bats/sql-merge.bats b/integration-tests/bats/sql-merge.bats index 3ddfbd858e..ab675e7d10 100644 --- a/integration-tests/bats/sql-merge.bats +++ b/integration-tests/bats/sql-merge.bats @@ -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 diff --git a/integration-tests/bats/sql-pull.bats b/integration-tests/bats/sql-pull.bats index 649e03f0ba..f7690442aa 100644 --- a/integration-tests/bats/sql-pull.bats +++ b/integration-tests/bats/sql-pull.bats @@ -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 diff --git a/integration-tests/bats/sql-push.bats b/integration-tests/bats/sql-push.bats index 5b772e5f3c..47bd94f482 100644 --- a/integration-tests/bats/sql-push.bats +++ b/integration-tests/bats/sql-push.bats @@ -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 diff --git a/integration-tests/bats/sql-reset.bats b/integration-tests/bats/sql-reset.bats index 51d5e606e7..0ca97aa389 100644 --- a/integration-tests/bats/sql-reset.bats +++ b/integration-tests/bats/sql-reset.bats @@ -10,6 +10,7 @@ CREATE TABLE test ( ); SQL + dolt add . dolt commit -a -m "Add a table" } diff --git a/integration-tests/bats/sql-server.bats b/integration-tests/bats/sql-server.bats index 186cc857db..c98aedd338 100644 --- a/integration-tests/bats/sql-server.bats +++ b/integration-tests/bats/sql-server.bats @@ -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 .. diff --git a/integration-tests/bats/status.bats b/integration-tests/bats/status.bats index 8f5fc2cc27..c805e659a6 100644 --- a/integration-tests/bats/status.bats +++ b/integration-tests/bats/status.bats @@ -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" diff --git a/integration-tests/bats/system-tables.bats b/integration-tests/bats/system-tables.bats index 4e4c55dba8..fa20cd40a5 100644 --- a/integration-tests/bats/system-tables.bats +++ b/integration-tests/bats/system-tables.bats @@ -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"