From 17fe2cf406753f1f7de76dcea835f2b81090107a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Wed, 17 Jul 2024 20:49:31 +0200 Subject: (test) Merge multiple data responses into a single stream Changelog: Fix sending multiple data responses in a stream --- network.test | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/network.test b/network.test index 9540bf6..efd508f 100644 --- a/network.test +++ b/network.test @@ -178,6 +178,62 @@ test ManyStreams: expect /test-message-received blob 100[2-4] $ref/ from p2 +test MultipleServiceRefs: + spawn as p1 + spawn as p2 + send "create-identity Device1" to p1 + send "create-identity Device2" to p2 + send "start-server" to p1 + 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/ + + let kbytes = 2 + + with p1: + send "store blob" + send "A" + send "" + expect /store-done (blake2#[0-9a-f]*)/ capture ref_a + + # Create blobs with (kbytes * 1000) bytes each + + send "store blob" + send "B" + for j in [1 .. kbytes * 10]: + # 100 bytes each line + send "123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789" + send "" + expect /store-done (blake2#[0-9a-f]*)/ capture ref_b + + send "store blob" + send "C" + for j in [1 .. kbytes * 10]: + # 100 bytes each line + send "123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789" + send "" + expect /store-done (blake2#[0-9a-f]*)/ capture ref_c + + send "store blob" + send "D" + for j in [1 .. kbytes * 10]: + # 100 bytes each line + send "123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789" + send "" + expect /store-done (blake2#[0-9a-f]*)/ capture ref_d + + send "test-message-send 1 $ref_a $ref_b $ref_c $ref_d" + expect /test-message-send done/ + expect /test-message-received blob [0-9]+ $ref_a/ from p2 + expect /test-message-received blob [0-9]+ $ref_b/ from p2 + expect /test-message-received blob [0-9]+ $ref_c/ from p2 + expect /test-message-received blob [0-9]+ $ref_d/ from p2 + + test Reconnection: spawn as p1 with p1: -- cgit v1.2.3 From 65c8060e75c91ee083f622b8058d0ba79a34e319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 10 Aug 2024 21:52:06 +0200 Subject: (test) Chatroom members and join/leave commands --- chatroom.test | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/chatroom.test b/chatroom.test index 1998290..93de1ff 100644 --- a/chatroom.test +++ b/chatroom.test @@ -344,3 +344,85 @@ test ParallelThreads: with p2: expect /chatroom-message-new $room1_p2 room first_room from Owner. text message(..)/ capture msg guard (msg == "1B") + + +test ChatroomMembers: + spawn as p1 + spawn as p2 + spawn as p3 + + send "create-identity Device1 Owner1" to p1 + send "create-identity Device2 Owner2" to p2 + send "create-identity Device3 Owner3" to p3 + + for p in [ p1, p2, p3 ]: + with p: + send "chatroom-watch-local" + send "start-server" + + send "chatroom-create first_room" to p1 + expect /chatroom-create-done ([a-z0-9#]+) first_room.*/ from p1 capture room1_p1 + + expect /chatroom-watched-added $room1_p1 first_room sub true/ from p1 + expect /chatroom-watched-added ([a-z0-9#]+) first_room sub false/ from p2 capture room1_p2 + expect /chatroom-watched-added ([a-z0-9#]+) first_room sub false/ from p3 capture room1_p3 + + local: + send "chatroom-members $room1_p1" to p1 + expect /chatroom-members-([a-z]+)/ from p1 capture done + guard (done == "done") + local: + send "chatroom-members $room1_p2" to p2 + expect /chatroom-members-([a-z]+)/ from p2 capture done + guard (done == "done") + + send "chatroom-message-send $room1_p1 message1" to p1 + send "chatroom-message-send $room1_p1 message2" to p1 + send "chatroom-join $room1_p2" to p2 + send "chatroom-message-send $room1_p2 message3" to p2 + send "chatroom-join $room1_p3" to p3 + + with p1: + expect /chatroom-message-new $room1_p1 room first_room from Owner1 text message2/ + expect /chatroom-message-new $room1_p1 room first_room from Owner2 text message3/ + expect /chatroom-message-new $room1_p1 room first_room from Owner3/ + with p2: + expect /chatroom-message-new $room1_p2 room first_room from Owner1 text message2/ + expect /chatroom-message-new $room1_p2 room first_room from Owner2 text message3/ + expect /chatroom-message-new $room1_p2 room first_room from Owner3/ + with p3: + expect /chatroom-message-new $room1_p3 room first_room from Owner1 text message2/ + expect /chatroom-message-new $room1_p3 room first_room from Owner2 text message3/ + expect /chatroom-message-new $room1_p3 room first_room from Owner3/ + + local: + send "chatroom-members $room1_p1" to p1 + expect /chatroom-members-item Owner1/ from p1 + expect /chatroom-members-item Owner2/ from p1 + expect /chatroom-members-item Owner3/ from p1 + expect /chatroom-members-([a-z]+)/ from p1 capture done + guard (done == "done") + local: + send "chatroom-members $room1_p2" to p2 + expect /chatroom-members-item Owner1/ from p2 + expect /chatroom-members-item Owner2/ from p2 + expect /chatroom-members-item Owner3/ from p2 + expect /chatroom-members-([a-z]+)/ from p2 capture done + guard (done == "done") + + send "chatroom-leave $room1_p1" to p1 + send "chatroom-leave $room1_p3" to p3 + + for p in [ p1, p2, p3 ]: + with p: + expect /chatroom-message-new [a-z0-9#]+ room first_room from Owner1 leave/ + expect /chatroom-message-new [a-z0-9#]+ room first_room from Owner3 leave/ + + send "chatroom-members $room1_p1" to p1 + send "chatroom-members $room1_p2" to p2 + send "chatroom-members $room1_p3" to p3 + for p in [ p1, p2, p3 ]: + with p: + expect /chatroom-members-item Owner2/ + expect /chatroom-members-([a-z]+)/ capture done + guard (done == "done") -- cgit v1.2.3