aboutsummaryrefslogtreecommitdiff
path: root/src/namestore
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-09-30 09:16:25 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-09-30 09:16:25 +0000
commitfeebaa1b4e5236d837d7f9e55562426b70fadf5a (patch)
treebb75f9319c094769b9f7fb05be83d54c66e95ae8 /src/namestore
parente8873abb7cd92b5b71785a0e5a24de68fae40b21 (diff)
downloadgnunet-feebaa1b4e5236d837d7f9e55562426b70fadf5a.tar.gz
gnunet-feebaa1b4e5236d837d7f9e55562426b70fadf5a.zip
next test
Diffstat (limited to 'src/namestore')
-rw-r--r--src/namestore/Makefile.am3
-rwxr-xr-xsrc/namestore/test_namestore_delete.sh63
-rwxr-xr-xsrc/namestore/test_namestore_lookup.sh8
3 files changed, 70 insertions, 4 deletions
diff --git a/src/namestore/Makefile.am b/src/namestore/Makefile.am
index 13f025b75..0b225069d 100644
--- a/src/namestore/Makefile.am
+++ b/src/namestore/Makefile.am
@@ -282,7 +282,8 @@ test_plugin_namestore_postgres_LDADD = \
282 282
283check_SCRIPTS = \ 283check_SCRIPTS = \
284 test_namestore_put.sh \ 284 test_namestore_put.sh \
285 test_namestore_lookup.sh 285 test_namestore_lookup.sh \
286 test_namestore_delete.sh
286 287
287EXTRA_DIST = \ 288EXTRA_DIST = \
288 test_namestore_api.conf \ 289 test_namestore_api.conf \
diff --git a/src/namestore/test_namestore_delete.sh b/src/namestore/test_namestore_delete.sh
new file mode 100755
index 000000000..8dabf1441
--- /dev/null
+++ b/src/namestore/test_namestore_delete.sh
@@ -0,0 +1,63 @@
1#!/bin/bash
2CONFIGURATION="test_namestore_defaults.conf"
3trap "gnunet-arm -e -c $CONFIGURATION" SIGINT
4rm -rf `gnunet-config -c $CONFIGURATION -s PATHS -o SERVICEHOME`
5TEST_DOMAIN_PLUS="www.gnu"
6TEST_DOMAIN_DNS="www3.gnu"
7TEST_IP_PLUS="127.0.0.1"
8TEST_IP_DNS="131.159.74.67"
9TEST_RECORD_CNAME_SERVER="server"
10TEST_RECORD_CNAME_PLUS="server.+"
11TEST_RECORD_CNAME_DNS="gnunet.org"
12TEST_RECORD_NAME_SERVER="server"
13TEST_RECORD_NAME_PLUS="www"
14TEST_RECORD_NAME_DNS="www3"
15which timeout &> /dev/null && DO_TIMEOUT="timeout 5"
16
17function start_peer
18{
19 gnunet-arm -s -c $CONFIGURATION
20 gnunet-identity -C testego -c $CONFIGURATION
21}
22
23function stop_peer
24{
25 gnunet-identity -D testego -c $CONFIGURATION
26 gnunet-arm -e -c $CONFIGURATION
27}
28
29
30start_peer
31# Create a public record
32gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME_DNS -t A -V $TEST_IP_PLUS -e never -c $CONFIGURATION
33# Delete record
34gnunet-namestore -p -z testego -d -n $TEST_RECORD_NAME_DNS -t A -V $TEST_IP_PLUS -e never -c $CONFIGURATION
35# Lookup specific name
36OUTPUT=`gnunet-namestore -p -z testego -n $TEST_RECORD_NAME_DNS -D`
37FOUND_IP=false
38FOUND_NAME=false
39for LINE in $OUTPUT ;
40 do
41 if echo "$LINE" | grep -q "$TEST_RECORD_NAME_DNS"; then
42 FOUND_NAME=true;
43 fi
44 if echo "$LINE" | grep -q "$TEST_IP_PLUS"; then
45 FOUND_IP=true;
46 fi
47 done
48stop_peer
49
50
51if [ $FOUND_NAME == false -a $FOUND_IP != false ]
52then
53 echo "PASS: Delete name in namestore"
54 exit 0
55elif [ $FOUND_NAME == true ]
56then
57 echo "FAIL: Delete name in namestore: name returned"
58 exit 1
59elif [ $FOUND_IP == true ]
60then
61 echo "FAIL: Delete name in namestore: IP returned"
62 exit 1
63fi
diff --git a/src/namestore/test_namestore_lookup.sh b/src/namestore/test_namestore_lookup.sh
index da4724ebf..21b3ce1ed 100755
--- a/src/namestore/test_namestore_lookup.sh
+++ b/src/namestore/test_namestore_lookup.sh
@@ -40,20 +40,22 @@ FOUND_NAME=false
40for LINE in $OUTPUT ; 40for LINE in $OUTPUT ;
41 do 41 do
42 if echo "$LINE" | grep -q "$TEST_RECORD_NAME_DNS"; then 42 if echo "$LINE" | grep -q "$TEST_RECORD_NAME_DNS"; then
43 FOUND_DNS=true; 43 FOUND_NAME=true;
44 #echo $FOUND_NAME
44 fi 45 fi
45 if echo "$LINE" | grep -q "$TEST_IP_PLUS"; then 46 if echo "$LINE" | grep -q "$TEST_IP_PLUS"; then
46 FOUND_IP=true; 47 FOUND_IP=true;
48 #echo $FOUND_IP
47 fi 49 fi
48 done 50 done
49stop_peer 51stop_peer
50 52
51 53
52if [ $FOUND_DNS == true -a $FOUND_IP == true ] 54if [ $FOUND_NAME == true -a $FOUND_IP == true ]
53then 55then
54 echo "PASS: Lookup name in namestore" 56 echo "PASS: Lookup name in namestore"
55 exit 0 57 exit 0
56elif [ $FOUND_DNS == false ] 58elif [ $FOUND_NAME == false ]
57then 59then
58 echo "FAIL: Lookup name in namestore: name not returned" 60 echo "FAIL: Lookup name in namestore: name not returned"
59 exit 1 61 exit 1