putting back the compatibility tests

This commit is contained in:
Andy Arthur
2020-04-02 12:25:49 -07:00
parent 90e75cbc0c
commit 98986d8014
5 changed files with 79 additions and 29 deletions

46
Jenkinsfile vendored
View File

@@ -85,29 +85,29 @@ pipeline {
}
}
}
// stage ("compatibility/") {
// agent {
// kubernetes {
// label "liquidata-inc-ld-build"
// }
// }
// environment {
// PATH = "${pwd()}/.ci_bin:${pwd()}/.ci_bin/node_modules/.bin:${env.PATH}"
// }
// steps {
// dir (".ci_bin") {
// sh "npm i bats"
// }
// dir ("go") {
// sh "go get -mod=readonly ./..."
// sh "go build -mod=readonly -o ../.ci_bin/dolt ./cmd/dolt/."
// }
// sh "dolt config --global --add user.name 'Liquidata Jenkins'"
// sh "dolt config --global --add user.email 'jenkins@liquidata.co'"
// dir ("bats/compatibility") {
// sh "./runner.sh"
// }
// }
stage ("compatibility/") {
agent {
kubernetes {
label "liquidata-inc-ld-build"
}
}
environment {
PATH = "${pwd()}/.ci_bin:${pwd()}/.ci_bin/node_modules/.bin:${env.PATH}"
}
steps {
dir (".ci_bin") {
sh "npm i bats"
}
dir ("go") {
sh "go get -mod=readonly ./..."
sh "go build -mod=readonly -o ../.ci_bin/dolt ./cmd/dolt/."
}
sh "dolt config --global --add user.name 'Liquidata Jenkins'"
sh "dolt config --global --add user.email 'jenkins@liquidata.co'"
dir ("bats/compatibility") {
sh "./runner.sh"
}
}
}
}
}

View File

