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

fix test flakes #7682

merged 3 commits into from
Aug 14, 2025

Conversation

torcolvin
Copy link
Collaborator

@torcolvin torcolvin commented Aug 14, 2025

Also, had to add missing license file since addlicense now finds the pyproject.toml file

In a recent commit, 1190eac

assert.NotEqual(t, preConflictCBLVersion, postConflictCBLVersion) is buggy in two ways:

  1. uses t instead of c so require.EventuallyWithT doesn't work
  2. preConflictCBLVersion is DocVersion and postConflictCBL is *DocVersion so they were never going to be equal. It would be great if testify used generics to be type safe, but this is not on their roundmap.

Fix a separate flake with negative wait groups

    utilities_testing.go:1509: Panic while handling changes: sync: negative WaitGroup counter
        goroutine 34731 [running]:
        runtime/debug.Stack()
        	/home/ec2-user/tools/org.jenkinsci.plugins.golang.GolangInstallation/1.24.4/src/runtime/debug/stack.go:26 +0x67
        github.com/couchbase/sync_gateway/rest.createBlipTesterWithSpec.func2(0xc0013e6000, 0x0?, {0x2410800, 0x2b87c00})
        	/home/ec2-user/workspace/Pipeline_main/rest/utilities_testing.go:1508 +0x5f
        github.com/couchbase/go-blip.(*Context).dispatchRequest.func1()
        	/home/ec2-user/go/pkg/mod/github.com/couchbase/go-blip@v0.0.0-20250325132327-d73efab2df06/context.go:297 +0xd4
        panic({0x2410800?, 0x2b87c00?})
        	/home/ec2-user/tools/org.jenkinsci.plugins.golang.GolangInstallation/1.24.4/src/runtime/panic.go:792 +0x132
        sync.(*WaitGroup).Add(0xc000858b40, 0xffffffffffffffff)
        	/home/ec2-user/tools/org.jenkinsci.plugins.golang.GolangInstallation/1.24.4/src/sync/waitgroup.go:64 +0x19a
        sync.(*WaitGroup).Done(0xc000858b40)
        	/home/ec2-user/tools/org.jenkinsci.plugins.golang.GolangInstallation/1.24.4/src/sync/waitgroup.go:89 +0x2e
        github.com/couchbase/sync_gateway/rest.TestChangesResponseWithHLVInHistory.func2(0xc0013e6000)
        	/home/ec2-user/workspace/Pipeline_main/rest/blip_legacy_revid_test.go:716 +0x575
        github.com/couchbase/go-blip.(*Context).dispatchRequest(0xc0003ac900, 0xc0013e6000, 0xc000e1d560)
        	/home/ec2-user/go/pkg/mod/github.com/couchbase/go-blip@v0.0.0-20250325132327-d73efab2df06/context.go:319 +0x29c
        github.com/couchbase/go-blip.(*receiver).getPendingRequest.func1({0xc0013e6000?, 0x2b8d8a0?})
        	/home/ec2-user/go/pkg/mod/github.com/couchbase/go-blip@v0.0.0-20250325132327-d73efab2df06/receiver.go:275 +0x65
        github.com/couchbase/go-blip.(*Message).asyncRead.func1()
        	/home/ec2-user/go/pkg/mod/github.com/couchbase/go-blip@v0.0.0-20250325132327-d73efab2df06/message.go:388 +0x128
        created by github.com/couchbase/go-blip.(*Message).asyncRead in goroutine 34681
        	/home/ec2-user/go/pkg/mod/github.com/couchbase/go-blip@v0.0.0-20250325132327-d73efab2df06/message.go:374 +0x24d
2

@Copilot Copilot AI review requested due to automatic review settings August 14, 2025 19:13
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses test flakes in two test files by fixing improper assertion usage and WaitGroup management issues.

  • Fixes incorrect assertion parameter in TestBlipPullConflict where t was used instead of c in require.EventuallyWithT
  • Replaces type mismatch comparison with proper version value comparison
  • Fixes negative WaitGroup counter panic by moving WaitGroup.Add calls before goroutine handlers are registered

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
rest/blip_api_crud_test.go Fixes assertion parameter and type mismatch in conflict test
rest/blip_legacy_revid_test.go Fixes WaitGroup initialization timing to prevent negative counter panic

@couchbase couchbase deleted a comment from Copilot AI Aug 14, 2025
Copy link
Collaborator

@adamcfraser adamcfraser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@torcolvin torcolvin merged commit 38f3742 into main Aug 14, 2025
25 checks passed
@torcolvin torcolvin deleted the test-flakes branch August 14, 2025 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants