Ensure proper logging in the invite-offline test.
[tinc] / test / invite-offline.test
1 #!/bin/sh
2
3 . ./testlib.sh
4
5 # Initialize one node
6
7 $tinc $c1 <<EOF
8 init foo
9 set DeviceType dummy
10 set Mode switch
11 set Broadcast no
12 del Port
13 set Address localhost
14 set Port 32758
15 EOF
16
17 # Generate an invitation offline and let another node join the VPN
18
19 invitation=`$tinc $c1 invite bar`
20
21 $tinc $c1 start $r1
22
23 $tinc $c2 join $invitation
24
25 # Test equivalence of host config files
26
27 cmp $d1/hosts/foo $d2/hosts/foo
28 test "`grep ^Ed25519PublicKey $d1/hosts/bar`" = "`grep ^Ed25519PublicKey $d2/hosts/bar`"
29
30 # Test Mode, Broadcast and ConnectTo statements
31
32 test `$tinc $c2 get Mode` = switch
33 test `$tinc $c2 get Broadcast` = no
34 test `$tinc $c2 get ConnectTo` = foo
35
36 # Check whether the new node can join the VPN
37
38 $tinc $c2 << EOF
39 set DeviceType dummy
40 set Port 0
41 start $r2
42 EOF
43
44 sleep 1
45
46 test `$tinc $c1 dump reachable nodes | wc -l` = 2
47 test `$tinc $c2 dump reachable nodes | wc -l` = 2
48
49 $tinc $c2 stop
50 $tinc $c1 stop