Skip to content

Commit

Permalink
add default connection timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
osoykan committed Feb 15, 2023
1 parent 09e5719 commit 909812d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,25 @@ import org.apache.http.HttpHost
import org.apache.http.auth.AuthScope
import org.apache.http.auth.UsernamePasswordCredentials
import org.apache.http.client.CredentialsProvider
import org.apache.http.client.config.RequestConfig
import org.apache.http.impl.client.BasicCredentialsProvider
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder
import org.elasticsearch.client.*
import org.testcontainers.elasticsearch.ElasticsearchContainer
import kotlin.reflect.KClass
import kotlin.time.Duration.Companion.seconds

data class ElasticClientConfigurer(
val restClientBuilder: RestClientBuilder.() -> Unit = {},
val httpClientBuilder: HttpAsyncClientBuilder.() -> Unit = {},
val httpClientBuilder: HttpAsyncClientBuilder.() -> Unit = {
setDefaultRequestConfig(
RequestConfig.custom()
.setSocketTimeout(5.seconds.inWholeMilliseconds.toInt())
.setConnectTimeout(5.seconds.inWholeMilliseconds.toInt())
.setConnectionRequestTimeout(5.seconds.inWholeMilliseconds.toInt())
.build()
)
},
)

data class ElasticsearchSystemOptions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class NoOpApplication : ApplicationUnderTest<Unit> {
}
}

class CouchbaseTestSystemTests : FunSpec({
class ElasticsearchTestSystemTests : FunSpec({

@JsonIgnoreProperties
data class ExampleInstance(
Expand Down

0 comments on commit 909812d

Please sign in to comment.