Skip to content

Commit

Permalink
Fix ZIO interruption test again
Browse files Browse the repository at this point in the history
  • Loading branch information
neko-kai committed Aug 30, 2023
1 parent 066f7e1 commit 21eddab
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ class ZIOWorkaroundsTest extends AnyWordSpec {
for {
fiberStarted <- F.mkLatch
stopFiber <- F.mkLatch
stopFiber2 <- F.mkLatch
innerFiberNotInterrupted <- F.mkLatch
outerFiberNotInterrupted <- F.mkLatch
fiberNotInterrupted1 <- F.mkRef(false)
Expand All @@ -200,7 +201,8 @@ class ZIOWorkaroundsTest extends AnyWordSpec {
).flatMap {
promiseModifiedOrTimedOut =>
fiberNotInterrupted2.set(promiseModifiedOrTimedOut) *>
outerFiberNotInterrupted.succeed(())
outerFiberNotInterrupted.succeed(()) *>
stopFiber2.await
}
)
}
Expand All @@ -215,6 +217,7 @@ class ZIOWorkaroundsTest extends AnyWordSpec {
)
isNotInterrupted1 <- fiberNotInterrupted1.get
isNotInterrupted2 <- fiberNotInterrupted2.get
_ <- stopFiber2.succeed(())
} yield assert(innerIsNotInterrupted && isNotInterrupted1 && (isNotInterrupted2 == Some(true)))
}

Expand All @@ -228,6 +231,7 @@ class ZIOWorkaroundsTest extends AnyWordSpec {
for {
fiberStarted <- F.mkLatch
stopFiber <- F.mkLatch
stopFiber2 <- F.mkLatch
innerFiberNotInterrupted <- F.mkLatch
outerFiberNotInterrupted <- F.mkLatch
fiberNotInterrupted1 <- F.mkRef(false)
Expand All @@ -247,7 +251,8 @@ class ZIOWorkaroundsTest extends AnyWordSpec {
).flatMap {
promiseModifiedOrTimedOut =>
fiberNotInterrupted2.set(promiseModifiedOrTimedOut) *>
outerFiberNotInterrupted.succeed(())
outerFiberNotInterrupted.succeed(()) *>
stopFiber2.await
}
)
}
Expand All @@ -262,6 +267,7 @@ class ZIOWorkaroundsTest extends AnyWordSpec {
)
isNotInterrupted1 <- fiberNotInterrupted1.get
isNotInterrupted2 <- fiberNotInterrupted2.get
_ <- stopFiber2.succeed(())
} yield assert(innerIsNotInterrupted && isNotInterrupted1 && (isNotInterrupted2 == Some(true)))
}

Expand Down

0 comments on commit 21eddab

Please sign in to comment.