aboutsummaryrefslogtreecommitdiff
path: root/src/gns/test_plugin_rest_gns.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/gns/test_plugin_rest_gns.sh')
-rwxr-xr-xsrc/gns/test_plugin_rest_gns.sh75
1 files changed, 0 insertions, 75 deletions
diff --git a/src/gns/test_plugin_rest_gns.sh b/src/gns/test_plugin_rest_gns.sh
deleted file mode 100755
index 25c39f135..000000000
--- a/src/gns/test_plugin_rest_gns.sh
+++ /dev/null
@@ -1,75 +0,0 @@
1#!/bin/sh
2# This file is in the public domain.
3trap "gnunet-arm -e -c test_gns_lookup.conf" INT
4LOCATION=$(which gnunet-config)
5if [ -z $LOCATION ]
6then
7 LOCATION="gnunet-config"
8fi
9$LOCATION --version 1> /dev/null
10if test $? != 0
11then
12 echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
13 exit 77
14fi
15
16rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
17
18gns_link="http://localhost:7776/gns"
19wrong_link="http://localhost:7776/gnsandmore"
20
21curl_get () {
22 #$1 is link
23 #$2 is grep
24 XURL=`which gnurl || which curl`
25 if [ "" = "$XURL" ]
26 then
27 echo "HTTP client (curl/gnurl) not found, exiting"
28 exit 77
29 fi
30 sleep 0.5
31 cache="$(${XURL} -v "$1" 2>&1 | grep "$2")"
32 #echo "$cache"
33 if [ "" = "$cache" ]
34 then
35 gnunet-identity -D "$TEST_TLD" -c test_gns_lookup.conf > /dev/null 2>&1
36 gnunet-arm -e -c test_gns_lookup.conf
37 echo "Download of $1 using $XURL failed"
38 exit 1
39 fi
40}
41TEST_TLD="testtld"
42
43gnunet-arm -s -c test_gns_lookup.conf
44curl_get "$gns_link/www.$TEST_TLD" "error"
45
46gnunet-identity -C "$TEST_TLD" -c test_gns_lookup.conf
47sleep 0.5
48curl_get "$gns_link/www.$TEST_TLD" "\[\]"
49
50gnunet-namestore -z "$TEST_TLD" -p -a -n www -e 1d -V 1.1.1.1 -t A -c test_gns_lookup.conf
51
52curl_get "$gns_link/www.$TEST_TLD" "1.1.1.1"
53
54gnunet-namestore -z "$TEST_TLD" -p -a -n www -e 1d -V 1::1 -t AAAA -c test_gns_lookup.conf
55
56curl_get "$gns_link/www.$TEST_TLD" "1::1.*1.1.1.1"
57
58gnunet-namestore -z "$TEST_TLD" -p -a -n www -e 1d -V 1.1.1.2 -t A -c test_gns_lookup.conf
59
60curl_get "$gns_link/www.$TEST_TLD" "1.1.1.2.*1::1.*1.1.1.1"
61curl_get "$gns_link/www.$TEST_TLD?record_type=A" "1.1.1.2.*1.1.1.1"
62curl_get "$gns_link/www.$TEST_TLD?record_type=AAAA" "1::1"
63curl_get "$gns_link/www.$TEST_TLD?record_type=WRONG_TYPE" "1.1.1.2.*1::1.*1.1.1.1"
64
65gnunet-namestore -z "$TEST_TLD" -p -a -n www1 -e 1d -V 1.1.1.1 -t A -c test_gns_lookup.conf
66curl_get "$gns_link/www1.$TEST_TLD" "1.1.1.1"
67
68gnunet-namestore -z "$TEST_TLD" -d -n www1 -c test_gns_lookup.conf
69gnunet-namestore -z "$TEST_TLD" -d -n www -c test_gns_lookup.conf
70
71gnunet-identity -D "$TEST_TLD" -c test_gns_lookup.conf > /dev/null 2>&1
72
73curl_get "$gns_link/www1.$TEST_TLD" "error"
74gnunet-arm -e -c test_gns_lookup.conf
75exit 0