Skip to content

Commit dfff79f

Browse files
d-p-tests: Fix SpawnRace.
The transport is wrapped to drop some messages. But the transport was not made to fail and this sometimes caused the test to fail with no good reason.
1 parent 5a5baf2 commit dfff79f

File tree

1 file changed

+5
-3
lines changed
  • distributed-process-tests/src/Control/Distributed/Process/Tests

1 file changed

+5
-3
lines changed

distributed-process-tests/src/Control/Distributed/Process/Tests/Closure.hs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,14 +305,16 @@ testSpawnRace TestTransport{..} rtable = do
305305
wrapEP e =
306306
e { NT.connect = \x y z -> do
307307
healthy <- newIORef True
308-
fmap (fmap $ wrapConnection healthy) $ NT.connect e x y z
308+
fmap (fmap $ wrapConnection healthy e x) $ NT.connect e x y z
309309
}
310310

311-
wrapConnection :: IORef Bool -> NT.Connection -> NT.Connection
312-
wrapConnection healthy (NT.Connection s closeC) =
311+
wrapConnection :: IORef Bool -> NT.EndPoint -> NT.EndPointAddress
312+
-> NT.Connection -> NT.Connection
313+
wrapConnection healthy e remoteAddr (NT.Connection s closeC) =
313314
flip NT.Connection closeC $ \msg -> do
314315
when (msg == messageToPayload (createMessage ())) $ do
315316
writeIORef healthy False
317+
testBreakConnection (NT.address e) remoteAddr
316318
isHealthy <- readIORef healthy
317319
if isHealthy then s msg
318320
else return $ Left $ NT.TransportError NT.SendFailed ""

0 commit comments

Comments
 (0)