Skip to content

fix test flakes #7682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion rest/blip_api_crud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 3 additions & 6 deletions rest/blip_legacy_revid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -713,19 +716,13 @@ func TestChangesResponseWithHLVInHistory(t *testing.T) {
require.NoError(t, err)
response.SetBody(emptyResponseValBytes)
}
receivedChangesRequestWg.Done()
}

subChangesRequest := bt.newRequest()
subChangesRequest.SetProfile("subChanges")
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())
Expand Down
5 changes: 4 additions & 1 deletion topologytest/couchbase_lite_mock_peer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Loading