diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-09-30 09:16:25 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-09-30 09:16:25 +0000 |
commit | feebaa1b4e5236d837d7f9e55562426b70fadf5a (patch) | |
tree | bb75f9319c094769b9f7fb05be83d54c66e95ae8 /src/namestore | |
parent | e8873abb7cd92b5b71785a0e5a24de68fae40b21 (diff) | |
download | gnunet-feebaa1b4e5236d837d7f9e55562426b70fadf5a.tar.gz gnunet-feebaa1b4e5236d837d7f9e55562426b70fadf5a.zip |
next test
Diffstat (limited to 'src/namestore')
-rw-r--r-- | src/namestore/Makefile.am | 3 | ||||
-rwxr-xr-x | src/namestore/test_namestore_delete.sh | 63 | ||||
-rwxr-xr-x | src/namestore/test_namestore_lookup.sh | 8 |
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 | ||
283 | check_SCRIPTS = \ | 283 | check_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 | ||
287 | EXTRA_DIST = \ | 288 | EXTRA_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 | ||
2 | CONFIGURATION="test_namestore_defaults.conf" | ||
3 | trap "gnunet-arm -e -c $CONFIGURATION" SIGINT | ||
4 | rm -rf `gnunet-config -c $CONFIGURATION -s PATHS -o SERVICEHOME` | ||
5 | TEST_DOMAIN_PLUS="www.gnu" | ||
6 | TEST_DOMAIN_DNS="www3.gnu" | ||
7 | TEST_IP_PLUS="127.0.0.1" | ||
8 | TEST_IP_DNS="131.159.74.67" | ||
9 | TEST_RECORD_CNAME_SERVER="server" | ||
10 | TEST_RECORD_CNAME_PLUS="server.+" | ||
11 | TEST_RECORD_CNAME_DNS="gnunet.org" | ||
12 | TEST_RECORD_NAME_SERVER="server" | ||
13 | TEST_RECORD_NAME_PLUS="www" | ||
14 | TEST_RECORD_NAME_DNS="www3" | ||
15 | which timeout &> /dev/null && DO_TIMEOUT="timeout 5" | ||
16 | |||
17 | function start_peer | ||
18 | { | ||
19 | gnunet-arm -s -c $CONFIGURATION | ||
20 | gnunet-identity -C testego -c $CONFIGURATION | ||
21 | } | ||
22 | |||
23 | function stop_peer | ||
24 | { | ||
25 | gnunet-identity -D testego -c $CONFIGURATION | ||
26 | gnunet-arm -e -c $CONFIGURATION | ||
27 | } | ||
28 | |||
29 | |||
30 | start_peer | ||
31 | # Create a public record | ||
32 | gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME_DNS -t A -V $TEST_IP_PLUS -e never -c $CONFIGURATION | ||
33 | # Delete record | ||
34 | gnunet-namestore -p -z testego -d -n $TEST_RECORD_NAME_DNS -t A -V $TEST_IP_PLUS -e never -c $CONFIGURATION | ||
35 | # Lookup specific name | ||
36 | OUTPUT=`gnunet-namestore -p -z testego -n $TEST_RECORD_NAME_DNS -D` | ||
37 | FOUND_IP=false | ||
38 | FOUND_NAME=false | ||
39 | for 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 | ||
48 | stop_peer | ||
49 | |||
50 | |||
51 | if [ $FOUND_NAME == false -a $FOUND_IP != false ] | ||
52 | then | ||
53 | echo "PASS: Delete name in namestore" | ||
54 | exit 0 | ||
55 | elif [ $FOUND_NAME == true ] | ||
56 | then | ||
57 | echo "FAIL: Delete name in namestore: name returned" | ||
58 | exit 1 | ||
59 | elif [ $FOUND_IP == true ] | ||
60 | then | ||
61 | echo "FAIL: Delete name in namestore: IP returned" | ||
62 | exit 1 | ||
63 | fi | ||
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 | |||
40 | for LINE in $OUTPUT ; | 40 | for 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 |
49 | stop_peer | 51 | stop_peer |
50 | 52 | ||
51 | 53 | ||
52 | if [ $FOUND_DNS == true -a $FOUND_IP == true ] | 54 | if [ $FOUND_NAME == true -a $FOUND_IP == true ] |
53 | then | 55 | then |
54 | echo "PASS: Lookup name in namestore" | 56 | echo "PASS: Lookup name in namestore" |
55 | exit 0 | 57 | exit 0 |
56 | elif [ $FOUND_DNS == false ] | 58 | elif [ $FOUND_NAME == false ] |
57 | then | 59 | then |
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 |