Eliminate race in multi node StreamRefSpec #26392

This commit is contained in:
Johan Andrén 2019-09-17 15:42:22 +02:00
parent c30aacf991
commit 60a6e9bf5b
2 changed files with 11 additions and 5 deletions

View file

@ -27,6 +27,7 @@ import scala.concurrent.Future
import scala.concurrent.duration._
import scala.util.Failure
import scala.util.Success
import akka.util.JavaDurationConverters._
object StreamRefSpec extends MultiNodeConfig {
val first = role("first")
@ -244,7 +245,14 @@ abstract class StreamRefSpec extends MultiNodeSpec(StreamRefSpec) with MultiNode
streamLifecycle1.expectMsg("failed-system-42-tmp")
}
runOn(third) {
streamLifecycle3.expectMsg("failed-system-42-tmp")
// there's a race here, we know the SourceRef actor was started but we don't know if it
// got the remote actor ref and watched it terminate or if we cut connection before that
// and it triggered the subscription timeout. Therefore we must wait more than the
// the subscription timeout for a failure
val timeout = system.settings.config
.getDuration("akka.stream.materializer.subscription-timeout.timeout")
.asScala + 2.seconds
streamLifecycle3.expectMsg(timeout, "failed-system-42-tmp")
}
enterBarrier("after-3")