Add the invite-offline test.

This tests generating an invitation on the server while no tinc daemon is
running.
This commit is contained in:
Guus Sliepen 2017-03-26 16:47:54 +02:00
parent 5fcf6e16ac
commit fd3ec60757
2 changed files with 51 additions and 0 deletions

View file

@ -4,6 +4,7 @@ TESTS = \
executables.test \
import-export.test \
invite-join.test \
invite-offline.test \
invite-tinc-up.test \
ns-ping.test \
ping.test \

50
test/invite-offline.test Executable file
View file

@ -0,0 +1,50 @@
#!/bin/sh
. ./testlib.sh
# Initialize one node
$tinc $c1 <<EOF
init foo
set DeviceType dummy
set Mode switch
set Broadcast no
del Port
set Address localhost
set Port 32758
EOF
# Generate an invitation offline and let another node join the VPN
invitation=`$tinc $c1 invite bar`
$tinc $c1 start
$tinc $c2 join $invitation
# Test equivalence of host config files
cmp $d1/hosts/foo $d2/hosts/foo
test "`grep ^Ed25519PublicKey $d1/hosts/bar`" = "`grep ^Ed25519PublicKey $d2/hosts/bar`"
# Test Mode, Broadcast and ConnectTo statements
test `$tinc $c2 get Mode` = switch
test `$tinc $c2 get Broadcast` = no
test `$tinc $c2 get ConnectTo` = foo
# Check whether the new node can join the VPN
$tinc $c2 << EOF
set DeviceType dummy
set Port 0
start $r2
EOF
sleep 1
test `$tinc $c1 dump reachable nodes | wc -l` = 2
test `$tinc $c2 dump reachable nodes | wc -l` = 2
$tinc $c2 stop
$tinc $c1 stop