@@ -14,7 +14,9 @@ teardown() {
for testdir in */; do
cd "$testdir"
dolt status
skip "Backwards compatibility broken with unique tags (v0.16.0)"
run dolt migrate
[ "$status" -eq "0" ]
[[ "$output" =~ "Migrating repository to the latest format" ]] || false
run dolt branch
[ "$status" -eq "0" ]
[[ "$output" =~ "master" ]] || false
@@ -81,7 +83,9 @@ teardown() {
@test "back-compat: adding commits" {
for testdir in */; do
cd "$testdir"
skip "Backwards compatibility broken with unique tags (v0.16.0)"
run dolt migrate
[ "$status" -eq "0" ]
[[ "$output" =~ "Migrating repository to the latest format" ]] || false
dolt sql -q "insert into abc values (2, 'text', '2020-01-15 20:49:22.28427')"
dolt add .
dolt commit -m "Add value during test"
@@ -108,7 +112,8 @@ teardown() {
@test "back-compat: merging" {
for testdir in */; do
cd "$testdir"
skip "Backwards compatibility broken with unique tags (v0.16.0)"
run dolt migrate
[ "$status" -eq "0" ]
run dolt merge newcolumn
[ "$status" -eq "0" ]
[[ "$output" =~ "Fast-forward" ]] || false
@@ -119,7 +124,9 @@ teardown() {
@test "back-compat: resolving conflicts" {
for testdir in */; do
cd "$testdir"
skip "Backwards compatibility broken with unique tags (v0.16.0)"
run dolt migrate
[ "$status" -eq "0" ]
[[ "$output" =~ "Migrating repository to the latest format" ]] || false
dolt checkout conflict
run dolt merge newcolumn
[ "$status" -eq "0" ]

View File

@@ -14,6 +14,9 @@ teardown() {
}
@test "dolt version" {
# this will fail for older dolt versions but BATS will swallow the error
run dolt migrate
run dolt version
[ "$status" -eq 0 ]
regex='dolt version [0-9]+.[0-9]+.[0-9]+'
@@ -29,12 +32,18 @@ teardown() {
}
@test "dolt ls" {
# this will fail for older dolt versions but BATS will swallow the error
run dolt migrate
run dolt ls
[ "$status" -eq 0 ]
[[ "${lines[0]}" =~ "Tables in working set:" ]] || false
}
@test "dolt branch" {
# this will fail for older dolt versions but BATS will swallow the error
run dolt migrate
run dolt branch
[ "$status" -eq 0 ]
}
@@ -46,6 +55,9 @@ teardown() {
}
@test "dolt schema show on branch init" {
# this will fail for older dolt versions but BATS will swallow the error
run dolt migrate
dolt checkout init
run dolt schema show abc
[ "$status" -eq 0 ]
@@ -61,6 +73,9 @@ teardown() {
}
@test "dolt sql 'select * from abc' on branch init" {
# this will fail for older dolt versions but BATS will swallow the error
run dolt migrate
dolt checkout init
run dolt sql -q 'select * from abc;'
[ "$status" -eq 0 ]
@@ -74,6 +89,9 @@ teardown() {
}
@test "dolt schema show on branch master" {
# this will fail for older dolt versions but BATS will swallow the error
run dolt migrate
run dolt schema show abc
[ "$status" -eq 0 ]
[[ "${lines[0]}" =~ "abc @ working" ]] || false
@@ -89,6 +107,9 @@ teardown() {
@test "dolt sql 'select * from abc' on branch master" {
# this will fail for older dolt versions but BATS will swallow the error
run dolt migrate
run dolt sql -q 'select * from abc;'
[ "$status" -eq 0 ]
[[ "${lines[1]}" =~ "| pk | a | b | x | y |" ]] || false
@@ -99,6 +120,9 @@ teardown() {
}
@test "dolt schema show on branch other" {
# this will fail for older dolt versions but BATS will swallow the error
run dolt migrate
dolt checkout other
run dolt schema show abc
[ "$status" -eq 0 ]
@@ -114,6 +138,9 @@ teardown() {
}
@test "dolt sql 'select * from abc' on branch other" {
# this will fail for older dolt versions but BATS will swallow the error
run dolt migrate
dolt checkout other
run dolt sql -q 'select * from abc;'
[ "$status" -eq 0 ]
@@ -127,6 +154,9 @@ teardown() {
}
@test "dolt table import" {
# this will fail for older dolt versions but BATS will swallow the error
run dolt migrate
run dolt table import -c -s abc_schema.json abc2 abc.csv
[ "$status" -eq 0 ]
[[ "$output" =~ "Import completed successfully." ]] || false

View File

@@ -0,0 +1,3 @@
v0.13.0
v0.14.0
v0.15.0

View File

@@ -48,8 +48,18 @@ func (cmd MigrateCmd) CreateMarkdown(_ filesys.Filesys, _, _ string) error {
// Version displays the version of the running dolt client
// Exec executes the command
func (cmd MigrateCmd) Exec(ctx context.Context, _ string, _ []string, dEnv *env.DoltEnv) int {
needed, err := rebase.NeedsUniqueTagMigration(ctx, dEnv)
if err != nil {
cli.PrintErrf(color.RedString("error checking for repository migration: %s", err.Error()))
return 1
}
if !needed {
cli.Println("Repository format is up to date")
return 0
}
cli.Println(color.YellowString(migrationMsg))
err := rebase.MigrateUniqueTags(ctx, dEnv)
err = rebase.MigrateUniqueTags(ctx, dEnv)
if err != nil {
cli.PrintErrf("error migrating repository: %s", err.Error())
return 1
@@ -61,7 +71,7 @@ func (cmd MigrateCmd) Exec(ctx context.Context, _ string, _ []string, dEnv *env.
func MigrationNeeded(ctx context.Context, dEnv *env.DoltEnv, args []string) bool {
needed, err := rebase.NeedsUniqueTagMigration(ctx, dEnv)
if err != nil {
cli.PrintErrf("error checking for repository migration: %s", err.Error())
cli.PrintErrf(color.RedString("error checking for repository migration: %s", err.Error()))
// ambiguous whether we need to migrate, but we should exit
return true
}