Skip to content

Commit fa58b3c

Browse files
committed
ETCM-345: Message order can be reversed in test.
1 parent 07c3a81 commit fa58b3c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

scalanet/test/src/io/iohk/scalanet/peergroup/udp/StaticUDPPeerGroupSpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class StaticUDPPeerGroupSpec extends UDPPeerGroupSpec("StaticUDPPeerGroup") with
133133
received <- receivers.traverse(_.join)
134134
} yield {
135135
received(0) shouldBe List("Two to One")
136-
received(1) shouldBe List("Three to One A", "Three to One B")
136+
received(1) should contain theSameElementsAs List("Three to One A", "Three to One B")
137137
received(2) shouldBe received(1)
138138
}
139139
}

scalanet/test/src/io/iohk/scalanet/peergroup/udp/UDPPeerGroupSpec.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ abstract class UDPPeerGroupSpec[PG <: UDPPeerGroupSpec.TestGroup[_]](name: Strin
3030
import UDPPeerGroupSpec.TestGroup
3131
import scala.language.reflectiveCalls
3232

33+
val testTimeout = 15.seconds
34+
3335
implicit val scheduler = Scheduler.fixedPool("test", 16)
3436

3537
implicit val pc: PatienceConfig = PatienceConfig(5 seconds)
@@ -57,7 +59,7 @@ abstract class UDPPeerGroupSpec[PG <: UDPPeerGroupSpec.TestGroup[_]](name: Strin
5759
case (pg1, pg2) =>
5860
testCode(pg1, pg2).void
5961
}
60-
.runSyncUnsafe(15.seconds)
62+
.runSyncUnsafe(testTimeout)
6163
}
6264

6365
def withARandomUDPPeerGroup[M](
@@ -67,7 +69,7 @@ abstract class UDPPeerGroupSpec[PG <: UDPPeerGroupSpec.TestGroup[_]](name: Strin
6769
.use { pg =>
6870
testCode(pg).void
6971
}
70-
.runSyncUnsafe(15.seconds)
72+
.runSyncUnsafe(testTimeout)
7173
}
7274

7375
it should "report an error for sending a message greater than the MTU" in
@@ -91,7 +93,7 @@ abstract class UDPPeerGroupSpec[PG <: UDPPeerGroupSpec.TestGroup[_]](name: Strin
9193
}
9294

9395
it should "send and receive a message" in withTwoRandomUDPPeerGroups[String] { (alice, bob) =>
94-
StandardTestPack.messagingTest(alice, bob).recover {
96+
StandardTestPack.messagingTest(alice, bob).timeout(testTimeout - 1.second).recover {
9597
case _: TimeoutException if sys.env.get("CI").contains("true") =>
9698
cancel("ETCM-345: Intermittent timeout on Circle CI.")
9799
}

0 commit comments

Comments
 (0)