@@ -658,6 +658,26 @@ testRegistry TestTransport{..} = do
658
658
659
659
takeMVar done
660
660
661
+ testRegistryRemoteProcess :: TestTransport -> Assertion
662
+ testRegistryRemoteProcess TestTransport {.. } = do
663
+ node1 <- newLocalNode testTransport initRemoteTable
664
+ node2 <- newLocalNode testTransport initRemoteTable
665
+ done <- newEmptyMVar
666
+
667
+ pingServer <- forkProcess node1 ping
668
+
669
+ runProcess node2 $ do
670
+ register " ping" pingServer
671
+ Just pid <- whereis " ping"
672
+ True <- return $ pingServer == pid
673
+ us <- getSelfPid
674
+ nsend " ping" (Pong us)
675
+ Ping pid' <- expect
676
+ True <- return $ pingServer == pid'
677
+ liftIO $ putMVar done ()
678
+
679
+ takeMVar done
680
+
661
681
testRemoteRegistry :: TestTransport -> Assertion
662
682
testRemoteRegistry TestTransport {.. } = do
663
683
node1 <- newLocalNode testTransport initRemoteTable
@@ -702,6 +722,30 @@ testRemoteRegistry TestTransport{..} = do
702
722
703
723
takeMVar done
704
724
725
+ testRemoteRegistryRemoteProcess :: TestTransport -> Assertion
726
+ testRemoteRegistryRemoteProcess TestTransport {.. } = do
727
+ node1 <- newLocalNode testTransport initRemoteTable
728
+ node2 <- newLocalNode testTransport initRemoteTable
729
+ done <- newEmptyMVar
730
+
731
+ pingServer <- forkProcess node2 ping
732
+
733
+ runProcess node2 $ do
734
+ let nid1 = localNodeId node1
735
+ registerRemoteAsync nid1 " ping" pingServer
736
+ receiveWait [
737
+ matchIf (\ (RegisterReply label' _ _) -> " ping" == label')
738
+ (\ (RegisterReply _ _ _) -> return () ) ]
739
+ Just pid <- whereisRemote nid1 " ping"
740
+ True <- return $ pingServer == pid
741
+ us <- getSelfPid
742
+ nsendRemote nid1 " ping" (Pong us)
743
+ Ping pid' <- expect
744
+ True <- return $ pingServer == pid'
745
+ liftIO $ putMVar done ()
746
+
747
+ takeMVar done
748
+
705
749
testSpawnLocal :: TestTransport -> Assertion
706
750
testSpawnLocal TestTransport {.. } = do
707
751
node <- newLocalNode testTransport initRemoteTable
@@ -1468,7 +1512,9 @@ tests testtrans = return [
1468
1512
, testCase " MergeChannels" (testMergeChannels testtrans)
1469
1513
, testCase " Terminate" (testTerminate testtrans)
1470
1514
, testCase " Registry" (testRegistry testtrans)
1515
+ , testCase " RegistryRemoteProcess" (testRegistryRemoteProcess testtrans)
1471
1516
, testCase " RemoteRegistry" (testRemoteRegistry testtrans)
1517
+ , testCase " RemoteRegistryRemoteProcess" (testRemoteRegistryRemoteProcess testtrans)
1472
1518
, testCase " SpawnLocal" (testSpawnLocal testtrans)
1473
1519
, testCase " SpawnAsyncStrictness" (testSpawnAsyncStrictness testtrans)
1474
1520
, testCase " HandleMessageIf" (testHandleMessageIf testtrans)
0 commit comments