Skip to content

fix(test): consumer group fetch request messages#3081

Merged
dnwe merged 1 commit intoIBM:mainfrom
stsmurf:stsmurf/consumer-group-example
Jan 17, 2025
Merged

fix(test): consumer group fetch request messages#3081
dnwe merged 1 commit intoIBM:mainfrom
stsmurf:stsmurf/consumer-group-example

Conversation

@stsmurf
Copy link
Copy Markdown
Contributor

@stsmurf stsmurf commented Jan 16, 2025

There is a bug in the tests with

NewMockSequence(
    NewMockFetchResponse(t, 1).
        SetMessage("my-topic", 0, 0, StringEncoder("foo")).
        SetMessage("my-topic", 0, 1, StringEncoder("bar")),
    NewMockFetchResponse(t, 1),
)

This sets the message on the first NewMockFetchResponse twice and does not set the message on the second response. This was covered up in the test because of the break in the for loop over claim.Messages(). The update now passes the messages through a channel back to the test for assertion.

In addition, the context.WithCancel was not having any affect on the test. Closing the group causes the context to be Done. This is verified by utilizing the same channel.

Copy link
Copy Markdown
Collaborator

@dnwe dnwe left a comment

Choose a reason for hiding this comment

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

Thanks! Good spot

@dnwe dnwe added the tests label Jan 17, 2025
@dnwe dnwe merged commit 54ceae4 into IBM:main Jan 17, 2025
@stsmurf stsmurf deleted the stsmurf/consumer-group-example branch January 17, 2025 15:35
@dnwe dnwe added the fix label Mar 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants