Add tests for the fsck command.
[tinc] / test / invite-join.test
1 #!/bin/sh
2
3 . ./testlib.sh
4
5 echo [STEP] Initialize one node
6
7 tinc foo <<EOF
8 init foo
9 set DeviceType dummy
10 set Mode switch
11 set Broadcast no
12 set Address localhost
13 set Port 30010
14 EOF
15
16 start_tinc foo
17
18 echo [STEP] Generate an invitation and let another node join the VPN
19
20 tinc foo invite bar | tinc bar join
21
22 echo [STEP] Test equivalence of host config files
23
24 diff -w "$DIR_FOO/hosts/foo" "$DIR_BAR/hosts/foo"
25 test "$(grep ^Ed25519PublicKey "$DIR_FOO/hosts/bar")" = "$(grep ^Ed25519PublicKey "$DIR_BAR/hosts/bar")"
26
27 echo [STEP] Test Mode, Broadcast and ConnectTo statements
28
29 test "$(tinc bar get Mode)" = switch
30 test "$(tinc bar get Broadcast)" = no
31 test "$(tinc bar get ConnectTo)" = foo
32
33 echo [STEP] Check whether the new node can join the VPN
34
35 tinc bar <<EOF
36 set DeviceType dummy
37 set Port 0
38 EOF
39
40 create_script foo hosts/bar-up
41 create_script bar hosts/foo-up
42
43 start_tinc bar
44
45 wait_script foo hosts/bar-up
46 wait_script bar hosts/foo-up
47
48 require_nodes foo 2
49 require_nodes bar 2