Skip to content

KAFKA-19241: Updated tests in ShareFetchAcknowledgeRequestTest to reuse the socket for subsequent requests #19640

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
May 7, 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
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,24 @@ class GroupCoordinatorBaseRequestTest(cluster: ClusterInstance) {
assertEquals(expectedResponseData.results.asScala.toSet, deleteGroupsResponse.data.results.asScala.toSet)
}

protected def connectAny(): Socket = {
val socket: Socket = IntegrationTestUtils.connect(
cluster.anyBrokerSocketServer(),
cluster.clientListener()
)
openSockets += socket
socket
}

protected def connect(destination: Int): Socket = {
val socket: Socket = IntegrationTestUtils.connect(
brokerSocketServer(destination),
cluster.clientListener()
)
openSockets += socket
socket
}

protected def connectAndReceive[T <: AbstractResponse](
request: AbstractRequest
)(implicit classTag: ClassTag[T]): T = {
Expand All @@ -934,23 +952,6 @@ class GroupCoordinatorBaseRequestTest(cluster: ClusterInstance) {
)
}

protected def connectAndReceiveWithoutClosingSocket[T <: AbstractResponse](
request: AbstractRequest,
destination: Int
)(implicit classTag: ClassTag[T]): T = {
val socket = IntegrationTestUtils.connect(brokerSocketServer(destination), cluster.clientListener())
openSockets += socket
IntegrationTestUtils.sendAndReceive[T](request, socket)
}

protected def connectAndReceiveWithoutClosingSocket[T <: AbstractResponse](
request: AbstractRequest
)(implicit classTag: ClassTag[T]): T = {
val socket = IntegrationTestUtils.connect(cluster.anyBrokerSocketServer(), cluster.clientListener())
openSockets += socket
IntegrationTestUtils.sendAndReceive[T](request, socket)
}

private def brokerSocketServer(brokerId: Int): SocketServer = {
getBrokers.find { broker =>
broker.config.brokerId == brokerId
Expand Down
Loading