aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/test_namestore_put_multiple.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/namestore/test_namestore_put_multiple.sh')
-rwxr-xr-x[-rw-r--r--]src/namestore/test_namestore_put_multiple.sh49
1 files changed, 19 insertions, 30 deletions
diff --git a/src/namestore/test_namestore_put_multiple.sh b/src/namestore/test_namestore_put_multiple.sh
index f33fb1c3a..4c7340440 100644..100755
--- a/src/namestore/test_namestore_put_multiple.sh
+++ b/src/namestore/test_namestore_put_multiple.sh
@@ -24,25 +24,9 @@ if [ 0 -ne $ret ]; then
24 gnunet-identity -C randomtestingid 24 gnunet-identity -C randomtestingid
25fi 25fi
26 26
27function minimize_ttl {
28 ttl=10000000
29 arr=$1
30 # parse each element and update ttl to smallest one
31 for i in "${arr[@]}"
32 do
33 currttl=$(echo -n "$i" | cut -d' ' -f1)
34 if [ "$currttl" -lt "$ttl" ]
35 then
36 ttl=$currttl
37 fi
38
39 done
40 echo "$ttl"
41}
42
43function get_record_type { 27function get_record_type {
44 arr=$1 28 arr=$1
45 typ=$(echo -n "${arr[0]}" | cut -d' ' -f2) 29 typ=$(echo -n "${arr[0]}" | cut -d' ' -f1)
46 echo "$typ" 30 echo "$typ"
47} 31}
48 32
@@ -59,10 +43,14 @@ function testing {
59 typ=$(get_record_type "${records[@]}") 43 typ=$(get_record_type "${records[@]}")
60 for i in "${records[@]}" 44 for i in "${records[@]}"
61 do 45 do
62 recordstring+="-R $i" 46 recordstring+="$i"$'\n'
63 done 47 done
64 #echo "$recordstring" 48 echo "$recordstring"
65 gnunet-namestore -z randomtestingid -n "$label" "$recordstring" 2>&1 /dev/null 49 gnunet-namestore -a -S <<EOF
50$label.randomtestingid:
51 $recordstring
52EOF
53 ret=$?
66 if [ 0 -ne $ret ]; then 54 if [ 0 -ne $ret ]; then
67 echo "failed to add record $label: $recordstring" 55 echo "failed to add record $label: $recordstring"
68 fi 56 fi
@@ -75,26 +63,27 @@ function testing {
75# TEST CASES 63# TEST CASES
76# 1 64# 1
77echo "Testing adding of single A record with -R" 65echo "Testing adding of single A record with -R"
66declare -a arr=('A 1200 [r] 127.0.0.1')
78testing test1 "${arr[@]}" 67testing test1 "${arr[@]}"
79# 2 68# 2
80echo "Testing adding of multiple A records with -R" 69echo "Testing adding of multiple A records with -R"
81declare -a arr=('1200 A n 127.0.0.1' '2400 A n 127.0.0.2') 70declare -a arr=('A 1200 [r] 127.0.0.1' 'A 2400 [r] 127.0.0.2')
82testing test2 "${arr[@]}" 71testing test2 "${arr[@]}"
83# 3 72# 3
84echo "Testing adding of multiple different records with -R" 73echo "Testing adding of multiple different records with -R"
85declare -a arr=('1200 A n 127.0.0.1' '2400 AAAA n 2002::') 74declare -a arr=('A 1200 [r] 127.0.0.1' 'AAAA 2400 [r] 2002::')
86testing test3 "${arr[@]}" 75testing test3 "${arr[@]}"
87# 4 76# 4
88echo "Testing adding of single GNS2DNS record with -R" 77echo "Testing adding of single GNS2DNS record with -R"
89declare -a arr=('86400 GNS2DNS n gnu.org@127.0.0.1') 78declare -a arr=('GNS2DNS 86400 [r] gnu.org@127.0.0.1')
90testing test4 "${arr[@]}" 79testing test4 "${arr[@]}"
91# 5 80# 5
92echo "Testing adding of single GNS2DNS shadow record with -R" 81echo "Testing adding of single GNS2DNS shadow record with -R"
93declare -a arr=('86409 GNS2DNS s gnu.org@127.0.0.250') 82declare -a arr=('GNS2DNS 86409 [rs] gnu.org@127.0.0.250')
94testing test5 "${arr[@]}" 83testing test5 "${arr[@]}"
95# 6 84# 6
96echo "Testing adding of multiple GNS2DNS record with -R" 85echo "Testing adding of multiple GNS2DNS record with -R"
97declare -a arr=('1 GNS2DNS n gnunet.org@127.0.0.1' '3600 GNS2DNS s gnunet.org@127.0.0.2') 86declare -a arr=('GNS2DNS 1 [r] gnunet.org@127.0.0.1' 'GNS2DNS 3600 [s] gnunet.org@127.0.0.2')
98testing test6 "${arr[@]}" 87testing test6 "${arr[@]}"
99val=$(gnunet-gns -t GNS2DNS -u test6.randomtestingid) 88val=$(gnunet-gns -t GNS2DNS -u test6.randomtestingid)
100if [[ $val == *"127.0.0.1"* ]]; then 89if [[ $val == *"127.0.0.1"* ]]; then
@@ -108,16 +97,16 @@ if [[ $val == *"127.0.0.2"* ]]; then
108fi 97fi
109# 7 98# 7
110echo "Testing adding MX record with -R" 99echo "Testing adding MX record with -R"
111declare -a arr=('3600 MX n 10,mail') 100declare -a arr=('MX 3600 [r] 10,mail')
112testing test7 "${arr[@]}" 101testing test7 "${arr[@]}"
113# 8 102# 8
114echo "Testing adding TXT record with -R" 103echo "Testing adding TXT record with -R"
115declare -a arr=('3600 TXT n Pretty_Unicorns') 104declare -a arr=('TXT 3600 [r] Pretty_Unicorns')
116testing test8 "${arr[@]}" 105testing test8 "${arr[@]}"
117# 8 106# 8
118echo "Testing adding TXT record with -R" 107#echo "Testing adding TXT record with -R"
119declare -a arr=('3600 SRV n _autodiscover_old._tcp.bfh.ch.') 108#declare -a arr=('SRV 3600 [r] _autodiscover_old._tcp.bfh.ch.')
120testing test8 "${arr[@]}" 109#testing test8 "${arr[@]}"
121 110
122# CLEANUP 111# CLEANUP
123gnunet-identity -D randomtestingid 112gnunet-identity -D randomtestingid