Skip to content

Commit 524f82b

Browse files
authored
fix: poll bind via UDP before starting tests (#2475)
Potential fix for #2398: perhaps Bind is simply not fully started and ready to respond to queries when we see 'Starting BIND' - potentially more reliable to perform an actual request?
1 parent f0db8f0 commit 524f82b

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

actor-tests/src/test/scala/org/apache/pekko/io/dns/AsyncDnsResolverIntegrationSpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class AsyncDnsResolverIntegrationSpec
7272
system.log.info("Docker available. Running DNS tests")
7373
}
7474

75-
"resolve single A record" in {
75+
"resolve a single A record" in {
7676
val name = "a-single.foo.test"
7777
val answer = resolve(name, DnsProtocol.Ip(ipv6 = false))
7878
withClue(answer) {

actor-tests/src/test/scala/org/apache/pekko/io/dns/DockerBindDnsService.scala

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import scala.concurrent.duration._
1717
import scala.jdk.CollectionConverters._
1818
import scala.util.Try
1919
import scala.util.control.NonFatal
20-
2120
import com.github.dockerjava.api.DockerClient
2221
import com.github.dockerjava.api.async.ResultCallback
2322
import com.github.dockerjava.api.command.CreateContainerCmd
@@ -26,10 +25,11 @@ import com.github.dockerjava.core.{ DefaultDockerClientConfig, DockerClientConfi
2625
import com.github.dockerjava.httpclient5.ApacheDockerHttpClient
2726

2827
import org.apache.pekko
29-
import pekko.testkit.PekkoSpec
28+
import pekko.io.{ Dns, IO }
29+
import pekko.util.Timeout
3030

31+
import pekko.testkit.PekkoSpec
3132
import org.scalatest.concurrent.Eventually
32-
3333
import com.typesafe.config.Config
3434

3535
abstract class DockerBindDnsService(config: Config) extends PekkoSpec(config) with Eventually {
@@ -122,6 +122,12 @@ abstract class DockerBindDnsService(config: Config) extends PekkoSpec(config) wi
122122

123123
reader.toString should include("Starting BIND")
124124
}
125+
eventually(timeout(25.seconds)) {
126+
import pekko.pattern.ask
127+
implicit val timeout: Timeout = 2.seconds
128+
(IO(Dns) ? DnsProtocol.Resolve("a-single.foo.test", DnsProtocol.Ip(ipv6 = false))).mapTo[
129+
DnsProtocol.Resolved].futureValue
130+
}
125131
}
126132

127133
def dumpNameserverLogs(): Unit = {

0 commit comments

Comments
 (0)