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

Test http server requests in parallel #8222

Merged
merged 3 commits into from
Jan 16, 2025
Merged
Changes from 2 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 @@ -47,6 +47,8 @@ import org.slf4j.Logger
import org.slf4j.LoggerFactory

import javax.annotation.Nonnull
import java.util.concurrent.ExecutorCompletionService
import java.util.concurrent.Executors
import java.util.function.BiFunction
import java.util.function.Function
import java.util.function.Supplier
Expand Down Expand Up @@ -529,9 +531,15 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
def "test success with #count requests"() {
setup:
def request = request(SUCCESS, method, body).build()
List<Response> responses = (1..count).collect {
return client.newCall(request).execute()
def executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors())
def completionService = new ExecutorCompletionService(executor)
(1..count).each {
completionService.submit {
client.newCall(request).execute()
}
}
def responses = (1..count).collect {completionService.take().get()}

if (isDataStreamsEnabled()) {
TEST_DATA_STREAMS_WRITER.waitForGroups(1)
}
Expand Down
Loading