fix: AsyncDnsResolverIntegrationSpec failing with timeout from config (#30756)
This commit is contained in:
parent
4e98300f49
commit
3cb335e5f9
1 changed files with 21 additions and 16 deletions
|
|
@ -21,27 +21,36 @@ import akka.testkit.SocketUtil.Both
|
||||||
import akka.testkit.WithLogCapturing
|
import akka.testkit.WithLogCapturing
|
||||||
import akka.util.Timeout
|
import akka.util.Timeout
|
||||||
|
|
||||||
/*
|
/**
|
||||||
These tests rely on a DNS server with 2 zones configured, foo.test and bar.example.
|
* These tests rely on a DNS server with 2 zones configured, foo.test and bar.example.
|
||||||
|
*
|
||||||
The configuration to start a bind DNS server in Docker with this configuration
|
* The configuration to start a bind DNS server in Docker with this configuration
|
||||||
is included, and the test will automatically start this container when the
|
* is included, and the test will automatically start this container when the
|
||||||
test starts and tear it down when it finishes.
|
* test starts and tear it down when it finishes.
|
||||||
*/
|
*/
|
||||||
class AsyncDnsResolverIntegrationSpec extends DockerBindDnsService(ConfigFactory.parseString(s"""
|
object AsyncDnsResolverIntegrationSpec {
|
||||||
|
lazy val dockerDnsServerPort: Int = SocketUtil.temporaryLocalPort(Both)
|
||||||
|
implicit val defaultTimeout: Timeout = Timeout(10.seconds)
|
||||||
|
def conf = ConfigFactory.parseString(s"""
|
||||||
akka.loglevel = DEBUG
|
akka.loglevel = DEBUG
|
||||||
akka.loggers = ["akka.testkit.SilenceAllTestEventListener"]
|
akka.loggers = ["akka.testkit.SilenceAllTestEventListener"]
|
||||||
akka.io.dns.resolver = async-dns
|
akka.io.dns.resolver = async-dns
|
||||||
akka.io.dns.async-dns.nameservers = ["localhost:${AsyncDnsResolverIntegrationSpec.dockerDnsServerPort}"]
|
akka.io.dns.async-dns.nameservers = ["localhost:${dockerDnsServerPort}"]
|
||||||
akka.io.dns.async-dns.search-domains = ["foo.test", "test"]
|
akka.io.dns.async-dns.search-domains = ["foo.test", "test"]
|
||||||
akka.io.dns.async-dns.ndots = 2
|
akka.io.dns.async-dns.ndots = 2
|
||||||
""")) with WithLogCapturing {
|
akka.io.dns.async-dns.resolve-timeout = ${defaultTimeout.duration.toSeconds}s
|
||||||
|
""")
|
||||||
|
}
|
||||||
|
|
||||||
|
class AsyncDnsResolverIntegrationSpec
|
||||||
|
extends DockerBindDnsService(AsyncDnsResolverIntegrationSpec.conf)
|
||||||
|
with WithLogCapturing {
|
||||||
|
import AsyncDnsResolverIntegrationSpec._
|
||||||
|
|
||||||
implicit val timeout: Timeout = Timeout(10.seconds)
|
|
||||||
override implicit val patience: PatienceConfig =
|
override implicit val patience: PatienceConfig =
|
||||||
PatienceConfig(timeout.duration + 1.second, Span(100, Millis))
|
PatienceConfig(defaultTimeout.duration + 1.second, Span(100, Millis))
|
||||||
|
|
||||||
val hostPort = AsyncDnsResolverIntegrationSpec.dockerDnsServerPort
|
override val hostPort = dockerDnsServerPort
|
||||||
|
|
||||||
"Resolver" must {
|
"Resolver" must {
|
||||||
if (!dockerAvailable()) {
|
if (!dockerAvailable()) {
|
||||||
|
|
@ -198,7 +207,3 @@ class AsyncDnsResolverIntegrationSpec extends DockerBindDnsService(ConfigFactory
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object AsyncDnsResolverIntegrationSpec {
|
|
||||||
lazy val dockerDnsServerPort: Int = SocketUtil.temporaryLocalPort(Both)
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue