X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=test%2Fvariables.test;h=6ae0b7975aeb412a2174300d4ceac3f8a10e9acb;hb=refs%2Fheads%2F1.1;hp=bcec9fb2427b74b7155308e0a67593950c79429f;hpb=cfe507c299935bd231be698b8a426cc730f52936;p=tinc diff --git a/test/variables.test b/test/variables.test deleted file mode 100755 index bcec9fb2..00000000 --- a/test/variables.test +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/sh - -. ./testlib.sh - -echo [STEP] Initialize one node - -tinc foo init foo -test "$(tinc foo get Name)" = "foo" - -echo [STEP] Test case sensitivity - -tinc foo set Mode switch -test "$(tinc foo get Mode)" = "switch" -test "$(tinc foo get mode)" = "switch" - -tinc foo set mode router -test "$(tinc foo get Mode)" = "router" -test "$(tinc foo get mode)" = "router" - -tinc foo set Mode Switch -test "$(tinc foo get Mode)" = "Switch" - -echo [STEP] Test deletion - -must_fail tinc foo del Mode hub -tinc foo del Mode switch -test -z "$(tinc foo get Mode)" - -echo [STEP] There can only be one Mode variable - -tinc foo add Mode switch -tinc foo add Mode hub -test "$(tinc foo get Mode)" = "hub" - -echo [STEP] Test addition/deletion of multivalued variables - -tinc foo add Subnet 1 -tinc foo add Subnet 2 -tinc foo add Subnet 2 -tinc foo add Subnet 3 -test "$(tinc foo get Subnet | rm_cr)" = "1 -2 -3" - -tinc foo del Subnet 2 -test "$(tinc foo get Subnet | rm_cr)" = "1 -3" - -tinc foo del Subnet -test -z "$(tinc foo get Subnet)" - -echo [STEP] We should not be able to get/set server variables using node.variable syntax - -test -z "$(tinc foo get foo.Name)" -must_fail tinc foo set foo.Name bar - -echo [STEP] Test getting/setting host variables for other nodes - -touch "$DIR_FOO/hosts/bar" - -tinc foo add bar.PMTU 1 -tinc foo add bar.PMTU 2 -test "$(tinc foo get bar.PMTU)" = "2" - -tinc foo add bar.Subnet 1 -tinc foo add bar.Subnet 2 -tinc foo add bar.Subnet 2 -tinc foo add bar.Subnet 3 -test "$(tinc foo get bar.Subnet | rm_cr)" = "1 -2 -3" - -tinc foo del bar.Subnet 2 -test "$(tinc foo get bar.Subnet | rm_cr)" = "1 -3" - -tinc foo del bar.Subnet -test -z "$(tinc foo get bar.Subnet)" - -echo [STEP] We should not be able to get/set for nodes with invalid names - -touch "$DIR_FOO/hosts/qu-ux" -must_fail tinc foo set qu-ux.Subnet 1 - -echo [STEP] We should not be able to set obsolete variables unless forced - -must_fail tinc foo set PrivateKey 12345 -tinc foo --force set PrivateKey 12345 -test "$(tinc foo get PrivateKey)" = "12345" - -tinc foo del PrivateKey -test -z "$(tinc foo get PrivateKey)"