From f9cc60d1ba492d0258d06a6e07e91368b8df8eb9 Mon Sep 17 00:00:00 2001 From: Tim Sehn Date: Fri, 19 Sep 2025 14:41:55 -0700 Subject: [PATCH 1/4] Bats test for branch create not being replicated --- integration-tests/bats/replication.bats | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/integration-tests/bats/replication.bats b/integration-tests/bats/replication.bats index 07f68923f5..c2fe8babb6 100644 --- a/integration-tests/bats/replication.bats +++ b/integration-tests/bats/replication.bats @@ -92,6 +92,34 @@ teardown() { [[ "$output" =~ "t1" ]] || false } +@test "replication: push new branch create" { + cd repo1 + dolt config --local --add sqlserver.global.dolt_replicate_to_remote backup1 + + dolt sql -q "create table t1 (a int primary key)" + dolt add . + dolt commit -am "cm" + + cd .. + run dolt clone file://./bac1 repo2 + [ "$status" -eq 0 ] + + cd repo2 + run dolt ls + [ "$status" -eq 0 ] + [ "${#lines[@]}" -eq 2 ] + [[ "$output" =~ "t1" ]] || false + + cd ../repo1 + dolt branch newbranch + + cd ../repo2 + dolt pull + run dolt branch + [ "$status" -eq 0 ] + [[ "$output" =~ "newbranch" ]] || false +} + @test "replication: push branch delete" { cd repo1 dolt push remote1 feature From bce98dd384025235a60829a9d59a389a6041c01f Mon Sep 17 00:00:00 2001 From: Tim Sehn Date: Fri, 19 Sep 2025 14:52:59 -0700 Subject: [PATCH 2/4] Not that simple. The branch is fetched --- integration-tests/bats/replication.bats | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/integration-tests/bats/replication.bats b/integration-tests/bats/replication.bats index c2fe8babb6..c3edf528a1 100644 --- a/integration-tests/bats/replication.bats +++ b/integration-tests/bats/replication.bats @@ -58,7 +58,6 @@ teardown() { } @test "replication: push on cli commit" { - cd repo1 dolt config --local --add sqlserver.global.dolt_replicate_to_remote backup1 dolt sql -q "create table t1 (a int primary key)" @@ -114,8 +113,8 @@ teardown() { dolt branch newbranch cd ../repo2 - dolt pull - run dolt branch + dolt pull origin + run dolt branch -a [ "$status" -eq 0 ] [[ "$output" =~ "newbranch" ]] || false } From 67d5ae99a4ad0a559c31995f000eb150756caafb Mon Sep 17 00:00:00 2001 From: Tim Sehn Date: Fri, 19 Sep 2025 14:55:20 -0700 Subject: [PATCH 3/4] New branch create test works --- integration-tests/bats/replication.bats | 2 ++ 1 file changed, 2 insertions(+) diff --git a/integration-tests/bats/replication.bats b/integration-tests/bats/replication.bats index c3edf528a1..a5271fa98b 100644 --- a/integration-tests/bats/replication.bats +++ b/integration-tests/bats/replication.bats @@ -117,6 +117,8 @@ teardown() { run dolt branch -a [ "$status" -eq 0 ] [[ "$output" =~ "newbranch" ]] || false + + dolt checkout --track origin/newbranch } @test "replication: push branch delete" { From 8f048a342cdd3625c364c7def6147c7a59ad4b5f Mon Sep 17 00:00:00 2001 From: Tim Sehn Date: Fri, 19 Sep 2025 15:13:56 -0700 Subject: [PATCH 4/4] Even more thorough testing --- integration-tests/bats/replication.bats | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/integration-tests/bats/replication.bats b/integration-tests/bats/replication.bats index a5271fa98b..c39ede6811 100644 --- a/integration-tests/bats/replication.bats +++ b/integration-tests/bats/replication.bats @@ -1,5 +1,6 @@ #!/usr/bin/env bats load $BATS_TEST_DIRNAME/helper/common.bash +load $BATS_TEST_DIRNAME/helper/query-server-common.bash setup() { setup_common @@ -119,6 +120,28 @@ teardown() { [[ "$output" =~ "newbranch" ]] || false dolt checkout --track origin/newbranch + + # Now create a branch with dolt sql + cd ../repo1 + dolt sql -q "call dolt_branch('newbranch2')" + + cd ../repo2 + dolt pull origin + run dolt branch -a + [ "$status" -eq 0 ] + [[ "$output" =~ "newbranch2" ]] || false + + # Finally, with a running sql server + cd ../repo1 + start_sql_server + dolt sql -q "call dolt_branch('newbranch3')" + stop_sql_server + + cd ../repo2 + dolt pull origin + run dolt branch -a + [ "$status" -eq 0 ] + [[ "$output" =~ "newbranch3" ]] || false } @test "replication: push branch delete" {