GitHub CI: update list of container images
[tinc] / test / invite-join.test
1 #!/bin/sh
2
3 . "${0%/*}/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 set Address localhost
13 set Port 32751
14 start $r1
15 EOF
16
17 # Generate an invitation and let another node join the VPN
18
19 $tinc $c1 invite bar | $tinc $c2 join
20
21 # Test equivalence of host config files
22
23 cmp $d1/hosts/foo $d2/hosts/foo
24 test "`grep ^Ed25519PublicKey $d1/hosts/bar`" = "`grep ^Ed25519PublicKey $d2/hosts/bar`"
25
26 # Test Mode, Broadcast and ConnectTo statements
27
28 test `$tinc $c2 get Mode` = switch
29 test `$tinc $c2 get Broadcast` = no
30 test `$tinc $c2 get ConnectTo` = foo
31
32 # Check whether the new node can join the VPN
33
34 $tinc $c2 << EOF
35 set DeviceType dummy
36 set Port 0
37 start $r2
38 EOF
39
40 sleep 1
41
42 test `$tinc $c1 dump reachable nodes | wc -l` = 2
43 test `$tinc $c2 dump reachable nodes | wc -l` = 2
44
45 $tinc $c2 stop
46 $tinc $c1 stop