He-Pin commented on code in PR #603:
URL: https://github.com/apache/incubator-pekko/pull/603#discussion_r1311905533


##########
stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowStatefulMapSpec.scala:
##########
@@ -280,4 +283,64 @@ class FlowStatefulMapSpec extends StreamSpec {
         .expectComplete()
     }
   }
+
+  "won't call onComplete twice when downstream cancelled even if onComplete 
throws" in {
+    var counter = 0
+
+    def badDtor() = {
+      counter += 1
+      throw dtorException
+    }
+
+    Source.never[String]
+      .statefulMap(() => None)((s, e) => s -> e,
+        _ => {
+          badDtor()
+          None
+        })
+      .runWith(Sink.cancelled)
+
+    StreamTestKit.assertAllStagesStopped(None)
+    counter shouldBe 1
+  }
+
+  "won't call onComplete twice when upstream failed even if onComplete throws" 
in {
+    var counter = 0
+
+    def badDtor() = {
+      counter += 1
+      throw dtorException
+    }
+
+    Source.failed[String](ex)
+      .statefulMap(() => None)((s, e) => s -> e,
+        _ => {
+          badDtor()
+          None
+        })
+      .runWith(Sink.ignore)
+
+    StreamTestKit.assertAllStagesStopped(None)
+    counter shouldBe 1
+  }
+
+  "won't call onComplete twice when upstream finished even if onComplete 
throws" in {

Review Comment:
   `in assertAllStagesStopped {` or jsut remove it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to