From 5a9ed48052b33f67300f5cd394c862642224dd5a Mon Sep 17 00:00:00 2001 From: Tor Colvin Date: Thu, 14 Aug 2025 15:08:43 -0400 Subject: [PATCH 1/3] fix test flakes --- rest/blip_api_crud_test.go | 2 +- rest/blip_legacy_revid_test.go | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/rest/blip_api_crud_test.go b/rest/blip_api_crud_test.go index 9bbe891720..9f60fbbeb6 100644 --- a/rest/blip_api_crud_test.go +++ b/rest/blip_api_crud_test.go @@ -3601,7 +3601,7 @@ func TestBlipPullConflict(t *testing.T) { require.EventuallyWithT(t, func(c *assert.CollectT) { _, _, postConflictCBLVersion := client.GetDoc(docID) - assert.NotEqual(t, preConflictCBLVersion, postConflictCBLVersion) + assert.Greater(c, postConflictCBLVersion.CV.Value, preConflictCBLVersion.CV.Value) }, time.Second*10, time.Millisecond*10, "Expected sgVersion and cblVersion to be different") postConflictDoc, postConflictHLV, postConflictVersion := client.GetDoc(docID) diff --git a/rest/blip_legacy_revid_test.go b/rest/blip_legacy_revid_test.go index 9f32a1dc55..d918f30497 100644 --- a/rest/blip_legacy_revid_test.go +++ b/rest/blip_legacy_revid_test.go @@ -662,7 +662,9 @@ func TestChangesResponseWithHLVInHistory(t *testing.T) { rt.WaitForPendingChanges() receivedChangesRequestWg := sync.WaitGroup{} + receivedChangesRequestWg.Add(2) revsFinishedWg := sync.WaitGroup{} + revsFinishedWg.Add(1) bt.blipContext.HandlerForProfile["rev"] = func(request *blip.Message) { defer revsFinishedWg.Done() @@ -682,6 +684,7 @@ func TestChangesResponseWithHLVInHistory(t *testing.T) { } bt.blipContext.HandlerForProfile["changes"] = func(request *blip.Message) { + defer receivedChangesRequestWg.Done() log.Printf("got changes message: %+v", request) body, err := request.Body() @@ -713,7 +716,6 @@ func TestChangesResponseWithHLVInHistory(t *testing.T) { require.NoError(t, err) response.SetBody(emptyResponseValBytes) } - receivedChangesRequestWg.Done() } subChangesRequest := bt.newRequest() @@ -721,11 +723,6 @@ func TestChangesResponseWithHLVInHistory(t *testing.T) { subChangesRequest.Properties["continuous"] = "false" sent := bt.sender.Send(subChangesRequest) assert.True(t, sent) - // changes will be called again with empty changes so hence the wait group of 2 - receivedChangesRequestWg.Add(2) - - // expect 1 rev message - revsFinishedWg.Add(1) subChangesResponse := subChangesRequest.Response() assert.Equal(t, subChangesRequest.SerialNumber(), subChangesResponse.SerialNumber()) From 33a1e648730d63112b9104d57d98c20c35dcd7ce Mon Sep 17 00:00:00 2001 From: Tor Colvin Date: Thu, 14 Aug 2025 15:17:59 -0400 Subject: [PATCH 2/3] Add license --- pyproject.toml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index a44f046baf..0c7bf89e46 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,11 @@ +# Copyright 2025-Present Couchbase, Inc. +# +# Use of this software is governed by the Business Source License included +# in the file licenses/BSL-Couchbase.txt. As of the Change Date specified +# in that file, in accordance with the Business Source License, use of this +# software will be governed by the Apache License, Version 2.0, included in +# the file licenses/APL2.txt. + [project] # this isn't a real project, but we need this to make the tools work name = "sgcollect_info" version = "0.0.1" From ec090f5c172e4ecd6fb254282ab4db90bc2f779b Mon Sep 17 00:00:00 2001 From: Tor Colvin Date: Thu, 14 Aug 2025 17:25:51 -0400 Subject: [PATCH 3/3] allow body to be nil for tombstone --- topologytest/couchbase_lite_mock_peer_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/topologytest/couchbase_lite_mock_peer_test.go b/topologytest/couchbase_lite_mock_peer_test.go index 1e25cbd07c..3381c3be5b 100644 --- a/topologytest/couchbase_lite_mock_peer_test.go +++ b/topologytest/couchbase_lite_mock_peer_test.go @@ -76,7 +76,10 @@ func (p *CouchbaseLiteMockPeer) GetDocumentIfExists(dsName sgbucket.DataStoreNam if meta == nil { return DocMetadata{}, nil, false } - require.NotNil(p.TB(), meta, "docID:%s not found on %s", docID, p) + // document is tombstone + if bodyBytes == nil { + return *meta, nil, true + } require.NoError(p.TB(), base.JSONUnmarshal(bodyBytes, &body)) return *meta, body, true }