injae-kim commented on code in PR #1053:
URL: https://github.com/apache/incubator-pekko/pull/1053#discussion_r1468506922


##########
stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowMapWithResourceSpec.scala:
##########
@@ -410,6 +410,24 @@ class FlowMapWithResourceSpec extends 
StreamSpec(UnboundedMailboxConfig) {
       Await.result(promise.future, 3.seconds) shouldBe Done
     }
 
+    "will close the autocloseable resource" in {
+      val closedCounter = new AtomicInteger(0)
+      val create = () => new AutoCloseable {
+        override def close(): Unit = closedCounter.incrementAndGet()
+      }
+      val (pub, sub) = TestSource
+        .probe[Int]
+        .mapWithResource(create, (_, count) => count)
+        .toMat(TestSink.probe)(Keep.both)
+        .run()
+      sub.expectSubscription().request(2)
+      pub.sendNext(1)
+      sub.expectNext(1)
+      pub.sendComplete()
+      sub.expectComplete()
+      closedCounter.get shouldBe 1

Review Comment:
   ✅ updated, I enhance test to check AutoCloseable is closed after stream is 
completed~!
   
   Also I add more test about upstream/downstream failure.



-- 
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