git.iko.soy/distributed-process
on master help sign in
Additional test case for monitoring a "live" node that subsequently dies
commitaa42de9a65b10d7203301859d0c05d669db2cd16 authorTim Watson <tim@rabbitmq.com> dateThu 9 May 2013, 21:35 (13 years ago) parent6aa01c6
1 file changed+19
tests/TestCH.hs+19
tests/TestCH.hs+19
@@ -561,6 +561,24 @@ testMonitorNode transport = do
561561
562562 takeMVar done
563563
564+testMonitorLiveNode :: NT.Transport -> Assertion
565+testMonitorLiveNode transport = do
566+ [node1, node2] <- replicateM 2 $ newLocalNode transport initRemoteTable
567+ ready <- newEmptyMVar
568+ done <- newEmptyMVar
569+
570+ forkProcess node2 $ do
571+ ref <- monitorNode (localNodeId node1)
572+ liftIO $ putMVar ready ()
573+ NodeMonitorNotification ref' nid _ <- expect
574+ True <- return $ ref == ref' && nid == localNodeId node1
575+ liftIO $ putMVar done ()
576+
577+ takeMVar ready
578+ closeLocalNode node1
579+
580+ takeMVar done
581+
564582testMonitorChannel :: NT.Transport -> Assertion
565583testMonitorChannel transport = do
566584 [node1, node2] <- replicateM 2 $ newLocalNode transport initRemoteTable
@@ -1281,6 +1299,7 @@ tests (transport, transportInternals) = [
12811299 , testCase "UnlinkDisconnect" (testMonitorDisconnect transport False True)
12821300 -- Monitoring nodes and channels
12831301 , testCase "MonitorNode" (testMonitorNode transport)
1302+ , testCase "MonitorLiveNode" (testMonitorLiveNode transport)
12841303 , testCase "MonitorChannel" (testMonitorChannel transport)
12851304 -- Reconnect
12861305 , testCase "Reconnect" (testReconnect transport transportInternals)