[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated: added -R tests for multiple
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated: added -R tests for multiple arguments |
Date: |
Tue, 13 Nov 2018 14:28:37 +0100 |
This is an automated email from the git hooks/post-receive script.
rexxnor pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new c84054626 added -R tests for multiple arguments
c84054626 is described below
commit c84054626c6cc460bad4b6562ee89c221be308aa
Author: rexxnor <address@hidden>
AuthorDate: Tue Nov 13 14:22:01 2018 +0100
added -R tests for multiple arguments
---
src/namestore/test_namestore_put_multiple.sh | 124 +++++++++++++++++++++++++++
1 file changed, 124 insertions(+)
diff --git a/src/namestore/test_namestore_put_multiple.sh
b/src/namestore/test_namestore_put_multiple.sh
new file mode 100644
index 000000000..48ad95a3c
--- /dev/null
+++ b/src/namestore/test_namestore_put_multiple.sh
@@ -0,0 +1,124 @@
+#!/bin/bash
+
+# Check for required packages
+if ! [ -x "$(command -v gnunet-namestore)" ]; then
+ echo 'bind/named is not installed' >&2
+ exit 1
+fi
+
+# Check if gnunet is running
+gnunet-arm -I 2&>1 /dev/null
+ret=$?
+if [ 0 -ne $ret ]; then
+ echo 'gnunet services are not running'
+ exit 1
+fi
+
+## GNUNET part
+# Check if identity exists and delets and readds it to get rid of entries in
zone
+gnunet-identity -d | grep randomtestingid 2>&1 /dev/null
+ret=$?
+
+if [ 0 -ne $ret ]; then
+ gnunet-identity -D randomtestingid
+ gnunet-identity -C randomtestingid
+fi
+
+function minimize_ttl {
+ ttl=10000000
+ arr=$1
+ # parse each element and update ttl to smallest one
+ for i in "address@hidden"
+ do
+ currttl=$(echo -n "$i" | cut -d' ' -f1)
+ if [ "$currttl" -lt "$ttl" ]
+ then
+ ttl=$currttl
+ fi
+
+ done
+ echo "$ttl"
+}
+
+function get_record_type {
+ arr=$1
+ typ=$(echo -n "${arr[0]}" | cut -d' ' -f2)
+ echo "$typ"
+}
+
+function get_value {
+ arr=$1
+ val=$(echo -n "${arr[0]}" | cut -d' ' -f4-)
+ echo "$val"
+}
+
+function testing {
+ label=$1
+ records=$2
+ recordstring=""
+ typ=$(get_record_type "address@hidden")
+ for i in "address@hidden"
+ do
+ recordstring+="-R $i"
+ done
+ #echo "$recordstring"
+ gnunet-namestore -z randomtestingid -n "$label" "$recordstring" 2>&1
/dev/null
+ if [ 0 -ne $ret ]; then
+ echo "failed to add record $label: $recordstring"
+ fi
+ gnunet-gns -t "$typ" -u foo2.randomtestingid 2>&1 /dev/null
+ if [ 0 -ne $ret ]; then
+ echo "record $label could not be found"
+ fi
+}
+
+# TEST CASES
+# 1
+echo "Testing adding of single A record with -R"
+declare -a arr=('1200 A n 127.0.0.1')
+testing test1 "address@hidden"
+# 2
+echo "Testing adding of multiple A records with -R"
+declare -a arr=('1200 A n 127.0.0.1' '2400 A n 127.0.0.2')
+testing test2 "address@hidden"
+# 3
+echo "Testing adding of multiple different records with -R"
+declare -a arr=('1200 A n 127.0.0.1' '2400 AAAA n 2002::')
+testing test3 "address@hidden"
+# 4
+echo "Testing adding of single GNS2DNS record with -R"
+declare -a arr=('86400 GNS2DNS n address@hidden')
+testing test4 "address@hidden"
+# 5
+echo "Testing adding of single GNS2DNS shadow record with -R"
+declare -a arr=('86409 GNS2DNS s address@hidden')
+testing test5 "address@hidden"
+# 6
+echo "Testing adding of multiple GNS2DNS record with -R"
+declare -a arr=('1 GNS2DNS n address@hidden' '3600 GNS2DNS s address@hidden')
+testing test6 "address@hidden"
+val=$(gnunet-gns -t GNS2DNS -u test6.randomtestingid)
+if [[ $val == *"127.0.0.1"* ]]; then
+ echo "shadow!"
+fi
+echo "Sleeping to let record expire"
+sleep 5
+val=$(gnunet-gns -t GNS2DNS -u test6.randomtestingid)
+if [[ $val == *"127.0.0.2"* ]]; then
+ echo "no shadow!"
+fi
+# 7
+echo "Testing adding MX record with -R"
+declare -a arr=('3600 MX n 10,mail')
+testing test7 "address@hidden"
+# 8
+echo "Testing adding TXT record with -R"
+declare -a arr=('3600 TXT n Pretty_Unicorns')
+testing test8 "address@hidden"
+# 8
+echo "Testing adding TXT record with -R"
+declare -a arr=('3600 SRV n _autodiscover_old._tcp.bfh.ch.')
+testing test8 "address@hidden"
+
+# CLEANUP
+gnunet-identity -D randomtestingid
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet] branch master updated: added -R tests for multiple arguments,
gnunet <=