tests: WIP gall request queue tests

This commit is contained in:
Ted Blackman 2022-08-12 00:04:01 +03:00
parent e2d546c4c2
commit 81bfe17f37
3 changed files with 82 additions and 0 deletions

1
pkg/arvo/lib/vane-test.hoon Symbolic link
View File

@ -0,0 +1 @@
/Users/ted/urbit/pkg/base-dev/lib/vane-test.hoon

View File

@ -0,0 +1,16 @@
:: test gall request queue fix, which implicates ames and gall
::
/+ *test, vane-test
|%
++ test-nec-bud
=+ ames-nec-bud:vane-test
;: weld
%+ expect-eq
!> nec
!> nec
::
%+ expect-eq
!> bud
!> bud
==
--

View File

@ -0,0 +1,65 @@
/+ *test
/= ames /sys/vane/ames
/= jael /sys/vane/jael
::
|%
++ ames-nec-bud
:: create ~nec
::
=/ nec (ames ~nec)
=. now.nec ~1111.1.1
=. eny.nec 0xdead.beef
=. life.ames-state.nec 2
=. rof.nec |=(* ``[%noun !>(*(list turf))])
=. crypto-core.ames-state.nec (pit:nu:crub:crypto 512 (shaz 'nec'))
=/ nec-pub pub:ex:crypto-core.ames-state.nec
=/ nec-sec sec:ex:crypto-core.ames-state.nec
:: create ~bud
::
=/ bud (ames ~bud)
=. now.bud ~1111.1.1
=. eny.bud 0xbeef.dead
=. life.ames-state.bud 3
=. rof.bud |=(* ``[%noun !>(*(list turf))])
=. crypto-core.ames-state.bud (pit:nu:crub:crypto 512 (shaz 'bud'))
=/ bud-pub pub:ex:crypto-core.ames-state.bud
=/ bud-sec sec:ex:crypto-core.ames-state.bud
::
=/ nec-sym (derive-symmetric-key:ames bud-pub nec-sec)
=/ bud-sym (derive-symmetric-key:ames nec-pub bud-sec)
?> =(nec-sym bud-sym)
:: tell ~nec about ~bud
::
=. peers.ames-state.nec
%+ ~(put by peers.ames-state.nec) ~bud
=| =peer-state:ames
=. -.peer-state
:* symmetric-key=bud-sym
life=3
rift=0
public-key=bud-pub
sponsor=~nec
==
=. route.peer-state `[direct=%.y `lane:ames`[%& ~nec]]
[%known peer-state]
:: tell ~bud about ~nec
::
=. peers.ames-state.bud
%+ ~(put by peers.ames-state.bud) ~nec
=| =peer-state:ames
=. -.peer-state
:* symmetric-key=nec-sym
life=2
rift=0
public-key=nec-pub
sponsor=~nec
==
=. route.peer-state `[direct=%.y `lane:ames`[%| `@`%lane-bar]]
[%known peer-state]
:: metamorphose
::
=> .(nec +:(call:(nec) ~[//unix] ~ %born ~))
=> .(bud +:(call:(bud) ~[//unix] ~ %born ~))
::
[nec=nec bud=bud]
--