git.iko.soy/distributed-process
on master help sign in
Make testTerminate time-insensitive.
7c9f648Facundo Domínguez
distributed-process-tests/src/Control/Distributed/Process/Tests/CH.hs+3−12
@@ -560,19 +560,10 @@ testMergeChannels TestTransport{..} = do
560testTerminate :: TestTransport -> Assertion
560testTerminate :: TestTransport -> Assertion
561testTerminate TestTransport{..} = do
561testTerminate TestTransport{..} = do
562 localNode <- newLocalNode testTransport initRemoteTable
562 localNode <- newLocalNode testTransport initRemoteTable
563− done <- newEmptyMVar
564−
565− pid <- forkProcess localNode $ do
566− liftIO $ threadDelay 100000
567− terminate
568−
569 runProcess localNode $ do
563 runProcess localNode $ do
570− ref <- monitor pid
564+ e <- try terminate :: Process (Either ProcessTerminationException ())
571− ProcessMonitorNotification ref' pid' (DiedException ex) <- expect
572− True <- return $ ref == ref' && pid == pid' && ex == show ProcessTerminationException
565+ True <- return $ either show show e == show ProcessTerminationException
573− liftIO $ putMVar done ()
566+ return ()
574−
575− takeMVar done
576
567
577testMonitorNode :: TestTransport -> Assertion
568testMonitorNode :: TestTransport -> Assertion
578testMonitorNode TestTransport{..} = do
569testMonitorNode TestTransport{..} = do