3 # shellcheck source=testlib.sh
6 echo [STEP] Initialize one node
9 test "$(tinc foo get Name)" = "foo"
11 echo [STEP] Test case sensitivity
13 tinc foo set Mode switch
14 test "$(tinc foo get Mode)" = "switch"
15 test "$(tinc foo get mode)" = "switch"
17 tinc foo set mode router
18 test "$(tinc foo get Mode)" = "router"
19 test "$(tinc foo get mode)" = "router"
21 tinc foo set Mode Switch
22 test "$(tinc foo get Mode)" = "Switch"
24 echo [STEP] Test deletion
26 must_fail tinc foo del Mode hub
27 tinc foo del Mode switch
28 test -z "$(tinc foo get Mode)"
30 echo [STEP] There can only be one Mode variable
32 tinc foo add Mode switch
34 test "$(tinc foo get Mode)" = "hub"
36 echo [STEP] Test addition/deletion of multivalued variables
42 test "$(tinc foo get Subnet | rm_cr)" = "1
47 test "$(tinc foo get Subnet | rm_cr)" = "1
51 test -z "$(tinc foo get Subnet)"
53 echo [STEP] We should not be able to get/set server variables using node.variable syntax
55 test -z "$(tinc foo get foo.Name)"
56 must_fail tinc foo set foo.Name bar
58 echo [STEP] Test getting/setting host variables for other nodes
60 touch "$DIR_FOO/hosts/bar"
62 tinc foo add bar.PMTU 1
63 tinc foo add bar.PMTU 2
64 test "$(tinc foo get bar.PMTU)" = "2"
66 tinc foo add bar.Subnet 1
67 tinc foo add bar.Subnet 2
68 tinc foo add bar.Subnet 2
69 tinc foo add bar.Subnet 3
70 test "$(tinc foo get bar.Subnet | rm_cr)" = "1
74 tinc foo del bar.Subnet 2
75 test "$(tinc foo get bar.Subnet | rm_cr)" = "1
78 tinc foo del bar.Subnet
79 test -z "$(tinc foo get bar.Subnet)"
81 echo [STEP] We should not be able to get/set for nodes with invalid names
83 touch "$DIR_FOO/hosts/qu-ux"
84 must_fail tinc foo set qu-ux.Subnet 1
86 echo [STEP] We should not be able to set obsolete variables unless forced
88 must_fail tinc foo set PrivateKey 12345
89 tinc foo --force set PrivateKey 12345
90 test "$(tinc foo get PrivateKey)" = "12345"
92 tinc foo del PrivateKey
93 test -z "$(tinc foo get PrivateKey)"