summaryrefslogtreecommitdiff
path: root/test/attach.et
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-08-20 20:53:39 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2026-08-20 20:53:39 +0200
commit997a6e8633af550c7aa3cee049ac42674de9a5e7 (patch)
treef724bdf23c6177e542aaa9279cc6ba49f3dcb60b /test/attach.et
parent3b8c1a15abff199b1354036cdeae85832f280522 (diff)
Test: refactor successful attach to exported function
Diffstat (limited to 'test/attach.et')
-rw-r--r--test/attach.et30
1 files changed, 21 insertions, 9 deletions
diff --git a/test/attach.et b/test/attach.et
index ae00048..9163730 100644
--- a/test/attach.et
+++ b/test/attach.et
@@ -2,6 +2,26 @@ module attach
import common
+
+export def perform_attach of dev to owner:
+ flush from owner matching // # TODO: forces (owner : Process), drop when not necessary
+
+ send "peer-get-by-addr ${owner.node.ip} 29665" to dev
+ send "peer-get-by-addr ${dev.node.ip} 29665" to owner
+ expect /peer-get-by-addr ([0-9]+)/ from dev capture owner_pidx
+ expect /peer-get-by-addr ([0-9]+)/ from owner capture dev_pidx
+
+ send "attach-to $owner_pidx" to dev
+ expect /attach-request $dev_pidx ([0-9]*)/ from owner capture code1
+ expect /attach-response $owner_pidx ([0-9]*)/ from dev capture code2
+ guard (code1 == code2)
+
+ send "attach-accept $dev_pidx" to owner
+ send "attach-accept $owner_pidx" to dev
+ expect /attach-request-done $dev_pidx/ from owner
+ expect /attach-response-done $owner_pidx/ from dev
+
+
test Attach:
let services = "attach,sync"
@@ -91,15 +111,7 @@ test SyncAfterAttach:
expect /peer ([0-9]+) addr ${p.node.ip} 29665/ from p1 capture pidx
expect /peer $pidx id Device./ from p1
- send "attach-to 1"
- expect /attach-request $pidx ([0-9]*)/ from p1 capture code1
- expect /attach-response 1 ([0-9]*)/ capture code2
- guard (code1 == code2)
-
- send "attach-accept $pidx" to p1
- send "attach-accept 1"
- expect /attach-request-done $pidx/ from p1
- expect /attach-response-done 1/
+ perform_attach of p to p1
spawn as pd on nd
spawn as p1 on n1