@@ -653,6 +653,26 @@ testRegistry TestTransport{..} = do
653
653
654
654
takeMVar done
655
655
656
+ testRegistryRemoteProcess :: TestTransport -> Assertion
657
+ testRegistryRemoteProcess TestTransport {.. } = do
658
+ node1 <- newLocalNode testTransport initRemoteTable
659
+ node2 <- newLocalNode testTransport initRemoteTable
660
+ done <- newEmptyMVar
661
+
662
+ pingServer <- forkProcess node1 ping
663
+
664
+ runProcess node2 $ do
665
+ register " ping" pingServer
666
+ Just pid <- whereis " ping"
667
+ True <- return $ pingServer == pid
668
+ us <- getSelfPid
669
+ nsend " ping" (Pong us)
670
+ Ping pid' <- expect
671
+ True <- return $ pingServer == pid'
672
+ liftIO $ putMVar done ()
673
+
674
+ takeMVar done
675
+
656
676
testRemoteRegistry :: TestTransport -> Assertion
657
677
testRemoteRegistry TestTransport {.. } = do
658
678
node1 <- newLocalNode testTransport initRemoteTable
@@ -697,6 +717,30 @@ testRemoteRegistry TestTransport{..} = do
697
717
698
718
takeMVar done
699
719
720
+ testRemoteRegistryRemoteProcess :: TestTransport -> Assertion
721
+ testRemoteRegistryRemoteProcess TestTransport {.. } = do
722
+ node1 <- newLocalNode testTransport initRemoteTable
723
+ node2 <- newLocalNode testTransport initRemoteTable
724
+ done <- newEmptyMVar
725
+
726
+ pingServer <- forkProcess node2 ping
727
+
728
+ runProcess node2 $ do
729
+ let nid1 = localNodeId node1
730
+ registerRemoteAsync nid1 " ping" pingServer
731
+ receiveWait [
732
+ matchIf (\ (RegisterReply label' _ _) -> " ping" == label')
733
+ (\ (RegisterReply _ _ _) -> return () ) ]
734
+ Just pid <- whereisRemote nid1 " ping"
735
+ True <- return $ pingServer == pid
736
+ us <- getSelfPid
737
+ nsendRemote nid1 " ping" (Pong us)
738
+ Ping pid' <- expect
739
+ True <- return $ pingServer == pid'
740
+ liftIO $ putMVar done ()
741
+
742
+ takeMVar done
743
+
700
744
testSpawnLocal :: TestTransport -> Assertion
701
745
testSpawnLocal TestTransport {.. } = do
702
746
node <- newLocalNode testTransport initRemoteTable
@@ -1368,7 +1412,9 @@ tests testtrans = return [
1368
1412
, testCase " MergeChannels" (testMergeChannels testtrans)
1369
1413
, testCase " Terminate" (testTerminate testtrans)
1370
1414
, testCase " Registry" (testRegistry testtrans)
1415
+ , testCase " RegistryRemoteProcess" (testRegistryRemoteProcess testtrans)
1371
1416
, testCase " RemoteRegistry" (testRemoteRegistry testtrans)
1417
+ , testCase " RemoteRegistryRemoteProcess" (testRemoteRegistryRemoteProcess testtrans)
1372
1418
, testCase " SpawnLocal" (testSpawnLocal testtrans)
1373
1419
, testCase " HandleMessageIf" (testHandleMessageIf testtrans)
1374
1420
, testCase " MatchAny" (testMatchAny testtrans)
0 commit comments