@@ -62,7 +62,6 @@ trait PartitionedJournalSpecTestCases {
62
62
" A journal" must {
63
63
" store events concurrently without any gaps or duplicates among ordering (offset) values" in {
64
64
// given
65
- val perId = " perId-1"
66
65
val numOfSenders = 5
67
66
val batchSize = 1000
68
67
val senders = List .fill(numOfSenders)(TestProbe ()).zipWithIndex
@@ -72,29 +71,31 @@ trait PartitionedJournalSpecTestCases {
72
71
.sequence {
73
72
senders.map { case (sender, idx) =>
74
73
Future {
75
- writeMessages((idx * batchSize) + 1 , (idx + 1 ) * batchSize, perId, sender.ref, writerUuid)
74
+ writeMessages((idx * batchSize) + 1 , (idx + 1 ) * batchSize, s " perId- ${idx + 1 } " , sender.ref, writerUuid)
76
75
}
77
76
}
78
77
}
79
78
.futureValue(Timeout (Span (1 , Minute )))
80
79
81
80
// then
82
- val journalOps = new ScalaPostgresReadJournalOperations (system)
83
- journalOps.withCurrentEventsByPersistenceId()(perId) { tp =>
84
- tp.request(Long .MaxValue )
85
- val replayedMessages = (1 to batchSize * numOfSenders).map { _ =>
86
- tp.expectNext()
87
- }
88
- tp.expectComplete()
89
- val orderings = replayedMessages.map(_.offset).collect { case Sequence (value) =>
90
- value
91
- }
92
- orderings.size should equal(batchSize * numOfSenders)
93
- val minOrd = orderings.min
94
- val maxOrd = orderings.max
95
- val expectedOrderings = (minOrd to maxOrd).toList
81
+ senders.foreach { case (_, idx) =>
82
+ val journalOps = new ScalaPostgresReadJournalOperations (system)
83
+ journalOps.withCurrentEventsByPersistenceId()(s " perId- ${idx + 1 }" ) { tp =>
84
+ tp.request(Long .MaxValue )
85
+ val replayedMessages = (1 to batchSize).map { _ =>
86
+ tp.expectNext()
87
+ }
88
+ tp.expectComplete()
89
+ val orderings = replayedMessages.map(_.offset).collect { case Sequence (value) =>
90
+ value
91
+ }
92
+ orderings.size should equal(batchSize)
93
+ val minOrd = orderings.min
94
+ val maxOrd = orderings.max
95
+ val expectedOrderings = (minOrd to maxOrd).toList
96
96
97
- (orderings.sorted should contain).theSameElementsInOrderAs(expectedOrderings)
97
+ (orderings.sorted should contain).theSameElementsInOrderAs(expectedOrderings)
98
+ }
98
99
}
99
100
}
100
101
}
0 commit comments