Skip to content

Commit

Permalink
Fix test in rare cases when an element gets buffered on a rendezvous …
Browse files Browse the repository at this point in the history
…channelx
  • Loading branch information
adamw committed Dec 23, 2024
1 parent 8340a63 commit 74b47c4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/src/test/scala/ox/flow/FlowOpsMapStatefulTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ class FlowOpsMapStatefulTest extends AnyFlatSpec with Matchers:

s.receive() shouldBe "a"
s.receive() shouldBe "b"
s.receive() shouldBe "c"
// it's possible that the final receive fails as well - when a receiver increments the receive counter
// (reserving the cell), but doesn't CAS the cell itself, the sender might buffer the element (knowing
// that a receiver is coming), and then proceed to closing the channel
s.receiveOrClosed() should (be("c") or matchPattern {
case ChannelClosed.Error(reason) if reason.getMessage == "boom" =>
})
s.receiveOrClosed() should matchPattern:
case ChannelClosed.Error(reason) if reason.getMessage == "boom" =>
end FlowOpsMapStatefulTest

0 comments on commit 74b47c4

Please sign in to comment.