5 echo [STEP] Initialize one node
8 test "$(tinc foo get Name)" = "foo"
10 echo [STEP] Test case sensitivity
12 tinc foo set Mode switch
13 test "$(tinc foo get Mode)" = "switch"
14 test "$(tinc foo get mode)" = "switch"
16 tinc foo set mode router
17 test "$(tinc foo get Mode)" = "router"
18 test "$(tinc foo get mode)" = "router"
20 tinc foo set Mode Switch
21 test "$(tinc foo get Mode)" = "Switch"
23 echo [STEP] Test deletion
25 expect_code "$EXIT_FAILURE" tinc foo del Mode hub
26 tinc foo del Mode switch
27 test -z "$(tinc foo get Mode)"
29 echo [STEP] There can only be one Mode variable
31 tinc foo add Mode switch
33 test "$(tinc foo get Mode)" = "hub"
35 echo [STEP] Test addition/deletion of multivalued variables
37 tinc foo add Subnet 1.1.1.1
38 tinc foo add Subnet 2.2.2.2
39 tinc foo add Subnet 2.2.2.2
40 tinc foo add Subnet 3.3.3.3
41 test "$(tinc foo get Subnet | rm_cr)" = "1.1.1.1
45 tinc foo del Subnet 2.2.2.2
46 test "$(tinc foo get Subnet | rm_cr)" = "1.1.1.1
50 test -z "$(tinc foo get Subnet)"
52 echo [STEP] We should not be able to get/set server variables using node.variable syntax
54 test -z "$(tinc foo get foo.Name)"
55 expect_code "$EXIT_FAILURE" tinc foo set foo.Name bar
57 echo [STEP] Test getting/setting host variables for other nodes
59 touch "$DIR_FOO/hosts/bar"
61 tinc foo add bar.PMTU 1
62 tinc foo add bar.PMTU 2
63 test "$(tinc foo get bar.PMTU)" = "2"
65 tinc foo add bar.Subnet 1.1.1.1
66 tinc foo add bar.Subnet 2.2.2.2
67 tinc foo add bar.Subnet 2.2.2.2
68 tinc foo add bar.Subnet 3.3.3.3
69 test "$(tinc foo get bar.Subnet | rm_cr)" = "1.1.1.1
73 tinc foo del bar.Subnet 2.2.2.2
74 test "$(tinc foo get bar.Subnet | rm_cr)" = "1.1.1.1
77 tinc foo del bar.Subnet
78 test -z "$(tinc foo get bar.Subnet)"
80 echo [STEP] We should not be able to get/set for nodes with invalid names
82 touch "$DIR_FOO/hosts/qu-ux"
83 expect_code "$EXIT_FAILURE" tinc foo set qu-ux.Subnet 1.1.1.1
85 echo [STEP] We should not be able to set obsolete variables unless forced
87 expect_code "$EXIT_FAILURE" tinc foo set PrivateKey 12345
88 tinc foo --force set PrivateKey 12345
89 test "$(tinc foo get PrivateKey)" = "12345"
91 tinc foo del PrivateKey
92 test -z "$(tinc foo get PrivateKey)"
94 echo [STEP] We should not be able to set/add malformed Subnets
96 expect_code "$EXIT_FAILURE" tinc foo add Subnet 1.1.1
97 expect_code "$EXIT_FAILURE" tinc foo add Subnet 1:2:3:4:5:
98 expect_code "$EXIT_FAILURE" tinc foo add Subnet 1:2:3:4:5:::6
99 expect_code "$EXIT_FAILURE" tinc foo add Subnet 1:2:3:4:5:6:7:8:9
100 expect_code "$EXIT_FAILURE" tinc foo add Subnet 256.256.256.256
101 expect_code "$EXIT_FAILURE" tinc foo add Subnet 1:2:3:4:5:6:7:8.123
102 expect_code "$EXIT_FAILURE" tinc foo add Subnet 1:2:3:4:5:6:7:1.2.3.4
103 expect_code "$EXIT_FAILURE" tinc foo add Subnet a:b:c:d:e:f:g:h
104 expect_code "$EXIT_FAILURE" tinc foo add Subnet 1.1.1.1/0
105 expect_code "$EXIT_FAILURE" tinc foo add Subnet 1.1.1.1/-1
106 expect_code "$EXIT_FAILURE" tinc foo add Subnet 1.1.1.1/33
107 expect_code "$EXIT_FAILURE" tinc foo add Subnet 1::/0
108 expect_code "$EXIT_FAILURE" tinc foo add Subnet 1::/-1
109 expect_code "$EXIT_FAILURE" tinc foo add Subnet 1::/129
110 expect_code "$EXIT_FAILURE" tinc foo add Subnet ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
111 test -z "$(tinc foo get Subnet)"