summaryrefslogtreecommitdiff
path: root/test/network.test
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2024-05-25 10:40:03 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2024-05-25 22:40:42 +0200
commitdb575cad9b8a3c3c2ab9f1a71ac2ea442c761df2 (patch)
treec5b4b080a7f0767beefe06a216d720a90eb79850 /test/network.test
parente40317a3b43594c0629c8a0d1d569b4c8d55e2ae (diff)
Handle peer reconnection after its restart
Allow the handshake and channel request to proceed correcty even with already established channel to handle the case where peer attempts to reconnect after restart. Changelog: Handle peer reconnection after its restart
Diffstat (limited to 'test/network.test')
-rw-r--r--test/network.test49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/network.test b/test/network.test
index 93f9743..ea57a77 100644
--- a/test/network.test
+++ b/test/network.test
@@ -176,3 +176,52 @@ test ManyStreams:
send "test-message-send 1 $ref"
expect /test-message-send done/
expect /test-message-received blob 100[2-4] $ref/ from p2
+
+
+test Reconnection:
+ spawn as p1
+ with p1:
+ send "create-identity Device1"
+ send "start-server"
+
+ node n
+ local:
+ spawn as p2 on n
+ send "create-identity Device2" to p2
+ send "start-server" to p2
+
+ expect from p1:
+ /peer 1 addr ${p2.node.ip} 29665/
+ /peer 1 id Device2/
+ expect from p2:
+ /peer 1 addr ${p1.node.ip} 29665/
+ /peer 1 id Device1/
+
+ with p1:
+ send "store blob"
+ send "message1"
+ send ""
+ expect /store-done (blake2#[0-9a-f]*)/ from p1 capture message
+
+ send "test-message-send 1 $message"
+ expect /test-message-send done/
+ expect /test-message-received blob [0-9]+ $message/ from p2
+
+ local:
+ spawn as p2 on n
+ send "start-server" to p2
+ send "peer-add ${p1.node.ip}" to p2
+
+ expect from p2:
+ /peer 1 addr ${p1.node.ip} 29665/
+ /peer 1 id Device1/
+
+ with p1:
+ send "store blob"
+ send "message2"
+ send ""
+ expect /store-done (blake2#[0-9a-f]*)/ from p1 capture message
+
+ send "test-message-send 1 $message"
+ expect /test-message-send done/
+ expect /test-message-received blob [0-9]+ $message/ from p2