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

HOTFIX: testInitTransactionTimeout should use prepareResponse instead of respond #8179

Merged
merged 4 commits into from
Feb 27, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,7 @@
* A mock network client for use testing code
*/
public class MockClient implements KafkaClient {
public static final RequestMatcher ALWAYS_TRUE = new RequestMatcher() {
@Override
public boolean matches(AbstractRequest body) {
return true;
}
};
public static final RequestMatcher ALWAYS_TRUE = body -> true;

private static class FutureResponse {
private final Node node;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,11 @@ public void testInitTransactionTimeout() {

assertThrows(TimeoutException.class, producer::initTransactions);

client.respond(FindCoordinatorResponse.prepareResponse(Errors.NONE, host1));
client.prepareResponse(
request -> request instanceof FindCoordinatorRequest &&
((FindCoordinatorRequest) request).data().keyType() == FindCoordinatorRequest.CoordinatorType.TRANSACTION.id(),
FindCoordinatorResponse.prepareResponse(Errors.NONE, host1));

client.prepareResponse(initProducerIdResponse(1L, (short) 5, Errors.NONE));

// retry initialization should work
Expand Down