mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-26 02:58:44 -06:00
Add a bats test to ensure we don't clone remote branches repeatedly
This commit is contained in:
@@ -264,6 +264,53 @@ SQL
|
||||
[[ ! "$output" =~ "README.md" ]] || false
|
||||
}
|
||||
|
||||
@test "remotes: clone a complicated remote" {
|
||||
dolt remote add test-remote http://localhost:50051/test-org/test-repo
|
||||
dolt sql -q "CREATE TABLE test (pk int primary key)"
|
||||
dolt sql -q "INSERT INTO test VALUES (1), (2), (3)"
|
||||
dolt add test
|
||||
dolt commit -m "test commit"
|
||||
dolt push test-remote main
|
||||
dolt push test-remote main:genesis-branch # In the beginning, there was a branch.
|
||||
dolt tag customtag main
|
||||
dolt push test-remote customtag
|
||||
|
||||
## Cloning from a remote which has tags and it's own remotes
|
||||
## https://github.com/dolthub/dolt/issues/7043
|
||||
cd "dolt-repo-clones"
|
||||
dolt clone http://localhost:50051/test-org/test-repo clone-1
|
||||
cd clone-1
|
||||
|
||||
# Assert that all the branches and tags are present
|
||||
run dolt branch -a
|
||||
[[ "$status" -eq 0 ]] || false
|
||||
[[ "$output" =~ "remotes/origin/main" ]] || false
|
||||
[[ "$output" =~ "remotes/origin/genesis-branch" ]] || false
|
||||
run dolt tag
|
||||
[[ "$status" -eq 0 ]] || false
|
||||
[[ "$output" =~ "customtag" ]] || false
|
||||
|
||||
# Make a local branch, and backup to a different remote
|
||||
dolt checkout -b clone-1-branch HEAD
|
||||
dolt backup add mybackup http://localhost:50051/alternate-org/backup
|
||||
dolt backup sync mybackup
|
||||
|
||||
cd ..
|
||||
dolt clone http://localhost:50051/alternate-org/backup clone-2
|
||||
cd clone-2
|
||||
|
||||
# Assert that the backup creates remote branches which are correct.
|
||||
run dolt branch -a
|
||||
[[ "$status" -eq 0 ]] || false
|
||||
[[ "$output" =~ "remotes/origin/clone-1-branch" ]] || false
|
||||
[[ "$output" =~ "remotes/origin/main" ]] || false
|
||||
! [[ "$output" =~ "remotes/origin/genesis-branch" ]] || false
|
||||
|
||||
run dolt tag
|
||||
[[ "$status" -eq 0 ]] || false
|
||||
[[ "$output" =~ "customtag" ]] || false
|
||||
}
|
||||
|
||||
@test "remotes: read tables test" {
|
||||
# create table t1 and commit
|
||||
dolt remote add test-remote http://localhost:50051/test-org/test-repo
|
||||
|
||||
Reference in New Issue
Block a user