Skip to content
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

BufferWithTimeOrCount can exceed buffer size #268

Open
cc-stjm opened this issue Nov 13, 2020 · 1 comment
Open

BufferWithTimeOrCount can exceed buffer size #268

cc-stjm opened this issue Nov 13, 2020 · 1 comment
Assignees
Labels
bug report Reported bug.

Comments

@cc-stjm
Copy link

cc-stjm commented Nov 13, 2020

Describe the bug
Calling BufferWithTimeOrCount can result in larger buffers being emitted.

To Reproduce
The following test always seems to fail

func TestBufferWithTimeOrCountDoesNotExceedBufferSize(t *testing.T){
	observable := rxgo.Just(1,2,3)()
	buffers := observable.BufferWithTimeOrCount(rxgo.WithDuration(time.Second), 1)
	rxgo.Assert(context.Background(), t, buffers, rxgo.HasItems([]interface{}{1}, []interface{}{2}, []interface{}{3}))
}

The following test will intermittently fail. On my machine, I find a fail occurs on most runs if I run with go test -count 10000

func TestBufferWithTimeOrCountDoesNotExceedBufferSizeOf2(t *testing.T){
	observable := rxgo.Just(1,2,3,4,5)()
	buffers := observable.BufferWithTimeOrCount(rxgo.WithDuration(time.Second), 2)
	rxgo.Assert(context.Background(), t, buffers, rxgo.HasItems([]interface{}{1,2}, []interface{}{3,4}, []interface{}{5}))
}

Expected behavior
Buffer sizes should never exceed the count passed

Additional context

@cc-stjm cc-stjm added the validated bug Bug validated by the RxGo team. label Nov 13, 2020
@cc-stjm cc-stjm changed the title BufferWithTimeOrCount does not obey buffer size of 1 BufferWithTimeOrCount can exceed buffer size Nov 13, 2020
@maguro
Copy link
Contributor

maguro commented Mar 22, 2021

Fixed in PR #289

@teivah teivah added bug report Reported bug. and removed validated bug Bug validated by the RxGo team. labels Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Reported bug.
Projects
None yet
Development

No branches or pull requests

3 participants