From bc59893f6651855e1d204d9e03c8510fd47c8239 Mon Sep 17 00:00:00 2001 From: Daylon Wilkins Date: Fri, 19 Jul 2019 17:22:41 -0700 Subject: [PATCH] Changed bats tests on Windows to use WSL --- bats/1pk5col-ints.bats | 9 ++-- bats/1pk5col-strings.bats | 3 +- bats/1pksupportedtypes.bats | 3 +- bats/2pk5cols-ints.bats | 3 +- bats/advanced-sql.bats | 5 ++- bats/capital-letter-column-names.bats | 3 +- bats/conflict-detection.bats | 65 ++++++++++++++------------- bats/create-tables.bats | 51 ++++++++++----------- bats/git-dolt.bats | 5 +-- bats/helper/windows-compat.bash | 29 +++--------- bats/multiple-tables.bats | 9 ++-- bats/remotes.bats | 26 +++++------ bats/schema-changes.bats | 17 +++---- bats/sql-reserved-column-name.bats | 3 +- bats/sql-shell.bats | 8 ++-- 15 files changed, 117 insertions(+), 122 deletions(-) diff --git a/bats/1pk5col-ints.bats b/bats/1pk5col-ints.bats index 634714b2f1..58e81a4f4d 100755 --- a/bats/1pk5col-ints.bats +++ b/bats/1pk5col-ints.bats @@ -3,13 +3,14 @@ setup() { export PATH=$PATH:~/go/bin export NOMS_VERSION_NEXT=1 + load $BATS_TEST_DIRNAME/helper/windows-compat.bash cd $BATS_TMPDIR # Append the directory name with the pid of the calling process so # multiple tests can be run in parallel on the same machine mkdir "dolt-repo-$$" cd "dolt-repo-$$" dolt init - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test } teardown() { @@ -493,7 +494,7 @@ teardown() { } @test "import data from a csv file after table created" { - run dolt table import test -u $BATS_TEST_DIRNAME/helper/1pk5col-ints.csv + run dolt table import test -u `nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.csv` [ "$status" -eq 0 ] [[ "$output" =~ "Import completed successfully." ]] || false run dolt table select test @@ -503,7 +504,7 @@ teardown() { } @test "import data from a psv file after table created" { - run dolt table import test -u $BATS_TEST_DIRNAME/helper/1pk5col-ints.psv + run dolt table import test -u `nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.psv` [ "$status" -eq 0 ] [[ "$output" =~ "Import completed successfully." ]] || false run dolt table select test @@ -513,7 +514,7 @@ teardown() { } @test "overwrite a row. make sure it updates not inserts" { - dolt table import test -u $BATS_TEST_DIRNAME/helper/1pk5col-ints.csv + dolt table import test -u `nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.csv` run dolt table put-row test pk:1 c1:2 c2:4 c3:6 c4:8 c5:10 [ "$status" -eq 0 ] [ "$output" = "Successfully put row." ] diff --git a/bats/1pk5col-strings.bats b/bats/1pk5col-strings.bats index 5829cb557a..a9d181a367 100755 --- a/bats/1pk5col-strings.bats +++ b/bats/1pk5col-strings.bats @@ -6,8 +6,9 @@ setup() { cd $BATS_TMPDIR mkdir "dolt-repo-$$" cd "dolt-repo-$$" + load $BATS_TEST_DIRNAME/helper/windows-compat.bash dolt init - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-strings.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-strings.schema` test } teardown() { diff --git a/bats/1pksupportedtypes.bats b/bats/1pksupportedtypes.bats index 1a9bebb7b3..118b6ae802 100755 --- a/bats/1pksupportedtypes.bats +++ b/bats/1pksupportedtypes.bats @@ -6,8 +6,9 @@ setup() { cd $BATS_TMPDIR mkdir "dolt-repo-$$" cd "dolt-repo-$$" + load $BATS_TEST_DIRNAME/helper/windows-compat.bash dolt init - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pksupportedtypes.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pksupportedtypes.schema` test } teardown() { diff --git a/bats/2pk5cols-ints.bats b/bats/2pk5cols-ints.bats index 09a0724a61..74bcb4b54d 100755 --- a/bats/2pk5cols-ints.bats +++ b/bats/2pk5cols-ints.bats @@ -6,8 +6,9 @@ setup() { cd $BATS_TMPDIR mkdir "dolt-repo-$$" cd "dolt-repo-$$" + load $BATS_TEST_DIRNAME/helper/windows-compat.bash dolt init - dolt table create -s=$BATS_TEST_DIRNAME/helper/2pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/2pk5col-ints.schema` test } teardown() { diff --git a/bats/advanced-sql.bats b/bats/advanced-sql.bats index 035eedb16c..9849319bc5 100755 --- a/bats/advanced-sql.bats +++ b/bats/advanced-sql.bats @@ -6,9 +6,10 @@ setup() { cd $BATS_TMPDIR mkdir "dolt-repo-$$" cd "dolt-repo-$$" + load $BATS_TEST_DIRNAME/helper/windows-compat.bash dolt init - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema one_pk - dolt table create -s=$BATS_TEST_DIRNAME/helper/2pk5col-ints.schema two_pk + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` one_pk + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/2pk5col-ints.schema` two_pk dolt sql -q "insert into one_pk (pk,c1,c2,c3,c4,c5) values (0,0,0,0,0,0),(1,10,10,10,10,10),(2,20,20,20,20,20),(3,30,30,30,30,30)" dolt sql -q "insert into two_pk (pk1,pk2,c1,c2,c3,c4,c5) values (0,0,0,0,0,0,0),(0,1,10,10,10,10,10),(1,0,20,20,20,20,20),(1,1,30,30,30,30,30)" } diff --git a/bats/capital-letter-column-names.bats b/bats/capital-letter-column-names.bats index af1c86b708..1d9eba055f 100644 --- a/bats/capital-letter-column-names.bats +++ b/bats/capital-letter-column-names.bats @@ -6,8 +6,9 @@ setup() { cd $BATS_TMPDIR mkdir "dolt-repo-$$" cd "dolt-repo-$$" + load $BATS_TEST_DIRNAME/helper/windows-compat.bash dolt init - dolt table import -c -s $BATS_TEST_DIRNAME/helper/capital-letter-column-names.schema test $BATS_TEST_DIRNAME/helper/capital-letter-column-names.csv + dolt table import -c -s `nativepath $BATS_TEST_DIRNAME/helper/capital-letter-column-names.schema` test `nativepath $BATS_TEST_DIRNAME/helper/capital-letter-column-names.csv` } teardown() { diff --git a/bats/conflict-detection.bats b/bats/conflict-detection.bats index 8ce30a1d58..761c300121 100644 --- a/bats/conflict-detection.bats +++ b/bats/conflict-detection.bats @@ -6,6 +6,7 @@ setup() { cd $BATS_TMPDIR mkdir "dolt-repo-$$" cd "dolt-repo-$$" + load $BATS_TEST_DIRNAME/helper/windows-compat.bash dolt init } @@ -14,7 +15,7 @@ teardown() { } @test "two branches modify different cell different row. merge. no conflict" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt table put-row test pk:0 c1:0 c2:0 c3:0 c4:0 c5:0 dolt table put-row test pk:1 c1:1 c2:1 c3:1 c4:1 c5:1 dolt add test @@ -37,7 +38,7 @@ teardown() { } @test "two branches modify different cell same row. merge. no conflict" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt table put-row test pk:0 c1:0 c2:0 c3:0 c4:0 c5:0 dolt add test dolt commit -m "table created" @@ -59,7 +60,7 @@ teardown() { } @test "two branches modify same cell. merge. conflict" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt table put-row test pk:0 c1:0 c2:0 c3:0 c4:0 c5:0 dolt add test dolt commit -m "table created" @@ -78,7 +79,7 @@ teardown() { } @test "two branches add a different row. merge. no conflict" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "table created" dolt branch add-row @@ -99,7 +100,7 @@ teardown() { } @test "two branches add same row. merge. no conflict" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "table created" dolt branch add-row @@ -118,7 +119,7 @@ teardown() { } @test "one branch add table, other modifies table. merge. no conflict" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "table created" dolt branch add-table @@ -126,7 +127,7 @@ teardown() { dolt add test dolt commit -m "added row" dolt checkout add-table - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test2 + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test2 dolt add test2 dolt commit -m "added new table test2" dolt checkout master @@ -139,7 +140,7 @@ teardown() { } @test "two branches add same column. merge. no conflict" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "table created" dolt branch add-column @@ -158,7 +159,7 @@ teardown() { } @test "two branches add different column. merge. no conflict" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "table created" dolt branch add-column @@ -178,7 +179,7 @@ teardown() { } @test "two branches add same column, different types. merge. conflict" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "table created" dolt branch add-column @@ -197,7 +198,7 @@ teardown() { } @test "two branches delete same column. merge. no conflict" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "table created" dolt branch delete-column @@ -216,7 +217,7 @@ teardown() { } @test "two branches delete different column. merge. no conflict" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "table created" dolt branch delete-column @@ -235,7 +236,7 @@ teardown() { } @test "two branches rename same column to same name. merge. no conflict" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "table created" dolt branch rename-column @@ -254,7 +255,7 @@ teardown() { } @test "two branches rename same column to different name. merge. conflict" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "table created" dolt branch rename-column @@ -275,7 +276,7 @@ teardown() { } @test "two branches rename different column to same name. merge. conflict" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "table created" dolt branch rename-column @@ -298,15 +299,15 @@ teardown() { # 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 "two branches change type of same column to same type. merge. no conflict" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "table created" dolt branch change-types - dolt table create -f -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints-change-type-1.schema test + dolt table create -f -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints-change-type-1.schema` test dolt add test dolt commit -m "changed c1 to type bool" dolt checkout change-types - dolt table create -f -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints-change-type-1.schema test + dolt table create -f -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints-change-type-1.schema` test dolt add test dolt commit -m "changed c1 to type bool again" dolt checkout master @@ -317,15 +318,15 @@ teardown() { } @test "two branches change type of same column to different type. merge. conflict" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "table created" dolt branch change-types - dolt table create -f -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints-change-type-1.schema test + dolt table create -f -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints-change-type-1.schema` test dolt add test dolt commit -m "changed c1 to type bool" dolt checkout change-types - dolt table create -f -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints-change-type-2.schema test + dolt table create -f -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints-change-type-2.schema` test dolt add test dolt commit -m "changed c1 to type float" dolt checkout master @@ -338,15 +339,15 @@ teardown() { } @test "two branches make same column primary key. merge. no conflict" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "table created" dolt branch add-pk - dolt table create -f -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints-change-pk-1.schema test + dolt table create -f -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints-change-pk-1.schema` test dolt add test dolt commit -m "made c1 a pk" dolt checkout add-pk - dolt table create -f -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints-change-pk-1.schema test + dolt table create -f -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints-change-pk-1.schema` test dolt add test dolt commit -m "made c1 a pk again" dolt checkout master @@ -357,15 +358,15 @@ teardown() { } @test "two branches add same primary key column. merge. no conflict" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "table created" dolt branch add-pk - dolt table create -f -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints-add-pk1.schema test + dolt table create -f -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints-add-pk1.schema` test dolt add test dolt commit -m "added pk pk1" dolt checkout add-pk - dolt table create -f -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints-add-pk1.schema test + dolt table create -f -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints-add-pk1.schema` test dolt add test dolt commit -m "added pk pk1 again" dolt checkout master @@ -376,15 +377,15 @@ teardown() { } @test "two branches make different columns primary key. merge. conflict" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "table created" dolt branch add-pk - dolt table create -f -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints-add-pk1.schema test + dolt table create -f -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints-add-pk1.schema` test dolt add test dolt commit -m "added pk pk1" dolt checkout add-pk - dolt table create -f -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints-add-pk2.schema test + dolt table create -f -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints-add-pk2.schema` test dolt add test dolt commit -m "added pk pk2" dolt checkout master @@ -398,11 +399,11 @@ teardown() { dolt branch table1 dolt branch table2 dolt checkout table1 - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema table1 + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` table1 dolt add table1 dolt commit -m "first table" dolt checkout table2 - dolt table create -s=$BATS_TEST_DIRNAME/helper/2pk5col-ints.schema table2 + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/2pk5col-ints.schema` table2 dolt add table2 dolt commit -m "second table" dolt checkout master diff --git a/bats/create-tables.bats b/bats/create-tables.bats index 0406cfed1a..3845d48e5a 100755 --- a/bats/create-tables.bats +++ b/bats/create-tables.bats @@ -6,6 +6,7 @@ setup() { cd $BATS_TMPDIR mkdir "dolt-repo-$$" cd "dolt-repo-$$" + load $BATS_TEST_DIRNAME/helper/windows-compat.bash dolt init } @@ -14,7 +15,7 @@ teardown() { } @test "create a single primary key table" { - run dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + run dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test [ "$status" -eq 0 ] [ "$output" = "" ] run dolt ls @@ -23,7 +24,7 @@ teardown() { } @test "create a two primary key table" { - run dolt table create -s=$BATS_TEST_DIRNAME/helper/2pk5col-ints.schema test + run dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/2pk5col-ints.schema` test [ "$status" -eq 0 ] [ "$output" = "" ] run dolt ls @@ -32,7 +33,7 @@ teardown() { } @test "create a table that uses all supported types" { - run dolt table create -s=$BATS_TEST_DIRNAME/helper/1pksupportedtypes.schema test + run dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pksupportedtypes.schema` test [ "$status" -eq 0 ] [ "$output" = "" ] run dolt ls @@ -41,14 +42,14 @@ teardown() { } @test "create a table that uses unsupported blob type" { - run dolt table create -s=$BATS_TEST_DIRNAME/helper/1pkunsupportedtypes.schema test + run dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pkunsupportedtypes.schema` test skip "Can create a blob type in schema now but I should not be able to. Also can create a column of type poop that gets converted to type bool." [ "$status" -eq 1 ] } @test "create a repo with two tables" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test1 - dolt table create -s=$BATS_TEST_DIRNAME/helper/2pk5col-ints.schema test2 + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test1 + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/2pk5col-ints.schema` test2 run dolt ls [ "$status" -eq 0 ] [[ "$output" =~ "test1" ]] || false @@ -61,7 +62,7 @@ teardown() { } @test "create a table with json import" { - run dolt table import -c -s $BATS_TEST_DIRNAME/helper/employees-sch.json employees $BATS_TEST_DIRNAME/helper/employees-tbl.json + run dolt table import -c -s `nativepath $BATS_TEST_DIRNAME/helper/employees-sch.json` employees `nativepath $BATS_TEST_DIRNAME/helper/employees-tbl.json` [ "$status" -eq 0 ] [[ "$output" =~ "Import completed successfully." ]] || false run dolt ls @@ -74,13 +75,13 @@ teardown() { } @test "create a table with json import. no schema." { - run dolt table import -c employees $BATS_TEST_DIRNAME/helper/employees-tbl.json + run dolt table import -c employees `nativepath $BATS_TEST_DIRNAME/helper/employees-tbl.json` [ "$status" -ne 0 ] [ "$output" = "Please specify schema file for .json tables." ] } @test "create a table with json import. bad json." { - run dolt table import -c -s $BATS_TEST_DIRNAME/employees-sch.json employees $BATS_TEST_DIRNAME/helper/employees-tbl-bad.json + run dolt table import -c -s `nativepath $BATS_TEST_DIRNAME/employees-sch.json` employees `nativepath $BATS_TEST_DIRNAME/helper/employees-tbl-bad.json` [ "$status" -eq 1 ] [[ "$output" =~ "Error creating reader" ]] || false [[ "$output" =~ "employees-tbl-bad.json to" ]] || false @@ -90,7 +91,7 @@ teardown() { } @test "create a table with json import. bad schema." { - run dolt table import -c -s $BATS_TEST_DIRNAME/employees-sch-bad.json employees $BATS_TEST_DIRNAME/helper/employees-tbl.json + run dolt table import -c -s `nativepath $BATS_TEST_DIRNAME/employees-sch-bad.json` employees `nativepath $BATS_TEST_DIRNAME/helper/employees-tbl.json` [ "$status" -eq 1 ] [[ "$output" =~ "Error creating reader" ]] || false skip "Error message mentions valid table file but not invalid schema file" @@ -100,7 +101,7 @@ teardown() { } @test "import data from csv and create the table" { - run dolt table import -c --pk=pk test $BATS_TEST_DIRNAME/helper/1pk5col-ints.csv + run dolt table import -c --pk=pk test `nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.csv` [ "$status" -eq 0 ] [[ "$output" =~ "Import completed successfully." ]] || false run dolt ls @@ -112,13 +113,13 @@ teardown() { } @test "try to create a table with a bad csv" { - run dolt table import -c --pk=pk test $BATS_TEST_DIRNAME/helper/bad.csv + run dolt table import -c --pk=pk test `nativepath $BATS_TEST_DIRNAME/helper/bad.csv` [ "$status" -eq 1 ] [[ "$output" =~ "Error creating reader" ]] || false } @test "create a table with two primary keys from csv import" { - run dolt table import -c --pk=pk1,pk2 test $BATS_TEST_DIRNAME/helper/2pk5col-ints.csv + run dolt table import -c --pk=pk1,pk2 test `nativepath $BATS_TEST_DIRNAME/helper/2pk5col-ints.csv` [ "$status" -eq 0 ] [[ "$output" =~ "Import completed successfully." ]] || false run dolt ls @@ -127,7 +128,7 @@ teardown() { } @test "import data from psv and create the table" { - run dolt table import -c --pk=pk test $BATS_TEST_DIRNAME/helper/1pk5col-ints.psv + run dolt table import -c --pk=pk test `nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.psv` [ "$status" -eq 0 ] [[ "$output" =~ "Import completed successfully." ]] || false run dolt ls @@ -139,14 +140,14 @@ teardown() { } @test "create two table with the same name" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test - run dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test + run dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test [ "$status" -ne 0 ] [[ "$output" =~ "already exists." ]] || false } @test "create a table from CSV with common column name patterns" { - run dolt table import -c --pk=UPPERCASE test $BATS_TEST_DIRNAME/helper/caps-column-names.csv + run dolt table import -c --pk=UPPERCASE test `nativepath $BATS_TEST_DIRNAME/helper/caps-column-names.csv` [ "$status" -eq 0 ] [[ "$output" =~ "Import completed successfully." ]] || false run dolt table select test @@ -155,7 +156,7 @@ teardown() { } @test "create a table from excel import with multiple sheets" { - run dolt table import -c --pk=id employees $BATS_TEST_DIRNAME/helper/employees.xlsx + run dolt table import -c --pk=id employees `nativepath $BATS_TEST_DIRNAME/helper/employees.xlsx` [ "$status" -eq 0 ] [[ "$output" =~ "Import completed successfully." ]] || false run dolt ls @@ -165,7 +166,7 @@ teardown() { [ "$status" -eq 0 ] [[ "$output" =~ "tim" ]] || false [ "${#lines[@]}" -eq 7 ] - run dolt table import -c --pk=number basketball $BATS_TEST_DIRNAME/helper/employees.xlsx + run dolt table import -c --pk=number basketball `nativepath $BATS_TEST_DIRNAME/helper/employees.xlsx` [ "$status" -eq 0 ] [[ "$output" =~ "Import completed successfully." ]] || false run dolt ls @@ -179,7 +180,7 @@ teardown() { } @test "specify incorrect sheet name on excel import" { - run dolt table import -c --pk=id bad-sheet-name $BATS_TEST_DIRNAME/helper/employees.xlsx + run dolt table import -c --pk=id bad-sheet-name `nativepath $BATS_TEST_DIRNAME/helper/employees.xlsx` [ "$status" -eq 1 ] [[ "$output" =~ "table name must match excel sheet name" ]] || false run dolt ls @@ -188,7 +189,7 @@ teardown() { } @test "import an .xlsx file that is not a valid excel spreadsheet" { - run dolt table import -c --pk=id test $BATS_TEST_DIRNAME/helper/bad.xlsx + run dolt table import -c --pk=id test `nativepath $BATS_TEST_DIRNAME/helper/bad.xlsx` [ "$status" -eq 1 ] skip "errors with 'cause: zip: not a valid zip file'. should say not a valid xlsx file" [[ "$output" =~ "not a valid xlsx file" ]] || false @@ -303,27 +304,27 @@ teardown() { skip "This case needs a lot of work." [ "$output" = "Invalid table name. Table names cannot start with digits." ] skip "dolt table create should fail on invalid table name" - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema 1pk + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` 1pk [ "$status" -eq 1 ] [ "$output" = "Invalid table name. Table names cannot start with digits." ] run dolt sql -q "create table one-pk (pk int not null, c1 int, primary key(pk))" [ "$status" -eq 1 ] skip "Need better error message" [ "$output" = "Invalid table name. Table names cannot contain dashes." ] - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema 1pk + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` 1pk [ "$status" -eq 1 ] [ "$output" = "Invalid table name. Table names cannot contain dashes." ] } @test "import a table with non UTF-8 characters in it" { - run dolt table import -c --pk=pk test $BATS_TEST_DIRNAME/helper/bad-characters.csv + run dolt table import -c --pk=pk test `nativepath $BATS_TEST_DIRNAME/helper/bad-characters.csv` skip "Dolt allows you to create tables with non-UTF-8 characters right now" [ "$status" -eq 1 ] [[ "$output" =~ "unsupported characters" ]] || false } @test "dolt diff on a newly created table" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test run dolt diff [ $status -eq 0 ] [ "${lines[0]}" = "diff --dolt a/test b/test" ] diff --git a/bats/git-dolt.bats b/bats/git-dolt.bats index 1179c57971..90c50382ee 100755 --- a/bats/git-dolt.bats +++ b/bats/git-dolt.bats @@ -24,7 +24,7 @@ setup() { teardown() { rm -rf $BATS_TMPDIR/{git,dolt}-repo-$$ - pkill -2 remotesrv + pgrep remotesrv | xargs kill rm -rf $BATS_TMPDIR/remotes-$$ } @@ -89,7 +89,6 @@ teardown() { } @test "git dolt's smudge filter automatically clones dolt repositories referenced in checked out git-dolt pointer files" { - skiponwindows "This test works on Windows command prompt but not the bash terminal: GitHub Issue #1809" init_git_repo git dolt install git dolt link $REMOTE @@ -120,7 +119,7 @@ teardown() { } @test "git dolt update updates the specified pointer file to the specified revision" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "test commit" export NEW_DOLT_HEAD_COMMIT=`get_head_commit` diff --git a/bats/helper/windows-compat.bash b/bats/helper/windows-compat.bash index 9a0283529f..a290e9207c 100644 --- a/bats/helper/windows-compat.bash +++ b/bats/helper/windows-compat.bash @@ -1,26 +1,11 @@ skiponwindows() { :; } - -unameOut="$(uname -s)" -case "${unameOut}" in - CYGWIN*) machine=Windows;; - MINGW*) machine=Windows;; - *) machine=Unix;; -esac +nativepath() { echo "$1"; } -if [ ${machine} = "Windows" ]; then - skiponwindows() { - skip "$1" - } -fi - -if ! [ -x "$(command -v pkill)" ]; then - pkill() { - taskkill -fi "IMAGENAME eq $2*" -f - } -fi - -if ! [ -x "$(command -v pgrep)" ]; then - pgrep() { - tasklist -fi "IMAGENAME eq $1*" +if [ -d /mnt/*/Windows/System32 ]; then + nativepath() { + wslpath -w "$1" } + skiponwindows() { + skip "$1" + } fi diff --git a/bats/multiple-tables.bats b/bats/multiple-tables.bats index d188ac9e28..2c772166ef 100755 --- a/bats/multiple-tables.bats +++ b/bats/multiple-tables.bats @@ -6,9 +6,10 @@ setup() { cd $BATS_TMPDIR mkdir "dolt-repo-$$" cd "dolt-repo-$$" + load $BATS_TEST_DIRNAME/helper/windows-compat.bash dolt init - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test1 - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test2 + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test1 + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test2 } teardown() { @@ -106,8 +107,8 @@ teardown() { dolt table put-row test1 pk:0 c1:1 c2:2 c3:3 c4:4 c5:5 dolt table put-row test2 pk:0 c1:1 c2:2 c3:3 c4:4 c5:5 - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test3 - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test4 + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test3 + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test4 run dolt status [[ "$output" =~ modified.*test1 ]] || false diff --git a/bats/remotes.bats b/bats/remotes.bats index f5e06bd677..2670fa8845 100644 --- a/bats/remotes.bats +++ b/bats/remotes.bats @@ -21,7 +21,7 @@ setup() { teardown() { rm -rf $BATS_TMPDIR/dolt-repo-$$ - pkill -2 remotesrv + pgrep remotesrv | xargs kill rm -rf $BATS_TMPDIR/remotes-$$ } @@ -90,7 +90,7 @@ teardown() { @test "clone a remote" { dolt remote add test-remote http://localhost:50051/test-org/test-repo - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "test commit" dolt push test-remote master @@ -127,7 +127,7 @@ teardown() { @test "clone a different branch than master" { dolt remote add test-remote http://localhost:50051/test-org/test-repo dolt checkout -b test-branch - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "test commit" dolt push test-remote test-branch @@ -147,7 +147,7 @@ teardown() { @test "call a clone's remote something other than origin" { dolt remote add test-remote http://localhost:50051/test-org/test-repo - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "test commit" dolt push test-remote master @@ -193,7 +193,7 @@ teardown() { cd "dolt-repo-clones" dolt clone http://localhost:50051/test-org/test-repo cd .. - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "test commit" dolt push test-remote master @@ -222,7 +222,7 @@ teardown() { cd "dolt-repo-clones" dolt clone http://localhost:50051/test-org/test-repo cd .. - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "test commit" dolt push test-remote master @@ -245,7 +245,7 @@ teardown() { cd "dolt-repo-clones" dolt clone http://localhost:50051/test-org/test-repo cd .. - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "test commit" dolt push test-remote master @@ -266,12 +266,12 @@ teardown() { cd "dolt-repo-clones" dolt clone http://localhost:50051/test-org/test-repo cd .. - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "test commit" dolt push test-remote master cd "dolt-repo-clones/test-repo" - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test2 + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test2 dolt add test2 dolt commit -m "another test commit" run dolt pull origin @@ -281,7 +281,7 @@ teardown() { @test "generate a merge with a conflict with a remote branch" { dolt remote add test-remote http://localhost:50051/test-org/test-repo - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "created table" dolt push test-remote master @@ -311,7 +311,7 @@ teardown() { @test "clone sets your current branch appropriately" { dolt remote add test-remote http://localhost:50051/test-org/test-repo - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "test commit" dolt checkout -b aaa @@ -344,7 +344,7 @@ teardown() { @test "file based remotes" { # seed with some data - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "test commit" @@ -377,7 +377,7 @@ teardown() { @test "multiple remotes" { # seed with some data - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "test commit" diff --git a/bats/schema-changes.bats b/bats/schema-changes.bats index 2b99d963b6..f5f270b45e 100755 --- a/bats/schema-changes.bats +++ b/bats/schema-changes.bats @@ -6,6 +6,7 @@ setup() { cd $BATS_TMPDIR mkdir "dolt-repo-$$" cd "dolt-repo-$$" + load $BATS_TEST_DIRNAME/helper/windows-compat.bash dolt init } @@ -14,12 +15,12 @@ teardown() { } @test "changing column types should not produce a data diff error" { - dolt table import -c --pk=pk test $BATS_TEST_DIRNAME/helper/1pk5col-ints.csv + dolt table import -c --pk=pk test `nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.csv` run dolt schema [[ "$output" =~ "varchar" ]] || false dolt add test dolt commit -m "Added test table" - dolt table import -c -f -pk=pk -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test $BATS_TEST_DIRNAME/helper/1pk5col-ints.csv + dolt table import -c -f -pk=pk -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test `nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.csv` run dolt diff skip "This produces a failed to merge schemas error message right now" [ "$status" -eq 0 ] @@ -29,7 +30,7 @@ teardown() { } @test "dolt schema rename column" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt sql -q 'insert into test values (1,1,1,1,1,1)' run dolt schema --rename-column test c1 c0 [ "$status" -eq 0 ] @@ -49,7 +50,7 @@ teardown() { } @test "dolt schema delete column" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt sql -q 'insert into test values (1,1,1,1,1,1)' run dolt schema --drop-column test c1 [ "$status" -eq 0 ] @@ -68,7 +69,7 @@ teardown() { } @test "dolt diff on schema changes" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "committed table so we can see diffs" dolt schema --add-column test c0 int @@ -98,10 +99,10 @@ teardown() { } @test "change the primary key. view the schema diff" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "committed table so we can see diffs" - dolt table create -f -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints-diff-pk.schema test + dolt table create -f -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints-diff-pk.schema` test run dolt diff --schema [ "$status" -eq 0 ] skip "Schema diff output does not handle changing primary keys" @@ -109,7 +110,7 @@ teardown() { } @test "adding and dropping column should produce no diff" { - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test dolt add test dolt commit -m "committed table so we can see diffs" dolt schema --add-column test c0 int diff --git a/bats/sql-reserved-column-name.bats b/bats/sql-reserved-column-name.bats index 97d98ce507..6932d08a2b 100755 --- a/bats/sql-reserved-column-name.bats +++ b/bats/sql-reserved-column-name.bats @@ -6,8 +6,9 @@ setup() { cd $BATS_TMPDIR mkdir "dolt-repo-$$" cd "dolt-repo-$$" + load $BATS_TEST_DIRNAME/helper/windows-compat.bash dolt init - dolt table import -c -pk=Timestamp test $BATS_TEST_DIRNAME/helper/sql-reserved-column-name.csv + dolt table import -c -pk=Timestamp test `nativepath $BATS_TEST_DIRNAME/helper/sql-reserved-column-name.csv` } teardown() { diff --git a/bats/sql-shell.bats b/bats/sql-shell.bats index f2b3510794..655b5cc0a7 100644 --- a/bats/sql-shell.bats +++ b/bats/sql-shell.bats @@ -8,7 +8,7 @@ setup() { mkdir "dolt-repo-$$" cd "dolt-repo-$$" dolt init - dolt table create -s=$BATS_TEST_DIRNAME/helper/1pk5col-ints.schema test + dolt table create -s=`nativepath $BATS_TEST_DIRNAME/helper/1pk5col-ints.schema` test } teardown() { @@ -16,7 +16,7 @@ teardown() { } @test "start a sql shell and exit using exit" { - skiponwindows "Works on Windows command prompt but not the MinTTY terminal used during bats" + skiponwindows "Works on Windows command prompt but not the WSL terminal used during bats" run bash -c "echo exit | dolt sql" [ $status -eq 0 ] [[ "$output" =~ "# Welcome to the DoltSQL shell." ]] || false @@ -24,7 +24,7 @@ teardown() { } @test "start a sql shell and exit using quit" { - skiponwindows "Works on Windows command prompt but not the MinTTY terminal used during bats" + skiponwindows "Works on Windows command prompt but not the WSL terminal used during bats" run bash -c "echo quit | dolt sql" [ $status -eq 0 ] [[ "$output" =~ "# Welcome to the DoltSQL shell." ]] || false @@ -32,7 +32,7 @@ teardown() { } @test "run a query in sql shell" { - skiponwindows "Works on Windows command prompt but not the MinTTY terminal used during bats" + skiponwindows "Works on Windows command prompt but not the WSL terminal used during bats" run bash -c "echo 'select * from test;' | dolt sql" [ $status -eq 0 ] [[ "$output" =~ "# Welcome to the DoltSQL shell." ]] || false