aboutsummaryrefslogtreecommitdiff
path: root/src/gns/test_plugin_rest_gns.sh
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2019-10-11 14:48:02 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2019-10-11 14:48:02 +0200
commit559daabee673134f03d76f16d25c1e0ef23b4fdc (patch)
treeeed15cd757cdf6d968ff9d0390837a1ba6f7269e /src/gns/test_plugin_rest_gns.sh
parent3b80c8d9daddaeaf033d0b0d3f6cda842a939c8d (diff)
downloadgnunet-559daabee673134f03d76f16d25c1e0ef23b4fdc.tar.gz
gnunet-559daabee673134f03d76f16d25c1e0ef23b4fdc.zip
fix rest; uncrustify
Diffstat (limited to 'src/gns/test_plugin_rest_gns.sh')
-rwxr-xr-xsrc/gns/test_plugin_rest_gns.sh67
1 files changed, 44 insertions, 23 deletions
diff --git a/src/gns/test_plugin_rest_gns.sh b/src/gns/test_plugin_rest_gns.sh
index ec495a04b..09f155e01 100755
--- a/src/gns/test_plugin_rest_gns.sh
+++ b/src/gns/test_plugin_rest_gns.sh
@@ -1,7 +1,20 @@
1#!/usr/bin/bash 1#!/bin/sh
2 2# This file is in the public domain.
3#First, start gnunet-arm and the rest-service. 3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
4#Exit 0 means success, exit 1 means failed test 4
5LOCATION=$(which gnunet-config)
6if [ -z $LOCATION ]
7then
8 LOCATION="gnunet-config"
9fi
10$LOCATION --version 1> /dev/null
11if test $? != 0
12then
13 echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
14 exit 77
15fi
16
17rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
5 18
6gns_link="http://localhost:7776/gns" 19gns_link="http://localhost:7776/gns"
7wrong_link="http://localhost:7776/gnsandmore" 20wrong_link="http://localhost:7776/gnsandmore"
@@ -9,42 +22,50 @@ wrong_link="http://localhost:7776/gnsandmore"
9curl_get () { 22curl_get () {
10 #$1 is link 23 #$1 is link
11 #$2 is grep 24 #$2 is grep
12 cache="$(curl -v "$1" 2>&1 | grep "$2")" 25 cache="$(gnurl -v "$1" 2>&1 | grep "$2")"
13 #echo $cache 26 echo "$cache"
14 if [ "" == "$cache" ] 27 if [ "" == "$cache" ]
15 then 28 then
29 gnunet-identity -D "$TEST_TLD" -c test_gns_lookup.conf > /dev/null 2>&1
30 gnunet-arm -e -c test_gns_lookup.conf
16 exit 1 31 exit 1
17 fi 32 fi
18} 33}
34TEST_TLD="testtld"
19 35
20gnunet-identity -D "test_plugin_rest_gns" > /dev/null 2>&1 36gnunet-arm -s -c test_gns_lookup.conf
37gnunet-arm -I
38gnunet-identity -D "$TEST_TLD" -c test_gns_lookup.conf > /dev/null 2>&1
21 39
22curl_get "$gns_link/www.test_plugin_rest_gns" "error" 40curl_get "$gns_link/www.$TEST_TLD" "error"
23 41
24gnunet-identity -C "test_plugin_rest_gns" 42gnunet-identity -C "$TEST_TLD" -c test_gns_lookup.conf
43sleep 0.5
44curl_get "$gns_link/www.$TEST_TLD" "\[\]"
25 45
26curl_get "$gns_link/www.test_plugin_rest_gns" "\[\]" 46gnunet-namestore -z "$TEST_TLD" -p -a -n www -e 1d -V 1.1.1.1 -t A -c test_gns_lookup.conf
27 47
28gnunet-namestore -z "test_plugin_rest_gns" -p -a -n www -e 1d -V 1.1.1.1 -t A 48curl_get "$gns_link/www.$TEST_TLD" "1.1.1.1"
29 49
30curl_get "$gns_link/www.test_plugin_rest_gns" "1.1.1.1" 50gnunet-namestore -z "$TEST_TLD" -p -a -n www -e 1d -V 1::1 -t AAAA -c test_gns_lookup.conf
31 51
32gnunet-namestore -z "test_plugin_rest_gns" -p -a -n www -e 1d -V 1::1 -t AAAA 52curl_get "$gns_link/www.$TEST_TLD" "1::1.*1.1.1.1"
33 53
34curl_get "$gns_link/www.test_plugin_rest_gns" "1::1.*1.1.1.1" 54gnunet-namestore -z "$TEST_TLD" -p -a -n www -e 1d -V 1.1.1.2 -t A -c test_gns_lookup.conf
35 55
36gnunet-namestore -z "test_plugin_rest_gns" -p -a -n www -e 1d -V 1.1.1.2 -t A 56curl_get "$gns_link/www.$TEST_TLD" "1.1.1.2.*1::1.*1.1.1.1"
57curl_get "$gns_link/www.$TEST_TLD?record_type=A" "1.1.1.2.*1.1.1.1"
58curl_get "$gns_link/www.$TEST_TLD?record_type=AAAA" "1::1"
59curl_get "$gns_link/www.$TEST_TLD?record_type=WRONG_TYPE" "1.1.1.2.*1::1.*1.1.1.1"
37 60
38curl_get "$gns_link/www.test_plugin_rest_gns" "1.1.1.2.*1::1.*1.1.1.1" 61gnunet-namestore -z "$TEST_TLD" -p -a -n www1 -e 1d -V 1.1.1.1 -t A -c test_gns_lookup.conf
39curl_get "$gns_link/www.test_plugin_rest_gns?record_type=A" "1.1.1.2.*1.1.1.1" 62curl_get "$gns_link/www1.$TEST_TLD" "1.1.1.1"
40curl_get "$gns_link/www.test_plugin_rest_gns?record_type=AAAA" "1::1"
41curl_get "$gns_link/www.test_plugin_rest_gns?record_type=WRONG_TYPE" "1.1.1.2.*1::1.*1.1.1.1"
42 63
43gnunet-namestore -z "test_plugin_rest_gns" -p -a -n www1 -e 1d -V 1.1.1.1 -t A 64gnunet-namestore -z "$TEST_TLD" -d -n www1 -c test_gns_lookup.conf
44curl_get "$gns_link/www1.test_plugin_rest_gns" "1.1.1.1" 65gnunet-namestore -z "$TEST_TLD" -d -n www -c test_gns_lookup.conf
45 66
46gnunet-identity -D "test_plugin_rest_gns" > /dev/null 2>&1 67gnunet-identity -D "$TEST_TLD" -c test_gns_lookup.conf > /dev/null 2>&1
47 68
48curl_get "$gns_link/www1.test_plugin_rest_gns" "error" 69curl_get "$gns_link/www1.$TEST_TLD" "error"
49 70
50exit 0 71exit 0