AKKA Remote Multi-JVM test p2p-тестирование не выполняется, тесты получают сообщения из другого теста

Я строю систему обмена файлами p2p с помощью AKKA Remote. Я пытаюсь проверить это с помощью тестового костюма MutltiJVM. У меня проблемы с барьерами и получаю следующие логи. Вот как настроены мои тесты:

"a peer" should "deploy and discover other peers" in {
  runOn(FileSharingTestConfig.node1) {
    val seedNode = system.actorOf(Props(classOf[Peer], directory1, outputPath1Native.toString(), outputPath1Hosted.toString(), None), s"seedNode")
    seedNode ! AlertWhenDeployed
    expectMsgType[Deployed](timeout.duration)
    enterBarrier("deployed1")
    enterBarrier("deployed")
  }

  runOn(FileSharingTestConfig.node2) {
    enterBarrier("deployed1")
    val seedNode: ActorRef = Await.result(system.actorSelection(node(FileSharingTestConfig.node1) / "user" / "seedNode").resolveOne(), timeout.duration).asInstanceOf[ActorRef]
    val peer1 = system.actorOf(Props(classOf[Peer], directory2, outputPath2Native.toString(), outputPath2Hosted.toString(), Option(seedNode)), "peer1")
    peer1 ! AlertWhenDeployed
    expectMsgType[Deployed](timeout.duration)
    enterBarrier("deployed")
  }
}

it should "download files" in{
  runOn(FileSharingTestConfig.node1) {
    enterBarrier("testsdone")
  }
  runOn(FileSharingTestConfig.node2) {
    val peer1 = Await.result(system.actorSelection(node(FileSharingTestConfig.node2) / "user" / "peer1").resolveOne(), timeout.duration).asInstanceOf[ActorRef]
    peer1 ! GetFile(s"File0.txt", 0)
    expectMsgType[FileDone]
    enterBarrier("testsdone")
  }
}

Я получаю следующие результаты теста:

[JVM-2] - should wait for all nodes to enter a barrier after deployment. *** FAILED ***
[JVM-2]   java.lang.AssertionError: assertion failed: timeout (10 seconds) during expectMsgClass waiting for class com.joel.fileSharing.commons.Deployed

а потом

[JVM-5] - should be able to get file0 from each other *** FAILED ***
[JVM-5]   java.lang.AssertionError: assertion failed: expected class com.joel.fileSharing.commons.FileDone, found class com.joel.fileSharing.commons.Deployed (Deployed(false))

Это указывало бы на то, что либо барьеры не работают так, как я думаю, либо узлам требуется более 10 секунд для инициализации. Я почти уверен, что пирам не требуется 10 секунд для развертывания и поиска пиров. Что тут происходит?

0 ответов

Другие вопросы по тегам