From 7a68795e4111f29caadf0f4fe74706111a2eeb26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Wed, 18 Aug 2021 22:14:56 +0200 Subject: (test) Test script for simple discovery --- discovery.test | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 discovery.test diff --git a/discovery.test b/discovery.test new file mode 100644 index 0000000..26e8eaf --- /dev/null +++ b/discovery.test @@ -0,0 +1,13 @@ +test: + spawn on node1 as p1 + spawn on node2 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 /peer [0-9]+ 192.168.0.11:29665/ from p1 + expect /peer [0-9]+ 192.168.0.12:29665/ from p1 + expect /peer [0-9]+ 192.168.0.12:29665/ from p2 + expect /peer [0-9]+ 192.168.0.11:29665/ from p2 + expect /peer [0-9]+ Device2 Device2/ from p1 + expect /peer [0-9]+ Device1 Device1/ from p2 -- cgit v1.2.3 From f29708696ba187e0c31d9f73335197b40ddbbc30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Tue, 16 Nov 2021 22:47:35 +0100 Subject: (test) Test attach and resulting local state update --- attach.test | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 attach.test diff --git a/attach.test b/attach.test new file mode 100644 index 0000000..0c97fb1 --- /dev/null +++ b/attach.test @@ -0,0 +1,27 @@ +test: + spawn on node1 as p1 + spawn on node2 as p2 + send "create-identity Device1 Owner" to p1 + send "create-identity Device2" to p2 + send "watch-local-identity" to p1 + send "watch-local-identity" to p2 + send "start-server" to p1 + send "start-server" to p2 + expect /local-identity Device1 Owner/ from p1 + expect /local-identity Device2/ from p2 + expect /peer [0-9]+ 192.168.0.11:29665/ from p1 + expect /peer [0-9]+ 192.168.0.12:29665/ from p1 + expect /peer [0-9]+ 192.168.0.12:29665/ from p2 + expect /peer [0-9]+ 192.168.0.11:29665/ from p2 + expect /peer [0-9]+ Device2 Device2/ from p1 + expect /peer [0-9]+ Owner Device1/ from p2 + send "attach Owner" to p2 + expect /attach-confirm .*/ from p1 + expect /attach-confirm .*/ from p2 + # TODO: check code match + send "attach-accept Device2 1" to p1 + send "attach-accept Owner 1" to p2 + expect /attach-result Device2 1/ from p1 + expect /attach-result Owner 1/ from p2 + expect /local-identity Device2 Owner/ from p2 + expect /peer [0-9]+ Owner Device2/ from p1 -- cgit v1.2.3 From 982020325ae7242127c7e95061052e2cbd7c02bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Tue, 23 Nov 2021 21:09:51 +0100 Subject: (test) Test sync service --- sync.test | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 sync.test diff --git a/sync.test b/sync.test new file mode 100644 index 0000000..1b243c2 --- /dev/null +++ b/sync.test @@ -0,0 +1,45 @@ +test: + spawn on node1 as p1 + spawn on node2 as p2 + send "watch-local-identity" to p1 + send "watch-local-identity" to p2 + send "watch-shared-identity" to p1 + send "watch-shared-identity" to p2 + send "create-identity Device1 Owner" to p1 + send "create-identity Device2" to p2 + send "start-server" to p1 + send "start-server" to p2 + expect /local-identity Device1 Owner/ from p1 + expect /local-identity Device2/ from p2 + expect /shared-identity Owner/ from p1 + expect /peer [0-9]+ 192.168.0.11:29665/ from p1 + expect /peer [0-9]+ 192.168.0.12:29665/ from p1 + expect /peer [0-9]+ 192.168.0.12:29665/ from p2 + expect /peer [0-9]+ 192.168.0.11:29665/ from p2 + expect /peer [0-9]+ Device2 Device2/ from p1 + expect /peer [0-9]+ Owner Device1/ from p2 + + send "attach Owner" to p2 + expect /attach-confirm .*/ from p1 + expect /attach-confirm .*/ from p2 + # TODO: check code match + + send "attach-accept Device2 1" to p1 + send "attach-accept Owner 1" to p2 + expect /attach-result Device2 1/ from p1 + expect /attach-result Owner 1/ from p2 + expect /local-identity Device2 Owner/ from p2 + expect /shared-identity Owner/ from p2 + expect /peer [0-9]+ Owner Device2/ from p1 + + send "update-shared-identity NewOwner" to p1 + expect /shared-identity NewOwner/ from p1 + expect /shared-identity NewOwner/ from p2 + + send "update-shared-identity NewOwner2" to p2 + expect /shared-identity NewOwner2/ from p1 + expect /shared-identity NewOwner2/ from p2 + + send "update-shared-identity NewOwner3" to p1 + expect /shared-identity NewOwner3/ from p1 + expect /shared-identity NewOwner3/ from p2 -- cgit v1.2.3 From 9bf7460f446c8fbb153a9a375ac6f709578241ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Thu, 9 Dec 2021 21:26:48 +0100 Subject: (test) Network: ignore packets sent by ourselves --- attach.test | 2 -- discovery.test | 2 -- sync.test | 2 -- 3 files changed, 6 deletions(-) diff --git a/attach.test b/attach.test index 0c97fb1..4e2238e 100644 --- a/attach.test +++ b/attach.test @@ -9,9 +9,7 @@ test: send "start-server" to p2 expect /local-identity Device1 Owner/ from p1 expect /local-identity Device2/ from p2 - expect /peer [0-9]+ 192.168.0.11:29665/ from p1 expect /peer [0-9]+ 192.168.0.12:29665/ from p1 - expect /peer [0-9]+ 192.168.0.12:29665/ from p2 expect /peer [0-9]+ 192.168.0.11:29665/ from p2 expect /peer [0-9]+ Device2 Device2/ from p1 expect /peer [0-9]+ Owner Device1/ from p2 diff --git a/discovery.test b/discovery.test index 26e8eaf..aba6b15 100644 --- a/discovery.test +++ b/discovery.test @@ -5,9 +5,7 @@ test: send "create-identity Device2" to p2 send "start-server" to p1 send "start-server" to p2 - expect /peer [0-9]+ 192.168.0.11:29665/ from p1 expect /peer [0-9]+ 192.168.0.12:29665/ from p1 - expect /peer [0-9]+ 192.168.0.12:29665/ from p2 expect /peer [0-9]+ 192.168.0.11:29665/ from p2 expect /peer [0-9]+ Device2 Device2/ from p1 expect /peer [0-9]+ Device1 Device1/ from p2 diff --git a/sync.test b/sync.test index 1b243c2..2480ce9 100644 --- a/sync.test +++ b/sync.test @@ -12,9 +12,7 @@ test: expect /local-identity Device1 Owner/ from p1 expect /local-identity Device2/ from p2 expect /shared-identity Owner/ from p1 - expect /peer [0-9]+ 192.168.0.11:29665/ from p1 expect /peer [0-9]+ 192.168.0.12:29665/ from p1 - expect /peer [0-9]+ 192.168.0.12:29665/ from p2 expect /peer [0-9]+ 192.168.0.11:29665/ from p2 expect /peer [0-9]+ Device2 Device2/ from p1 expect /peer [0-9]+ Owner Device1/ from p2 -- cgit v1.2.3 From 42ddc2a2514f6601ce781bc957f24b176ec4749c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Thu, 9 Dec 2021 22:45:43 +0100 Subject: (test) Test: distinguish address and identity info for peers --- attach.test | 18 +++++++++++------- discovery.test | 10 ++++++---- sync.test | 18 ++++++++++-------- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/attach.test b/attach.test index 4e2238e..7115b55 100644 --- a/attach.test +++ b/attach.test @@ -7,19 +7,23 @@ test: send "watch-local-identity" to p2 send "start-server" to p1 send "start-server" to p2 - expect /local-identity Device1 Owner/ from p1 - expect /local-identity Device2/ from p2 - expect /peer [0-9]+ 192.168.0.12:29665/ from p1 - expect /peer [0-9]+ 192.168.0.11:29665/ from p2 - expect /peer [0-9]+ Device2 Device2/ from p1 - expect /peer [0-9]+ Owner Device1/ from p2 + expect from p1: + /local-identity Device1 Owner/ + /peer 1 addr 192.168.0.12 29665/ + /peer 1 id Device2/ + expect from p2: + /local-identity Device2/ + /peer 1 addr 192.168.0.11 29665/ + /peer 1 id Device1 Owner/ + send "attach Owner" to p2 expect /attach-confirm .*/ from p1 expect /attach-confirm .*/ from p2 # TODO: check code match + send "attach-accept Device2 1" to p1 send "attach-accept Owner 1" to p2 expect /attach-result Device2 1/ from p1 expect /attach-result Owner 1/ from p2 expect /local-identity Device2 Owner/ from p2 - expect /peer [0-9]+ Owner Device2/ from p1 + expect /peer 1 id Device2 Owner/ from p1 diff --git a/discovery.test b/discovery.test index aba6b15..60db1dc 100644 --- a/discovery.test +++ b/discovery.test @@ -5,7 +5,9 @@ test: send "create-identity Device2" to p2 send "start-server" to p1 send "start-server" to p2 - expect /peer [0-9]+ 192.168.0.12:29665/ from p1 - expect /peer [0-9]+ 192.168.0.11:29665/ from p2 - expect /peer [0-9]+ Device2 Device2/ from p1 - expect /peer [0-9]+ Device1 Device1/ from p2 + expect from p1: + /peer 1 addr 192.168.0.12 29665/ + /peer 1 id Device2/ + expect from p2: + /peer 1 addr 192.168.0.11 29665/ + /peer 1 id Device1/ diff --git a/sync.test b/sync.test index 2480ce9..8cf5b4d 100644 --- a/sync.test +++ b/sync.test @@ -9,13 +9,15 @@ test: send "create-identity Device2" to p2 send "start-server" to p1 send "start-server" to p2 - expect /local-identity Device1 Owner/ from p1 - expect /local-identity Device2/ from p2 - expect /shared-identity Owner/ from p1 - expect /peer [0-9]+ 192.168.0.12:29665/ from p1 - expect /peer [0-9]+ 192.168.0.11:29665/ from p2 - expect /peer [0-9]+ Device2 Device2/ from p1 - expect /peer [0-9]+ Owner Device1/ from p2 + expect from p1: + /local-identity Device1 Owner/ + /shared-identity Owner/ + /peer 1 addr 192.168.0.12 29665/ + /peer 1 id Device2/ + expect from p2: + /local-identity Device2/ + /peer 1 addr 192.168.0.11 29665/ + /peer 1 id Device1 Owner/ send "attach Owner" to p2 expect /attach-confirm .*/ from p1 @@ -28,7 +30,7 @@ test: expect /attach-result Owner 1/ from p2 expect /local-identity Device2 Owner/ from p2 expect /shared-identity Owner/ from p2 - expect /peer [0-9]+ Owner Device2/ from p1 + expect /peer 1 id Device2 Owner/ from p1 send "update-shared-identity NewOwner" to p1 expect /shared-identity NewOwner/ from p1 -- cgit v1.2.3 From 3a3b0d3e51fb1e11d4c5a84286be0983b230fdf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 11 Dec 2021 21:51:36 +0100 Subject: (test) Test: use numeric index for peer identification --- attach.test | 14 +++++++------- sync.test | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/attach.test b/attach.test index 7115b55..35fbde4 100644 --- a/attach.test +++ b/attach.test @@ -16,14 +16,14 @@ test: /peer 1 addr 192.168.0.11 29665/ /peer 1 id Device1 Owner/ - send "attach Owner" to p2 - expect /attach-confirm .*/ from p1 - expect /attach-confirm .*/ from p2 + send "attach 1" to p2 + expect /attach-confirm 1 .*/ from p1 + expect /attach-confirm 1 .*/ from p2 # TODO: check code match - send "attach-accept Device2 1" to p1 - send "attach-accept Owner 1" to p2 - expect /attach-result Device2 1/ from p1 - expect /attach-result Owner 1/ from p2 + send "attach-accept 1 1" to p1 + send "attach-accept 1 1" to p2 + expect /attach-result 1 1/ from p1 + expect /attach-result 1 1/ from p2 expect /local-identity Device2 Owner/ from p2 expect /peer 1 id Device2 Owner/ from p1 diff --git a/sync.test b/sync.test index 8cf5b4d..9ae22dc 100644 --- a/sync.test +++ b/sync.test @@ -19,15 +19,15 @@ test: /peer 1 addr 192.168.0.11 29665/ /peer 1 id Device1 Owner/ - send "attach Owner" to p2 - expect /attach-confirm .*/ from p1 - expect /attach-confirm .*/ from p2 + send "attach 1" to p2 + expect /attach-confirm 1 .*/ from p1 + expect /attach-confirm 1 .*/ from p2 # TODO: check code match - send "attach-accept Device2 1" to p1 - send "attach-accept Owner 1" to p2 - expect /attach-result Device2 1/ from p1 - expect /attach-result Owner 1/ from p2 + send "attach-accept 1 1" to p1 + send "attach-accept 1 1" to p2 + expect /attach-result 1 1/ from p1 + expect /attach-result 1 1/ from p2 expect /local-identity Device2 Owner/ from p2 expect /shared-identity Owner/ from p2 expect /peer 1 id Device2 Owner/ from p1 -- cgit v1.2.3 From a3aa567b589a4e05500d79e0c8e1ab094f29324a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Thu, 30 Dec 2021 22:35:02 +0100 Subject: (test) Test: distinct attach commands instead of boolean parameters --- attach.test | 28 +++++++++++++++++++++------- sync.test | 18 +++++++++--------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/attach.test b/attach.test index 35fbde4..e43cd10 100644 --- a/attach.test +++ b/attach.test @@ -16,14 +16,28 @@ test: /peer 1 addr 192.168.0.11 29665/ /peer 1 id Device1 Owner/ - send "attach 1" to p2 - expect /attach-confirm 1 .*/ from p1 - expect /attach-confirm 1 .*/ from p2 + send "attach-to 1" to p2 + expect /attach-request 1 .*/ from p1 + expect /attach-response 1 .*/ from p2 + send "attach-reject 1" to p1 + expect /attach-request-failed 1/ from p1 + expect /attach-response-failed 1/ from p2 + + send "attach-to 1" to p2 + expect /attach-request 1 .*/ from p1 + expect /attach-response 1 .*/ from p2 + send "attach-reject 1" to p2 + expect /attach-request-failed 1/ from p1 + expect /attach-response-failed 1/ from p2 + + send "attach-to 1" to p2 + expect /attach-request 1 .*/ from p1 + expect /attach-response 1 .*/ from p2 # TODO: check code match - send "attach-accept 1 1" to p1 - send "attach-accept 1 1" to p2 - expect /attach-result 1 1/ from p1 - expect /attach-result 1 1/ from p2 + send "attach-accept 1" to p1 + send "attach-accept 1" to p2 + expect /attach-request-done 1/ from p1 + expect /attach-response-done 1/ from p2 expect /local-identity Device2 Owner/ from p2 expect /peer 1 id Device2 Owner/ from p1 diff --git a/sync.test b/sync.test index 9ae22dc..34b7cc0 100644 --- a/sync.test +++ b/sync.test @@ -1,12 +1,12 @@ test: spawn on node1 as p1 spawn on node2 as p2 + send "create-identity Device1 Owner" to p1 + send "create-identity Device2" to p2 send "watch-local-identity" to p1 send "watch-local-identity" to p2 send "watch-shared-identity" to p1 send "watch-shared-identity" to p2 - send "create-identity Device1 Owner" to p1 - send "create-identity Device2" to p2 send "start-server" to p1 send "start-server" to p2 expect from p1: @@ -19,15 +19,15 @@ test: /peer 1 addr 192.168.0.11 29665/ /peer 1 id Device1 Owner/ - send "attach 1" to p2 - expect /attach-confirm 1 .*/ from p1 - expect /attach-confirm 1 .*/ from p2 + send "attach-to 1" to p2 + expect /attach-request 1 .*/ from p1 + expect /attach-response 1 .*/ from p2 # TODO: check code match - send "attach-accept 1 1" to p1 - send "attach-accept 1 1" to p2 - expect /attach-result 1 1/ from p1 - expect /attach-result 1 1/ from p2 + send "attach-accept 1" to p1 + send "attach-accept 1" to p2 + expect /attach-request-done 1/ from p1 + expect /attach-response-done 1/ from p2 expect /local-identity Device2 Owner/ from p2 expect /shared-identity Owner/ from p2 expect /peer 1 id Device2 Owner/ from p1 -- cgit v1.2.3 From 585fac67835f393420127c0723289b538683b0a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 30 Apr 2022 09:12:40 +0200 Subject: (test) Test: device and owner identity updates after discovery --- discovery.test | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/discovery.test b/discovery.test index 60db1dc..b477dc0 100644 --- a/discovery.test +++ b/discovery.test @@ -1,7 +1,7 @@ test: spawn on node1 as p1 spawn on node2 as p2 - send "create-identity Device1" to p1 + send "create-identity Device1 Owner" to p1 send "create-identity Device2" to p2 send "start-server" to p1 send "start-server" to p2 @@ -10,4 +10,16 @@ test: /peer 1 id Device2/ expect from p2: /peer 1 addr 192.168.0.11 29665/ - /peer 1 id Device1/ + /peer 1 id Device1 Owner/ + + send "update-local-identity Device1A" to p1 + expect /peer 1 id Device1A Owner/ from p2 + + send "update-shared-identity OwnerA" to p1 + expect /peer 1 id Device1A OwnerA/ from p2 + + send "update-local-identity Device1B" to p1 + expect /peer 1 id Device1B OwnerA/ from p2 + + send "update-shared-identity OwnerB" to p1 + expect /peer 1 id Device1B OwnerB/ from p2 -- cgit v1.2.3 From 15cf9a578d6de297c1f4a38e01ffa1028d3dcccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 4 Jun 2022 22:24:15 +0200 Subject: (test) Test: use node IP addresses from variables --- attach.test | 4 ++-- discovery.test | 4 ++-- sync.test | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/attach.test b/attach.test index e43cd10..3cbe63e 100644 --- a/attach.test +++ b/attach.test @@ -9,11 +9,11 @@ test: send "start-server" to p2 expect from p1: /local-identity Device1 Owner/ - /peer 1 addr 192.168.0.12 29665/ + /peer 1 addr ${node2.ip} 29665/ /peer 1 id Device2/ expect from p2: /local-identity Device2/ - /peer 1 addr 192.168.0.11 29665/ + /peer 1 addr ${node1.ip} 29665/ /peer 1 id Device1 Owner/ send "attach-to 1" to p2 diff --git a/discovery.test b/discovery.test index b477dc0..5709ee7 100644 --- a/discovery.test +++ b/discovery.test @@ -6,10 +6,10 @@ test: send "start-server" to p1 send "start-server" to p2 expect from p1: - /peer 1 addr 192.168.0.12 29665/ + /peer 1 addr ${node2.ip} 29665/ /peer 1 id Device2/ expect from p2: - /peer 1 addr 192.168.0.11 29665/ + /peer 1 addr ${node1.ip} 29665/ /peer 1 id Device1 Owner/ send "update-local-identity Device1A" to p1 diff --git a/sync.test b/sync.test index 34b7cc0..eb0c446 100644 --- a/sync.test +++ b/sync.test @@ -12,11 +12,11 @@ test: expect from p1: /local-identity Device1 Owner/ /shared-identity Owner/ - /peer 1 addr 192.168.0.12 29665/ + /peer 1 addr ${node2.ip} 29665/ /peer 1 id Device2/ expect from p2: /local-identity Device2/ - /peer 1 addr 192.168.0.11 29665/ + /peer 1 addr ${node1.ip} 29665/ /peer 1 id Device1 Owner/ send "attach-to 1" to p2 -- cgit v1.2.3 From dea138f42b9e4975eab833655521e8c529d706b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 25 Jun 2022 22:17:59 +0200 Subject: (test) Test: guard attach code match --- attach.test | 6 +++--- sync.test | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/attach.test b/attach.test index 3cbe63e..bfd8ba1 100644 --- a/attach.test +++ b/attach.test @@ -31,9 +31,9 @@ test: expect /attach-response-failed 1/ from p2 send "attach-to 1" to p2 - expect /attach-request 1 .*/ from p1 - expect /attach-response 1 .*/ from p2 - # TODO: check code match + expect /attach-request 1 ([0-9]*)/ from p1 capture code1 + expect /attach-response 1 ([0-9]*)/ from p2 capture code2 + guard code1 == code2 send "attach-accept 1" to p1 send "attach-accept 1" to p2 diff --git a/sync.test b/sync.test index eb0c446..06d1a92 100644 --- a/sync.test +++ b/sync.test @@ -20,9 +20,9 @@ test: /peer 1 id Device1 Owner/ send "attach-to 1" to p2 - expect /attach-request 1 .*/ from p1 - expect /attach-response 1 .*/ from p2 - # TODO: check code match + expect /attach-request 1 ([0-9]*)/ from p1 capture code1 + expect /attach-response 1 ([0-9]*)/ from p2 capture code2 + guard code1 == code2 send "attach-accept 1" to p1 send "attach-accept 1" to p2 -- cgit v1.2.3 From a095e957aca11878ea8ee6e6ddcfddb5dbc2236d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Tue, 26 Jul 2022 22:07:20 +0200 Subject: (test) Pairing failure reason --- attach.test | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/attach.test b/attach.test index bfd8ba1..3b202e6 100644 --- a/attach.test +++ b/attach.test @@ -20,15 +20,15 @@ test: expect /attach-request 1 .*/ from p1 expect /attach-response 1 .*/ from p2 send "attach-reject 1" to p1 - expect /attach-request-failed 1/ from p1 - expect /attach-response-failed 1/ from p2 + expect /attach-request-failed 1 user/ from p1 + expect /attach-response-failed 1 rejected/ from p2 send "attach-to 1" to p2 expect /attach-request 1 .*/ from p1 expect /attach-response 1 .*/ from p2 send "attach-reject 1" to p2 - expect /attach-request-failed 1/ from p1 - expect /attach-response-failed 1/ from p2 + expect /attach-request-failed 1 rejected/ from p1 + expect /attach-response-failed 1 user/ from p2 send "attach-to 1" to p2 expect /attach-request 1 ([0-9]*)/ from p1 capture code1 -- cgit v1.2.3 From 919daf619441d370eb68d8c11b7a962127567c5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Mon, 8 Aug 2022 22:25:46 +0200 Subject: (test) Generation number of stored objects with caching --- storage.test | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 storage.test diff --git a/storage.test b/storage.test new file mode 100644 index 0000000..2ce87d5 --- /dev/null +++ b/storage.test @@ -0,0 +1,75 @@ +test: + spawn on node1 as p1 + + # Diamond history + send to p1: + "store rec" + "text:t First root" + "" + expect from p1: + /store-done (blake2#[0-9a-f]*)/ capture r1 + guard r1 == "blake2#c4a8c69fbc8398acf76a2ec1e5a191f339c4d03c3eb425af19d6d7d5efac6b8e" + + send to p1: + "store rec" + "PREV:r $r1" + "" + expect from p1: + /store-done (blake2#[0-9a-f]*)/ capture r2 + + send to p1: + "store rec" + "text:t Second branch" + "PREV:r $r1" + "" + expect from p1: + /store-done (blake2#[0-9a-f]*)/ capture r3 + + send to p1: + "store rec" + "PREV:r $r2" + "PREV:r $r3" + "" + expect from p1: + /store-done (blake2#[0-9a-f]*)/ capture r4 + + send to p1 "stored-generation $r1" + expect from p1 /stored-generation $r1 0/ + + send to p1 "stored-generation $r2" + expect from p1 /stored-generation $r2 1/ + + send to p1 "stored-generation $r3" + expect from p1 /stored-generation $r3 1/ + + send to p1 "stored-generation $r4" + expect from p1 /stored-generation $r4 2/ + + # Attach second root + send to p1: + "store rec" + "text:t Second root" + "" + expect from p1: + /store-done (blake2#[0-9a-f]*)/ capture r2_1 + + send to p1: + "store rec" + "PREV:r $r2_1" + "" + expect from p1: + /store-done (blake2#[0-9a-f]*)/ capture r2_2 + + send to p1: + "store rec" + "PREV:r $r2_2" + "PREV:r $r4" + "" + expect from p1: + /store-done (blake2#[0-9a-f]*)/ capture r2_3 + + send to p1 "stored-generation $r2_3" + expect from p1 /stored-generation $r2_3 3/ + + send to p1 "stored-generation $r2_2" + expect from p1 /stored-generation $r2_2 1/ -- cgit v1.2.3 From 62568248007f11e7120aa9340f6bf3bf85cbc1c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Tue, 9 Aug 2022 22:11:08 +0200 Subject: (test) Stored roots lookup --- storage.test | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/storage.test b/storage.test index 2ce87d5..10f5d2c 100644 --- a/storage.test +++ b/storage.test @@ -45,6 +45,18 @@ test: send to p1 "stored-generation $r4" expect from p1 /stored-generation $r4 2/ + send to p1 "stored-roots $r1" + expect from p1 /stored-roots $r1 $r1/ + + send to p1 "stored-roots $r2" + expect from p1 /stored-roots $r2 $r1/ + + send to p1 "stored-roots $r3" + expect from p1 /stored-roots $r3 $r1/ + + send to p1 "stored-roots $r4" + expect from p1 /stored-roots $r4 $r1/ + # Attach second root send to p1: "store rec" @@ -73,3 +85,9 @@ test: send to p1 "stored-generation $r2_2" expect from p1 /stored-generation $r2_2 1/ + + send to p1 "stored-roots $r2_3" + expect from p1 /stored-roots $r2_3 $r2_1 $r1/ + + send to p1 "stored-roots $r2_2" + expect from p1 /stored-roots $r2_2 $r2_1/ -- cgit v1.2.3 From 32612cec8afcc20cf28f8f4c70e5477e902d2b9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 9 Oct 2022 23:02:54 +0200 Subject: (test) Stored set --- storage.test | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/storage.test b/storage.test index 10f5d2c..12e267d 100644 --- a/storage.test +++ b/storage.test @@ -1,6 +1,9 @@ test: spawn on node1 as p1 + # Root finding + ############### + # Diamond history send to p1: "store rec" @@ -91,3 +94,59 @@ test: send to p1 "stored-roots $r2_2" expect from p1 /stored-roots $r2_2 $r2_1/ + + + # Set + ##### + + send to p1 "stored-set-add $r1" + expect from p1 /stored-set-add (blake2#[0-9a-f]*)/ capture s1 + send to p1 "stored-set-add $r2 $s1" + expect from p1 /stored-set-add (blake2#[0-9a-f]*)/ capture s2 + send to p1 "stored-set-add $r3 $s2" + expect from p1 /stored-set-add (blake2#[0-9a-f]*)/ capture s3 + send to p1 "stored-set-add $r4 $s3" + expect from p1 /stored-set-add (blake2#[0-9a-f]*)/ capture s4 + + send to p1 "stored-set-list $s1" + expect from p1: + /stored-set-item $r1/ + /stored-set-(.*)/ capture done1 + guard done1 == "done" + + send to p1 "stored-set-list $s2" + expect from p1: + /stored-set-item $r2/ + /stored-set-(.*)/ capture done2 + guard done2 == "done" + + send to p1 "stored-set-list $s3" + expect from p1: + /stored-set-item $r2 $r3/ + /stored-set-(.*)/ capture done3 + guard done3 == "done" + + send to p1 "stored-set-list $s4" + expect from p1: + /stored-set-item $r4/ + /stored-set-(.*)/ capture done4 + guard done4 == "done" + + + send to p1 "stored-set-add $r2_2 $s4" + expect from p1 /stored-set-add (blake2#[0-9a-f]*)/ capture s5 + send to p1 "stored-set-add $r2_3 $s5" + expect from p1 /stored-set-add (blake2#[0-9a-f]*)/ capture s6 + + send to p1 "stored-set-list $s5" + expect from p1: + /stored-set-item $r4/ + /stored-set-item $r2_2/ + /stored-set-(.*)/ capture done5 + guard done5 == "done" + + send to p1 "stored-set-list $s6" + expect from p1: + /stored-set-item $r2_3/ + /stored-set-(.*)/ capture done6 + guard done6 == "done" -- cgit v1.2.3 From c8c84f84b5f761d6aea2e9a68f374574835d83e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Mon, 14 Nov 2022 21:36:14 +0100 Subject: (test) Test: get and wait for shared state --- sync.test | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sync.test b/sync.test index 06d1a92..b9f3354 100644 --- a/sync.test +++ b/sync.test @@ -43,3 +43,8 @@ test: send "update-shared-identity NewOwner3" to p1 expect /shared-identity NewOwner3/ from p1 expect /shared-identity NewOwner3/ from p2 + + send "shared-state-get" to p1 + expect /shared-state-get (.*)/ from p1 capture p1state + send "shared-state-wait $p1state" to p2 + expect /shared-state-wait $p1state/ from p2 -- cgit v1.2.3 From 97d1ed362f8eff22d859dcbc668a51e55b6e3183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 4 Dec 2022 21:52:49 +0100 Subject: (test) Test: avoid introducing node variables by spawn --- attach.test | 8 ++++---- discovery.test | 8 ++++---- storage.test | 2 +- sync.test | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/attach.test b/attach.test index 3b202e6..1e2f5e8 100644 --- a/attach.test +++ b/attach.test @@ -1,6 +1,6 @@ test: - spawn on node1 as p1 - spawn on node2 as p2 + spawn as p1 + spawn as p2 send "create-identity Device1 Owner" to p1 send "create-identity Device2" to p2 send "watch-local-identity" to p1 @@ -9,11 +9,11 @@ test: send "start-server" to p2 expect from p1: /local-identity Device1 Owner/ - /peer 1 addr ${node2.ip} 29665/ + /peer 1 addr ${p2.node.ip} 29665/ /peer 1 id Device2/ expect from p2: /local-identity Device2/ - /peer 1 addr ${node1.ip} 29665/ + /peer 1 addr ${p1.node.ip} 29665/ /peer 1 id Device1 Owner/ send "attach-to 1" to p2 diff --git a/discovery.test b/discovery.test index 5709ee7..152b1d9 100644 --- a/discovery.test +++ b/discovery.test @@ -1,15 +1,15 @@ test: - spawn on node1 as p1 - spawn on node2 as p2 + spawn as p1 + spawn as p2 send "create-identity Device1 Owner" to p1 send "create-identity Device2" to p2 send "start-server" to p1 send "start-server" to p2 expect from p1: - /peer 1 addr ${node2.ip} 29665/ + /peer 1 addr ${p2.node.ip} 29665/ /peer 1 id Device2/ expect from p2: - /peer 1 addr ${node1.ip} 29665/ + /peer 1 addr ${p1.node.ip} 29665/ /peer 1 id Device1 Owner/ send "update-local-identity Device1A" to p1 diff --git a/storage.test b/storage.test index 12e267d..17859cc 100644 --- a/storage.test +++ b/storage.test @@ -1,5 +1,5 @@ test: - spawn on node1 as p1 + spawn as p1 # Root finding ############### diff --git a/sync.test b/sync.test index b9f3354..3830eb0 100644 --- a/sync.test +++ b/sync.test @@ -1,6 +1,6 @@ test: - spawn on node1 as p1 - spawn on node2 as p2 + spawn as p1 + spawn as p2 send "create-identity Device1 Owner" to p1 send "create-identity Device2" to p2 send "watch-local-identity" to p1 @@ -12,11 +12,11 @@ test: expect from p1: /local-identity Device1 Owner/ /shared-identity Owner/ - /peer 1 addr ${node2.ip} 29665/ + /peer 1 addr ${p2.node.ip} 29665/ /peer 1 id Device2/ expect from p2: /local-identity Device2/ - /peer 1 addr ${node1.ip} 29665/ + /peer 1 addr ${p1.node.ip} 29665/ /peer 1 id Device1 Owner/ send "attach-to 1" to p2 -- cgit v1.2.3 From 078484c4b40ed1dde9a063a3b7ba47a25a303f4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 18 Dec 2022 18:56:19 +0100 Subject: (test) Contact service and contacts using stored set --- contact.test | 149 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 contact.test diff --git a/contact.test b/contact.test new file mode 100644 index 0000000..b0005fd --- /dev/null +++ b/contact.test @@ -0,0 +1,149 @@ +test Contact: + spawn as p1 + spawn as p2 + spawn as p3 + spawn as p4 + + send "create-identity Device1 Owner1" to p1 + send "create-identity Device2 Owner2" to p2 + send "create-identity Device3 Owner3" to p3 + send "create-identity Device4" to p4 + + send "start-server" to p1 + send "start-server" to p2 + send "start-server" to p3 + send "start-server" to p4 + + expect from p1: + /peer ([0-9]+) addr ${p2.node.ip} 29665/ capture peer1_2 + /peer $peer1_2 id Device2 Owner2/ + /peer ([0-9]+) addr ${p3.node.ip} 29665/ capture peer1_3 + /peer $peer1_3 id Device3 Owner3/ + /peer ([0-9]+) addr ${p4.node.ip} 29665/ capture peer1_4 + /peer $peer1_4 id Device4/ + + expect from p2: + /peer ([0-9]+) addr ${p1.node.ip} 29665/ capture peer2_1 + /peer $peer2_1 id Device1 Owner1/ + /peer ([0-9]+) addr ${p3.node.ip} 29665/ capture peer2_3 + /peer $peer2_3 id Device3 Owner3/ + /peer ([0-9]+) addr ${p4.node.ip} 29665/ capture peer2_4 + /peer $peer2_4 id Device4/ + + expect from p3: + /peer ([0-9]+) addr ${p1.node.ip} 29665/ capture peer3_1 + /peer $peer3_1 id Device1 Owner1/ + /peer ([0-9]+) addr ${p2.node.ip} 29665/ capture peer3_2 + /peer $peer3_2 id Device2 Owner2/ + /peer ([0-9]+) addr ${p4.node.ip} 29665/ capture peer3_4 + /peer $peer3_4 id Device4/ + + expect from p4: + /peer ([0-9]+) addr ${p1.node.ip} 29665/ capture peer4_1 + /peer $peer4_1 id Device1 Owner1/ + /peer ([0-9]+) addr ${p2.node.ip} 29665/ capture peer4_2 + /peer $peer4_2 id Device2 Owner2/ + /peer ([0-9]+) addr ${p3.node.ip} 29665/ capture peer4_3 + /peer $peer4_3 id Device3 Owner3/ + + # Rejected contacts + + send "contact-request $peer1_2" to p1 + expect /contact-request $peer2_1 [0-9]*/ from p2 + expect /contact-response $peer1_2 [0-9]*/ from p1 + send "contact-reject $peer1_2" to p1 + expect /contact-request-failed $peer2_1 rejected/ from p2 + expect /contact-response-failed $peer1_2 user/ from p1 + + send "contact-request $peer1_2" to p1 + expect /contact-request $peer2_1 [0-9]*/ from p2 + expect /contact-response $peer1_2 [0-9]*/ from p1 + send "contact-reject $peer2_1" to p2 + expect /contact-request-failed $peer2_1 user/ from p2 + expect /contact-response-failed $peer1_2 rejected/ from p1 + + # Contact between 1 and 2 + + send "contact-request $peer1_2" to p1 + expect /contact-request $peer2_1 ([0-9]*)/ from p2 capture code1_2 + expect /contact-response $peer1_2 ([0-9]*)/ from p1 capture code1_1 + guard code1_1 == code1_2 + + send "contact-accept $peer1_2" to p1 + send "contact-accept $peer2_1" to p2 + expect /contact-request-done $peer2_1/ from p2 + expect /contact-response-done $peer1_2/ from p1 + + send "contact-list" to p1 + expect from p1: + /contact-list-item Owner2 Owner2/ + /contact-list-(.*)/ capture done1_1 + guard done1_1 == "done" + send "contact-list" to p2 + expect from p2: + /contact-list-item Owner1 Owner1/ + /contact-list-(.*)/ capture done1_2 + guard done1_2 == "done" + + # Attach peer 4 to Owner1 + + send "watch-local-identity" to p4 + expect /local-identity Device4/ from p4 + + send "attach-to $peer4_1" to p4 + expect /attach-request $peer1_4 ([0-9]*)/ from p1 capture code2_1 + expect /attach-response $peer4_1 ([0-9]*)/ from p4 capture code2_4 + guard code2_1 == code2_4 + + send "attach-accept $peer1_4" to p1 + send "attach-accept $peer4_1" to p4 + expect /attach-request-done $peer1_4/ from p1 + expect /attach-response-done $peer4_1/ from p4 + expect /local-identity Device4 Owner1/ from p4 + expect /peer $peer1_4 id Device4 Owner1/ from p1 + expect /peer $peer2_4 id Device4 Owner1/ from p2 + expect /peer $peer3_4 id Device4 Owner1/ from p3 + + # Contact between 3 and 4 + + send "contact-request $peer3_4" to p3 + expect /contact-request $peer4_3 ([0-9]*)/ from p4 capture code3_4 + expect /contact-response $peer3_4 ([0-9]*)/ from p3 capture code3_3 + guard code3_3 == code3_4 + + send "contact-accept $peer3_4" to p3 + send "contact-accept $peer4_3" to p4 + expect /contact-request-done $peer4_3/ from p4 + expect /contact-response-done $peer3_4/ from p3 + + send "contact-list" to p3 + expect from p3: + /contact-list-item Owner1 Owner1/ + /contact-list-(.*)/ capture done2_3 + guard done2_3 == "done" + + send "shared-state-get" to p1 + expect /shared-state-get (.*)/ from p1 capture s1 + send "shared-state-wait $s1" to p4 + expect /shared-state-wait $s1/ from p4 + + send "contact-list" to p4 + expect from p4: + /contact-list-item Owner2 Owner2/ + /contact-list-item Owner3 Owner3/ + /contact-list-(.*)/ capture done2_4 + guard done2_4 == "done" + + # Check sync between 1 and 4 + + send "shared-state-get" to p4 + expect /shared-state-get (.*)/ from p4 capture s4 + send "shared-state-wait $s4" to p1 + expect /shared-state-wait $s4/ from p1 + + send "contact-list" to p1 + expect from p1: + /contact-list-item Owner2 Owner2/ + /contact-list-item Owner3 Owner3/ + /contact-list-(.*)/ capture done2_1 + guard done2_1 == "done" -- cgit v1.2.3 From e92352ab07c02298aa4031ff8b585b3751397b80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 8 Jan 2023 22:31:08 +0100 Subject: (test) Contact name setting and property lookup --- contact.test | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 55 insertions(+), 7 deletions(-) diff --git a/contact.test b/contact.test index b0005fd..084dd93 100644 --- a/contact.test +++ b/contact.test @@ -76,12 +76,12 @@ test Contact: send "contact-list" to p1 expect from p1: - /contact-list-item Owner2 Owner2/ + /contact-list-item [a-z0-9#]+ Owner2 Owner2/ /contact-list-(.*)/ capture done1_1 guard done1_1 == "done" send "contact-list" to p2 expect from p2: - /contact-list-item Owner1 Owner1/ + /contact-list-item [a-z0-9#]+ Owner1 Owner1/ /contact-list-(.*)/ capture done1_2 guard done1_2 == "done" @@ -118,7 +118,7 @@ test Contact: send "contact-list" to p3 expect from p3: - /contact-list-item Owner1 Owner1/ + /contact-list-item [a-z0-9#]+ Owner1 Owner1/ /contact-list-(.*)/ capture done2_3 guard done2_3 == "done" @@ -129,8 +129,8 @@ test Contact: send "contact-list" to p4 expect from p4: - /contact-list-item Owner2 Owner2/ - /contact-list-item Owner3 Owner3/ + /contact-list-item ([a-z0-9#]+) Owner2 Owner2/ capture c4_2 + /contact-list-item ([a-z0-9#]+) Owner3 Owner3/ capture c4_3 /contact-list-(.*)/ capture done2_4 guard done2_4 == "done" @@ -143,7 +143,55 @@ test Contact: send "contact-list" to p1 expect from p1: - /contact-list-item Owner2 Owner2/ - /contact-list-item Owner3 Owner3/ + /contact-list-item ([a-z0-9#]+) Owner2 Owner2/ capture c1_2 + /contact-list-item ([a-z0-9#]+) Owner3 Owner3/ capture c1_3 /contact-list-(.*)/ capture done2_1 guard done2_1 == "done" + + # Update custom name + + send "contact-set-name $c4_2 Custom2" to p4 + expect /contact-set-name-done/ from p4 + + send "contact-list" to p4 + expect from p4: + /contact-list-item $c4_2 Custom2 Owner2/ + /contact-list-item $c4_3 Owner3 Owner3/ + /contact-list-(.*)/ capture done3_4 + guard done3_4 == "done" + + send "shared-state-get" to p4 + expect /shared-state-get (.*)/ from p4 capture s4b + send "shared-state-wait $s4b" to p1 + expect /shared-state-wait $s4b/ from p1 + + send "contact-list" to p1 + expect from p1: + /contact-list-item $c4_2 Custom2 Owner2/ + /contact-list-item $c4_3 Owner3 Owner3/ + /contact-list-(.*)/ capture done3_1 + guard done3_1 == "done" + + send "contact-set-name $c1_2 Custom2B" to p1 + expect /contact-set-name-done/ from p1 + send "contact-set-name $c1_3 Custom3B" to p1 + expect /contact-set-name-done/ from p1 + + send "contact-list" to p1 + expect from p1: + /contact-list-item $c1_2 Custom2B Owner2/ + /contact-list-item $c1_3 Custom3B Owner3/ + /contact-list-(.*)/ capture done4_1 + guard done4_1 == "done" + + send "shared-state-get" to p1 + expect /shared-state-get (.*)/ from p1 capture s1b + send "shared-state-wait $s1b" to p4 + expect /shared-state-wait $s1b/ from p4 + + send "contact-list" to p4 + expect from p4: + /contact-list-item $c4_2 Custom2B Owner2/ + /contact-list-item $c4_3 Custom3B Owner3/ + /contact-list-(.*)/ capture done4_4 + guard done4_4 == "done" -- cgit v1.2.3 From e385f66b9d0c4c1786c91926383403fa90873138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Wed, 22 Feb 2023 20:58:39 +0100 Subject: (test) Pass weak pointer of HeadBhv to callback --- storage.test | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/storage.test b/storage.test index 17859cc..6267beb 100644 --- a/storage.test +++ b/storage.test @@ -1,4 +1,4 @@ -test: +test Storage: spawn as p1 # Root finding @@ -150,3 +150,52 @@ test: /stored-set-item $r2_3/ /stored-set-(.*)/ capture done6 guard done6 == "done" + + +test StorageWatcher: + spawn as p1 + spawn as p2 + send "create-identity Device1 Owner" to p1 + send "create-identity Device2" to p2 + send "watch-local-identity" to p1 + send "watch-local-identity" to p2 + send "start-server" to p1 + send "start-server" to p2 + expect from p1: + /local-identity Device1 Owner/ + /peer 1 addr ${p2.node.ip} 29665/ + /peer 1 id Device2/ + expect from p2: + /local-identity Device2/ + /peer 1 addr ${p1.node.ip} 29665/ + /peer 1 id Device1 Owner/ + + local: + send "attach-to 1" to p2 + expect /attach-request 1 ([0-9]*)/ from p1 capture code1 + expect /attach-response 1 ([0-9]*)/ from p2 capture code2 + guard code1 == code2 + + send "attach-accept 1" to p1 + send "attach-accept 1" to p2 + expect /attach-request-done 1/ from p1 + expect /attach-response-done 1/ from p2 + expect /local-identity Device2 Owner/ from p2 + expect /peer 1 id Device2 Owner/ from p1 + + for i in [1..5]: + send "update-local-identity Owner2" to p1 + send "shared-state-get" to p1 + expect /shared-state-get (.*)/ from p1 capture s1 + + send "shared-state-wait $s1" to p2 + expect /shared-state-wait $s1/ from p2 + + send "update-local-identity Owner1" to p1 + send "shared-state-get" to p1 + expect /shared-state-get (.*)/ from p1 capture s2 + + send "shared-state-wait $s1" to p2 + send "shared-state-wait $s2" to p2 + expect /shared-state-wait $s1/ from p2 + expect /shared-state-wait $s2/ from p2 -- cgit v1.2.3 From f76b09a1dcf97e6d029aa0c8591158a6af9279d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Fri, 7 Apr 2023 20:23:58 +0200 Subject: (test) Test: direct messages to peer --- message.test | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 message.test diff --git a/message.test b/message.test new file mode 100644 index 0000000..9567611 --- /dev/null +++ b/message.test @@ -0,0 +1,29 @@ +test DirectMessage: + spawn as p1 + spawn as p2 + send "create-identity Device1 Owner1" to p1 + send "create-identity Device2 Owner2" to p2 + send "start-server" to p1 + send "start-server" to p2 + + expect from p1: + /peer ([0-9]+) addr ${p2.node.ip} 29665/ capture peer1_2 + /peer $peer1_2 id Device2 Owner2/ + + expect from p2: + /peer ([0-9]+) addr ${p1.node.ip} 29665/ capture peer2_1 + /peer $peer2_1 id Device1 Owner1/ + + for i in [1..2]: + send "dm-send-peer $peer1_2 hello$i" to p1 + expect /dm-received from Owner1 text hello$i/ from p2 + + for i in [1..2]: + send "dm-send-peer $peer1_2 hello$i" to p2 + expect /dm-received from Owner2 text hello$i/ from p1 + + for i in [3..4]: + send "dm-send-peer $peer1_2 hello$i" to p1 + expect /dm-received from Owner1 text hello$i/ from p2 + send "dm-send-peer $peer1_2 hello$i" to p2 + expect /dm-received from Owner2 text hello$i/ from p1 -- cgit v1.2.3 From f2e2ab07a63981f11cd35740ea00c0ce796d9c80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 7 May 2023 21:11:46 +0200 Subject: (test) Test: use parentheses for guard expressions --- attach.test | 2 +- contact.test | 41 ++++++++++++++++++++++------------------- storage.test | 16 ++++++++-------- sync.test | 2 +- 4 files changed, 32 insertions(+), 29 deletions(-) diff --git a/attach.test b/attach.test index 1e2f5e8..33a1483 100644 --- a/attach.test +++ b/attach.test @@ -33,7 +33,7 @@ test: send "attach-to 1" to p2 expect /attach-request 1 ([0-9]*)/ from p1 capture code1 expect /attach-response 1 ([0-9]*)/ from p2 capture code2 - guard code1 == code2 + guard (code1 == code2) send "attach-accept 1" to p1 send "attach-accept 1" to p2 diff --git a/contact.test b/contact.test index 084dd93..438aa1f 100644 --- a/contact.test +++ b/contact.test @@ -64,10 +64,11 @@ test Contact: # Contact between 1 and 2 - send "contact-request $peer1_2" to p1 - expect /contact-request $peer2_1 ([0-9]*)/ from p2 capture code1_2 - expect /contact-response $peer1_2 ([0-9]*)/ from p1 capture code1_1 - guard code1_1 == code1_2 + local: + send "contact-request $peer1_2" to p1 + expect /contact-request $peer2_1 ([0-9]*)/ from p2 capture code2 + expect /contact-response $peer1_2 ([0-9]*)/ from p1 capture code1 + guard (code1 == code2) send "contact-accept $peer1_2" to p1 send "contact-accept $peer2_1" to p2 @@ -78,12 +79,12 @@ test Contact: expect from p1: /contact-list-item [a-z0-9#]+ Owner2 Owner2/ /contact-list-(.*)/ capture done1_1 - guard done1_1 == "done" + guard (done1_1 == "done") send "contact-list" to p2 expect from p2: /contact-list-item [a-z0-9#]+ Owner1 Owner1/ /contact-list-(.*)/ capture done1_2 - guard done1_2 == "done" + guard (done1_2 == "done") # Attach peer 4 to Owner1 @@ -91,9 +92,10 @@ test Contact: expect /local-identity Device4/ from p4 send "attach-to $peer4_1" to p4 - expect /attach-request $peer1_4 ([0-9]*)/ from p1 capture code2_1 - expect /attach-response $peer4_1 ([0-9]*)/ from p4 capture code2_4 - guard code2_1 == code2_4 + local: + expect /attach-request $peer1_4 ([0-9]*)/ from p1 capture code1 + expect /attach-response $peer4_1 ([0-9]*)/ from p4 capture code4 + guard (code1 == code4) send "attach-accept $peer1_4" to p1 send "attach-accept $peer4_1" to p4 @@ -107,9 +109,10 @@ test Contact: # Contact between 3 and 4 send "contact-request $peer3_4" to p3 - expect /contact-request $peer4_3 ([0-9]*)/ from p4 capture code3_4 - expect /contact-response $peer3_4 ([0-9]*)/ from p3 capture code3_3 - guard code3_3 == code3_4 + local: + expect /contact-request $peer4_3 ([0-9]*)/ from p4 capture code4 + expect /contact-response $peer3_4 ([0-9]*)/ from p3 capture code3 + guard (code3 == code4) send "contact-accept $peer3_4" to p3 send "contact-accept $peer4_3" to p4 @@ -120,7 +123,7 @@ test Contact: expect from p3: /contact-list-item [a-z0-9#]+ Owner1 Owner1/ /contact-list-(.*)/ capture done2_3 - guard done2_3 == "done" + guard (done2_3 == "done") send "shared-state-get" to p1 expect /shared-state-get (.*)/ from p1 capture s1 @@ -132,7 +135,7 @@ test Contact: /contact-list-item ([a-z0-9#]+) Owner2 Owner2/ capture c4_2 /contact-list-item ([a-z0-9#]+) Owner3 Owner3/ capture c4_3 /contact-list-(.*)/ capture done2_4 - guard done2_4 == "done" + guard (done2_4 == "done") # Check sync between 1 and 4 @@ -146,7 +149,7 @@ test Contact: /contact-list-item ([a-z0-9#]+) Owner2 Owner2/ capture c1_2 /contact-list-item ([a-z0-9#]+) Owner3 Owner3/ capture c1_3 /contact-list-(.*)/ capture done2_1 - guard done2_1 == "done" + guard (done2_1 == "done") # Update custom name @@ -158,7 +161,7 @@ test Contact: /contact-list-item $c4_2 Custom2 Owner2/ /contact-list-item $c4_3 Owner3 Owner3/ /contact-list-(.*)/ capture done3_4 - guard done3_4 == "done" + guard (done3_4 == "done") send "shared-state-get" to p4 expect /shared-state-get (.*)/ from p4 capture s4b @@ -170,7 +173,7 @@ test Contact: /contact-list-item $c4_2 Custom2 Owner2/ /contact-list-item $c4_3 Owner3 Owner3/ /contact-list-(.*)/ capture done3_1 - guard done3_1 == "done" + guard (done3_1 == "done") send "contact-set-name $c1_2 Custom2B" to p1 expect /contact-set-name-done/ from p1 @@ -182,7 +185,7 @@ test Contact: /contact-list-item $c1_2 Custom2B Owner2/ /contact-list-item $c1_3 Custom3B Owner3/ /contact-list-(.*)/ capture done4_1 - guard done4_1 == "done" + guard (done4_1 == "done") send "shared-state-get" to p1 expect /shared-state-get (.*)/ from p1 capture s1b @@ -194,4 +197,4 @@ test Contact: /contact-list-item $c4_2 Custom2B Owner2/ /contact-list-item $c4_3 Custom3B Owner3/ /contact-list-(.*)/ capture done4_4 - guard done4_4 == "done" + guard (done4_4 == "done") diff --git a/storage.test b/storage.test index 6267beb..9bf468e 100644 --- a/storage.test +++ b/storage.test @@ -11,7 +11,7 @@ test Storage: "" expect from p1: /store-done (blake2#[0-9a-f]*)/ capture r1 - guard r1 == "blake2#c4a8c69fbc8398acf76a2ec1e5a191f339c4d03c3eb425af19d6d7d5efac6b8e" + guard (r1 == "blake2#c4a8c69fbc8398acf76a2ec1e5a191f339c4d03c3eb425af19d6d7d5efac6b8e") send to p1: "store rec" @@ -112,25 +112,25 @@ test Storage: expect from p1: /stored-set-item $r1/ /stored-set-(.*)/ capture done1 - guard done1 == "done" + guard (done1 == "done") send to p1 "stored-set-list $s2" expect from p1: /stored-set-item $r2/ /stored-set-(.*)/ capture done2 - guard done2 == "done" + guard (done2 == "done") send to p1 "stored-set-list $s3" expect from p1: /stored-set-item $r2 $r3/ /stored-set-(.*)/ capture done3 - guard done3 == "done" + guard (done3 == "done") send to p1 "stored-set-list $s4" expect from p1: /stored-set-item $r4/ /stored-set-(.*)/ capture done4 - guard done4 == "done" + guard (done4 == "done") send to p1 "stored-set-add $r2_2 $s4" @@ -143,13 +143,13 @@ test Storage: /stored-set-item $r4/ /stored-set-item $r2_2/ /stored-set-(.*)/ capture done5 - guard done5 == "done" + guard (done5 == "done") send to p1 "stored-set-list $s6" expect from p1: /stored-set-item $r2_3/ /stored-set-(.*)/ capture done6 - guard done6 == "done" + guard (done6 == "done") test StorageWatcher: @@ -174,7 +174,7 @@ test StorageWatcher: send "attach-to 1" to p2 expect /attach-request 1 ([0-9]*)/ from p1 capture code1 expect /attach-response 1 ([0-9]*)/ from p2 capture code2 - guard code1 == code2 + guard (code1 == code2) send "attach-accept 1" to p1 send "attach-accept 1" to p2 diff --git a/sync.test b/sync.test index 3830eb0..3cc7cba 100644 --- a/sync.test +++ b/sync.test @@ -22,7 +22,7 @@ test: send "attach-to 1" to p2 expect /attach-request 1 ([0-9]*)/ from p1 capture code1 expect /attach-response 1 ([0-9]*)/ from p2 capture code2 - guard code1 == code2 + guard (code1 == code2) send "attach-accept 1" to p1 send "attach-accept 1" to p2 -- cgit v1.2.3 From 45f29f5d0da1cdc1f2318e1dfdff8cb558e0d575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 7 May 2023 22:28:12 +0200 Subject: (test) Server function to manually add peer --- sync.test | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/sync.test b/sync.test index 3cc7cba..91e8f08 100644 --- a/sync.test +++ b/sync.test @@ -20,9 +20,10 @@ test: /peer 1 id Device1 Owner/ send "attach-to 1" to p2 - expect /attach-request 1 ([0-9]*)/ from p1 capture code1 - expect /attach-response 1 ([0-9]*)/ from p2 capture code2 - guard (code1 == code2) + local: + expect /attach-request 1 ([0-9]*)/ from p1 capture code1 + expect /attach-response 1 ([0-9]*)/ from p2 capture code2 + guard (code1 == code2) send "attach-accept 1" to p1 send "attach-accept 1" to p2 @@ -48,3 +49,45 @@ test: expect /shared-state-get (.*)/ from p1 capture p1state send "shared-state-wait $p1state" to p2 expect /shared-state-wait $p1state/ from p2 + + subnet s + spawn on s as p3 + + with p3: + send "create-identity Device3" + send "watch-local-identity" + send "watch-shared-identity" + send "start-server" + + send "peer-add ${p1.node.ip}" + + expect: + /local-identity Device3/ + /peer 1 addr ${p1.node.ip} 29665/ + /peer 1 id Device1 .*/ + + expect from p1: + /peer 2 addr ${p3.node.ip} 29665/ + /peer 2 id Device3/ + + send "attach-to 1" to p3 + local: + expect /attach-request 2 ([0-9]*)/ from p1 capture code1 + expect /attach-response 1 ([0-9]*)/ from p3 capture code2 + guard (code1 == code2) + + send "attach-accept 2" to p1 + send "attach-accept 1" to p3 + + expect /local-identity Device3 NewOwner3/ from p3 + expect /shared-identity NewOwner3/ from p3 + + send "update-shared-identity NewOwner4" to p3 + expect /shared-identity NewOwner4/ from p1 + expect /shared-identity NewOwner4/ from p2 + expect /shared-identity NewOwner4/ from p3 + + send "update-shared-identity NewOwner5" to p2 + expect /shared-identity NewOwner5/ from p1 + expect /shared-identity NewOwner5/ from p2 + expect /shared-identity NewOwner5/ from p3 -- cgit v1.2.3 From 1af3f512718174678ba4765993b92673e0ee3dfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Mon, 8 May 2023 22:07:20 +0200 Subject: (test) Send identity update on channel finalization --- sync.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sync.test b/sync.test index 91e8f08..ea9595d 100644 --- a/sync.test +++ b/sync.test @@ -64,7 +64,7 @@ test: expect: /local-identity Device3/ /peer 1 addr ${p1.node.ip} 29665/ - /peer 1 id Device1 .*/ + /peer 1 id Device1 NewOwner3/ expect from p1: /peer 2 addr ${p3.node.ip} 29665/ -- cgit v1.2.3 From 0139f02a9a6e23b69cdd75d64b579f1b96fad2ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Tue, 23 May 2023 22:11:42 +0200 Subject: (test) Message sending to identity or contact --- message.test | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/message.test b/message.test index 9567611..3f108d3 100644 --- a/message.test +++ b/message.test @@ -14,16 +14,57 @@ test DirectMessage: /peer ([0-9]+) addr ${p1.node.ip} 29665/ capture peer2_1 /peer $peer2_1 id Device1 Owner1/ + # Send messages to peers + for i in [1..2]: send "dm-send-peer $peer1_2 hello$i" to p1 expect /dm-received from Owner1 text hello$i/ from p2 for i in [1..2]: - send "dm-send-peer $peer1_2 hello$i" to p2 + send "dm-send-peer $peer2_1 hello$i" to p2 expect /dm-received from Owner2 text hello$i/ from p1 for i in [3..4]: send "dm-send-peer $peer1_2 hello$i" to p1 expect /dm-received from Owner1 text hello$i/ from p2 - send "dm-send-peer $peer1_2 hello$i" to p2 + send "dm-send-peer $peer2_1 hello$i" to p2 + expect /dm-received from Owner2 text hello$i/ from p1 + + # Create contacts + + local: + send "contact-request $peer1_2" to p1 + expect /contact-request $peer2_1 ([0-9]*)/ from p2 capture code2 + expect /contact-response $peer1_2 ([0-9]*)/ from p1 capture code1 + guard (code1 == code2) + + send "contact-accept $peer1_2" to p1 + send "contact-accept $peer2_1" to p2 + expect /contact-request-done $peer2_1/ from p2 + expect /contact-response-done $peer1_2/ from p1 + + send "contact-list" to p1 + expect from p1: + /contact-list-item ([a-z0-9#]+) Owner2 Owner2/ capture c1_2 + /contact-list-(.*)/ capture done1_1 + + send "contact-list" to p2 + expect from p2: + /contact-list-item ([a-z0-9#]+) Owner1 Owner1/ capture c2_1 + /contact-list-(.*)/ capture done1_2 + + # Send messages to contacts + + for i in [1..2]: + send "dm-send-contact $c1_2 hello$i" to p1 + expect /dm-received from Owner1 text hello$i/ from p2 + + for i in [1..2]: + send "dm-send-contact $c2_1 hello$i" to p2 + expect /dm-received from Owner2 text hello$i/ from p1 + + for i in [3..4]: + send "dm-send-contact $c1_2 hello$i" to p1 + expect /dm-received from Owner1 text hello$i/ from p2 + send "dm-send-contact $c2_1 hello$i" to p2 expect /dm-received from Owner2 text hello$i/ from p1 -- cgit v1.2.3 From 4c94ffdb20b4c416926e4af17b823e4eaa3a9582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Thu, 15 Jun 2023 20:35:55 +0200 Subject: (test) Test: server restart --- discovery.test | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/discovery.test b/discovery.test index 152b1d9..edf68c3 100644 --- a/discovery.test +++ b/discovery.test @@ -23,3 +23,23 @@ test: send "update-shared-identity OwnerB" to p1 expect /peer 1 id Device1B OwnerB/ from p2 + + with p2: + send "stop-server" + expect /stop-server-done/ + + send "update-shared-identity OwnerC" to p1 + + with p1: + send "stop-server" + expect /stop-server-done/ + + 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 Device1B OwnerC/ -- cgit v1.2.3 From 5ef1944409c7cf66c65cdc34781fb465faf335df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 1 Jul 2023 20:08:48 +0200 Subject: (test) Direct message shared state --- message.test | 67 +++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 55 insertions(+), 12 deletions(-) diff --git a/message.test b/message.test index 3f108d3..e317116 100644 --- a/message.test +++ b/message.test @@ -14,6 +14,10 @@ test DirectMessage: /peer ([0-9]+) addr ${p1.node.ip} 29665/ capture peer2_1 /peer $peer2_1 id Device1 Owner1/ + with p1: + send "dm-list-peer $peer1_2" + expect /dm-list-done/ + # Send messages to peers for i in [1..2]: @@ -21,14 +25,14 @@ test DirectMessage: expect /dm-received from Owner1 text hello$i/ from p2 for i in [1..2]: - send "dm-send-peer $peer2_1 hello$i" to p2 - expect /dm-received from Owner2 text hello$i/ from p1 + send "dm-send-peer $peer2_1 hi$i" to p2 + expect /dm-received from Owner2 text hi$i/ from p1 for i in [3..4]: send "dm-send-peer $peer1_2 hello$i" to p1 expect /dm-received from Owner1 text hello$i/ from p2 - send "dm-send-peer $peer2_1 hello$i" to p2 - expect /dm-received from Owner2 text hello$i/ from p1 + send "dm-send-peer $peer2_1 hi$i" to p2 + expect /dm-received from Owner2 text hi$i/ from p1 # Create contacts @@ -56,15 +60,54 @@ test DirectMessage: # Send messages to contacts for i in [1..2]: - send "dm-send-contact $c1_2 hello$i" to p1 - expect /dm-received from Owner1 text hello$i/ from p2 + send "dm-send-contact $c1_2 hello_c_$i" to p1 + expect /dm-received from Owner1 text hello_c_$i/ from p2 for i in [1..2]: - send "dm-send-contact $c2_1 hello$i" to p2 - expect /dm-received from Owner2 text hello$i/ from p1 + send "dm-send-contact $c2_1 hi_c_$i" to p2 + expect /dm-received from Owner2 text hi_c_$i/ from p1 for i in [3..4]: - send "dm-send-contact $c1_2 hello$i" to p1 - expect /dm-received from Owner1 text hello$i/ from p2 - send "dm-send-contact $c2_1 hello$i" to p2 - expect /dm-received from Owner2 text hello$i/ from p1 + send "dm-send-contact $c1_2 hello_c_$i" to p1 + expect /dm-received from Owner1 text hello_c_$i/ from p2 + send "dm-send-contact $c2_1 hi_c_$i" to p2 + expect /dm-received from Owner2 text hi_c_$i/ from p1 + + send "dm-list-contact $c1_2" to p1 + send "dm-list-contact $c2_1" to p2 + for p in [p1, p2]: + with p: + for i in [1..4]: + expect /dm-list-item from Owner1 text hello_c_$i/ + expect /dm-list-item from Owner2 text hi_c_$i/ + for i in [1..4]: + expect /dm-list-item from Owner1 text hello$i/ + expect /dm-list-item from Owner2 text hi$i/ + expect /dm-list-(.*)/ capture done + guard (done == "done") + + # Reload message history + + with p1: + send "stop-server" + expect /stop-server-done/ + send "start-server" + + send "contact-list" + expect: + /contact-list-item $c1_2 Owner2 Owner2/ + /contact-list-(.*)/ capture done + guard (done == "done") + + send "dm-list-contact $c1_2" to p1 + send "dm-list-contact $c2_1" to p2 + for p in [p1, p2]: + with p: + for i in [1..4]: + expect /dm-list-item from Owner1 text hello_c_$i/ + expect /dm-list-item from Owner2 text hi_c_$i/ + for i in [1..4]: + expect /dm-list-item from Owner1 text hello$i/ + expect /dm-list-item from Owner2 text hi$i/ + expect /dm-list-(.*)/ capture done + guard (done == "done") -- cgit v1.2.3 From 56777e9ced16adaa38bc1e2e5228acc656a73cd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Wed, 30 Aug 2023 21:17:41 +0200 Subject: (test) Test: extend discovery test with more nodes --- discovery.test | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 80 insertions(+), 6 deletions(-) diff --git a/discovery.test b/discovery.test index edf68c3..2aaaf24 100644 --- a/discovery.test +++ b/discovery.test @@ -34,12 +34,86 @@ test: send "stop-server" expect /stop-server-done/ - send "start-server" to p1 - send "start-server" to p2 + spawn as p3 + spawn as p4 + spawn as p5 + spawn as p6 + send "create-identity Device3" to p3 + send "create-identity Device4" to p4 + send "create-identity Device5" to p5 + send "create-identity Device6" to p6 + + for p in [ p1, p2, p3, p4, p5, p6 ]: + send "start-server" to p expect from p1: - /peer 1 addr ${p2.node.ip} 29665/ - /peer 1 id Device2/ + /peer ([0-9]+) addr ${p2.node.ip} 29665/ capture peer1_2 + /peer $peer1_2 id Device2/ + /peer ([0-9]+) addr ${p3.node.ip} 29665/ capture peer1_3 + /peer $peer1_3 id Device3/ + /peer ([0-9]+) addr ${p4.node.ip} 29665/ capture peer1_4 + /peer $peer1_4 id Device4/ + /peer ([0-9]+) addr ${p5.node.ip} 29665/ capture peer1_5 + /peer $peer1_5 id Device5/ + /peer ([0-9]+) addr ${p6.node.ip} 29665/ capture peer1_6 + /peer $peer1_6 id Device6/ + expect from p2: - /peer 1 addr ${p1.node.ip} 29665/ - /peer 1 id Device1B OwnerC/ + /peer ([0-9]+) addr ${p1.node.ip} 29665/ capture peer2_1 + /peer $peer2_1 id Device1B OwnerC/ + /peer ([0-9]+) addr ${p3.node.ip} 29665/ capture peer2_3 + /peer $peer2_3 id Device3/ + /peer ([0-9]+) addr ${p4.node.ip} 29665/ capture peer2_4 + /peer $peer2_4 id Device4/ + /peer ([0-9]+) addr ${p5.node.ip} 29665/ capture peer2_5 + /peer $peer2_5 id Device5/ + /peer ([0-9]+) addr ${p6.node.ip} 29665/ capture peer2_6 + /peer $peer2_6 id Device6/ + + expect from p3: + /peer ([0-9]+) addr ${p1.node.ip} 29665/ capture peer3_1 + /peer $peer3_1 id Device1B OwnerC/ + /peer ([0-9]+) addr ${p2.node.ip} 29665/ capture peer3_2 + /peer $peer3_2 id Device2/ + /peer ([0-9]+) addr ${p4.node.ip} 29665/ capture peer3_4 + /peer $peer3_4 id Device4/ + /peer ([0-9]+) addr ${p5.node.ip} 29665/ capture peer3_5 + /peer $peer3_5 id Device5/ + /peer ([0-9]+) addr ${p6.node.ip} 29665/ capture peer3_6 + /peer $peer3_6 id Device6/ + + expect from p4: + /peer ([0-9]+) addr ${p1.node.ip} 29665/ capture peer4_1 + /peer $peer4_1 id Device1B OwnerC/ + /peer ([0-9]+) addr ${p2.node.ip} 29665/ capture peer4_2 + /peer $peer4_2 id Device2/ + /peer ([0-9]+) addr ${p3.node.ip} 29665/ capture peer4_3 + /peer $peer4_3 id Device3/ + /peer ([0-9]+) addr ${p5.node.ip} 29665/ capture peer4_5 + /peer $peer4_5 id Device5/ + /peer ([0-9]+) addr ${p6.node.ip} 29665/ capture peer4_6 + /peer $peer4_6 id Device6/ + + expect from p5: + /peer ([0-9]+) addr ${p1.node.ip} 29665/ capture peer5_1 + /peer $peer5_1 id Device1B OwnerC/ + /peer ([0-9]+) addr ${p2.node.ip} 29665/ capture peer5_2 + /peer $peer5_2 id Device2/ + /peer ([0-9]+) addr ${p3.node.ip} 29665/ capture peer5_3 + /peer $peer5_3 id Device3/ + /peer ([0-9]+) addr ${p4.node.ip} 29665/ capture peer5_4 + /peer $peer5_4 id Device4/ + /peer ([0-9]+) addr ${p6.node.ip} 29665/ capture peer5_6 + /peer $peer5_6 id Device6/ + + expect from p6: + /peer ([0-9]+) addr ${p1.node.ip} 29665/ capture peer6_1 + /peer $peer6_1 id Device1B OwnerC/ + /peer ([0-9]+) addr ${p2.node.ip} 29665/ capture peer6_2 + /peer $peer6_2 id Device2/ + /peer ([0-9]+) addr ${p3.node.ip} 29665/ capture peer6_3 + /peer $peer6_3 id Device3/ + /peer ([0-9]+) addr ${p4.node.ip} 29665/ capture peer6_4 + /peer $peer6_4 id Device4/ + /peer ([0-9]+) addr ${p5.node.ip} 29665/ capture peer6_5 + /peer $peer6_5 id Device5/ -- cgit v1.2.3 From 779c2e5d7b04abaf78b9919ab9a087e4a6969736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 7 Jan 2024 20:38:51 +0100 Subject: (test) Message: send messages as sync from shared state --- message.test | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/message.test b/message.test index e317116..f630c59 100644 --- a/message.test +++ b/message.test @@ -88,11 +88,17 @@ test DirectMessage: # Reload message history - with p1: - send "stop-server" - expect /stop-server-done/ - send "start-server" + for p in [p1, p2]: + with p: + send "stop-server" + for p in [p1, p2]: + with p: + expect /stop-server-done/ + for p in [p1, p2]: + with p: + send "start-server" + with p1: send "contact-list" expect: /contact-list-item $c1_2 Owner2 Owner2/ @@ -111,3 +117,18 @@ test DirectMessage: expect /dm-list-item from Owner2 text hi$i/ expect /dm-list-(.*)/ capture done guard (done == "done") + + # Send message while offline + + for p in [p1, p2]: + with p: + send "stop-server" + for p in [p1, p2]: + with p: + expect /stop-server-done/ + send "start-server" to p2 + + send "dm-send-contact $c1_2 while_offline" to p1 + send "start-server" to p1 + + expect /dm-received from Owner1 text while_offline/ from p2 -- cgit v1.2.3 From bbefd6f0cbf4867af2e2e41e0719bf010bd16f2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 13 Jan 2024 21:50:21 +0100 Subject: (test) Message: sync state when peer appears on network --- message.test | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/message.test b/message.test index f630c59..307f11a 100644 --- a/message.test +++ b/message.test @@ -132,3 +132,18 @@ test DirectMessage: send "start-server" to p1 expect /dm-received from Owner1 text while_offline/ from p2 + + for p in [p1, p2]: + with p: + send "stop-server" + for p in [p1, p2]: + with p: + expect /stop-server-done/ + send "start-server" to p1 + + send "dm-send-contact $c1_2 while_peer_offline" to p1 + # TODO: sync from p1 on peer p2 discovery not ensured without addition wait + #wait + send "start-server" to p2 + + expect /dm-received from Owner1 text while_peer_offline/ from p2 -- cgit v1.2.3