-
-
Notifications
You must be signed in to change notification settings - Fork 530
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7880 from dolthub/macneale4/sql-migration-remote
Migrate `dolt remote` to SQL
- Loading branch information
Showing
4 changed files
with
215 additions
and
44 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
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
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,77 @@ | ||
#!/usr/bin/env bats | ||
load $BATS_TEST_DIRNAME/helper/common.bash | ||
|
||
# This test suite is narrow in focus for the `dolt remote` command | ||
# | ||
# The remote command is used in many tests for set up, but we want | ||
# to verify that it's sql migration works without pulling in a lot | ||
# of changes to tests that would be cumbersome. | ||
|
||
setup() { | ||
setup_common | ||
} | ||
|
||
teardown() { | ||
assert_feature_version | ||
teardown_common | ||
} | ||
|
||
@test "remote-cmd: perform add" { | ||
dolt remote add origin http://customhost/org/db | ||
|
||
run dolt remote | ||
[ "$status" -eq 0 ] | ||
[[ "$output" =~ "origin" ]] || false | ||
[[ ! "$output" =~ "customhost" ]] || false | ||
|
||
run dolt remote -v | ||
[ "$status" -eq 0 ] | ||
[[ "$output" =~ "origin http://customhost/org/db" ]] || false | ||
} | ||
|
||
@test "remote-cmd: perform re-add" { | ||
dolt remote add origin http://customhost/org/db | ||
|
||
run dolt remote add origin http://otherhost/org/db | ||
[ "$status" -eq 1 ] | ||
[[ "$output" =~ "remote already exists" ]] || false | ||
} | ||
|
||
@test "remote-cmd: perform remove" { | ||
dolt remote add origin http://customhost/org/db | ||
dolt remote add other http://otherhost/org/db | ||
|
||
dolt remote remove origin | ||
|
||
run dolt remote -v | ||
[ "$status" -eq 0 ] | ||
[[ ! "$output" =~ "origin" ]] || false | ||
[[ ! "$output" =~ "customhost" ]] || false | ||
[[ "$output" =~ "other" ]] || false | ||
[[ "$output" =~ "otherhost" ]] || false | ||
} | ||
|
||
@test "remote-cmd: remove non-existent" { | ||
run dolt remote remove origin | ||
[ "$status" -eq 1 ] | ||
[[ "$output" =~ "unknown remote: 'origin'" ]] || false | ||
} | ||
|
||
# TODO - expand aws/gcp/oci testing. | ||
@test "remote-cmd: aws params" { | ||
if [ "$SQL_ENGINE" = "remote-engine" ]; then | ||
# Verify that we get the right errors when there is a server running. | ||
run dolt remote add --aws-region us-west origin aws://customhost/org/db | ||
[ "$status" -eq 1 ] | ||
[[ "$output" =~ "Stop server and re-run" ]] || false | ||
else | ||
dolt remote add --aws-region us-west origin aws://customhost/org/db | ||
run dolt remote -v | ||
[ "$status" -eq 0 ] | ||
[[ "$output" =~ "origin aws://customhost/org/db {\"aws-region\": \"us-west\"}" ]] || false | ||
|
||
run dolt remote add --aws-region us-west other http://customhost/org/db | ||
[ "$status" -eq 1 ] | ||
[[ "$output" =~ "only valid for aws remotes" ]] || false | ||
fi | ||
} |
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