aboutsummaryrefslogtreecommitdiff
path: root/src/gns
diff options
context:
space:
mode:
authorrexxnor <rexxnor+gnunet@brief.li>2020-02-03 18:26:49 +0100
committerrexxnor <rexxnor+gnunet@brief.li>2020-02-03 18:29:51 +0100
commit1bba6bc1221a64d97f593fc673b947ab5a7dfc54 (patch)
tree014cfad724260fca384d90a983aa2a73088a0fdb /src/gns
parente0e35fc2f34d49fb40a89f00ef639b241fc9d934 (diff)
downloadgnunet-1bba6bc1221a64d97f593fc673b947ab5a7dfc54.tar.gz
gnunet-1bba6bc1221a64d97f593fc673b947ab5a7dfc54.zip
added a test for DHT lookup between peers
Diffstat (limited to 'src/gns')
-rw-r--r--src/gns/test_gns_lookup_peer1.conf68
-rw-r--r--src/gns/test_gns_lookup_peer2.conf64
-rwxr-xr-xsrc/gns/test_gns_multiple_record_lookup.sh68
3 files changed, 200 insertions, 0 deletions
diff --git a/src/gns/test_gns_lookup_peer1.conf b/src/gns/test_gns_lookup_peer1.conf
new file mode 100644
index 000000000..3b034f8d5
--- /dev/null
+++ b/src/gns/test_gns_lookup_peer1.conf
@@ -0,0 +1,68 @@
1@INLINE@ test_gns_defaults.conf
2
3[namecache]
4DISABLE = YES
5
6[PATHS]
7GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-gns-peer-1/
8
9[dht]
10START_ON_DEMAND = YES
11IMMEDIATE_START = YES
12
13[gns]
14# PREFIX = valgrind --leak-check=full --track-origins=yes
15START_ON_DEMAND = YES
16AUTO_IMPORT_PKEY = YES
17MAX_PARALLEL_BACKGROUND_QUERIES = 10
18DEFAULT_LOOKUP_TIMEOUT = 15 s
19RECORD_PUT_INTERVAL = 1 h
20ZONE_PUBLISH_TIME_WINDOW = 1 h
21DNS_ROOT=PD67SGHF3E0447TU9HADIVU9OM7V4QHTOG0EBU69TFRI2LG63DR0
22
23[namestore]
24IMMEDIATE_START = YES
25#PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=/tmp/ns_log
26
27[revocation]
28WORKBITS = 1
29
30[dhtcache]
31QUOTA = 1 MB
32DATABASE = heap
33
34[topology]
35TARGET-CONNECTION-COUNT = 16
36AUTOCONNECT = YES
37FRIENDS-ONLY = NO
38MINIMUM-FRIENDS = 0
39
40[ats]
41WAN_QUOTA_IN = 1 GB
42WAN_QUOTA_OUT = 1 GB
43
44[transport]
45plugins = tcp
46NEIGHBOUR_LIMIT = 50
47PORT = 2091
48
49[transport-tcp]
50TIMEOUT = 300 s
51
52[nat]
53DISABLEV6 = YES
54BINDTO = 127.0.0.1
55ENABLE_UPNP = NO
56BEHIND_NAT = NO
57ALLOW_NAT = NO
58INTERNAL_ADDRESS = 127.0.0.1
59EXTERNAL_ADDRESS = 127.0.0.1
60
61[dns2gns]
62BINARY = gnunet-dns2gns
63START_ON_DEMAND = YES
64IMMEDIATE_START = YES
65RUN_PER_USER = YES
66BIND_TO = 127.0.0.1
67BIND_TO6 = ::1
68OPTIONS = -d 1.1.1.1 -p 12000
diff --git a/src/gns/test_gns_lookup_peer2.conf b/src/gns/test_gns_lookup_peer2.conf
new file mode 100644
index 000000000..d64fdcda3
--- /dev/null
+++ b/src/gns/test_gns_lookup_peer2.conf
@@ -0,0 +1,64 @@
1@INLINE@ test_gns_defaults.conf
2
3[namecache]
4DISABLE = YES
5
6[PATHS]
7GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-gns-peer-2/
8
9[dht]
10START_ON_DEMAND = YES
11IMMEDIATE_START = YES
12
13[identity]
14START_ON_DEMAND = YES
15IMMEDIATE_START = YES
16
17[gns]
18# PREFIX = valgrind --leak-check=full --track-origins=yes
19IMMEDIATE_START = YES
20START_ON_DEMAND = YES
21AUTO_IMPORT_PKEY = YES
22MAX_PARALLEL_BACKGROUND_QUERIES = 10
23DEFAULT_LOOKUP_TIMEOUT = 15 s
24RECORD_PUT_INTERVAL = 1 h
25ZONE_PUBLISH_TIME_WINDOW = 1 h
26DNS_ROOT=PD67SGHF3E0447TU9HADIVU9OM7V4QHTOG0EBU69TFRI2LG63DR0
27
28[namestore]
29IMMEDIATE_START = YES
30#PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=/tmp/ns_log
31
32[revocation]
33WORKBITS = 1
34
35[dhtcache]
36QUOTA = 1 MB
37DATABASE = heap
38
39[topology]
40TARGET-CONNECTION-COUNT = 16
41AUTOCONNECT = YES
42FRIENDS-ONLY = NO
43MINIMUM-FRIENDS = 0
44
45[ats]
46WAN_QUOTA_IN = 1 GB
47WAN_QUOTA_OUT = 1 GB
48
49[transport]
50plugins = tcp
51NEIGHBOUR_LIMIT = 50
52PORT = 2092
53
54[transport-tcp]
55TIMEOUT = 300 s
56
57[nat]
58DISABLEV6 = YES
59BINDTO = 127.0.0.1
60ENABLE_UPNP = NO
61BEHIND_NAT = NO
62ALLOW_NAT = NO
63INTERNAL_ADDRESS = 127.0.0.1
64EXTERNAL_ADDRESS = 127.0.0.1
diff --git a/src/gns/test_gns_multiple_record_lookup.sh b/src/gns/test_gns_multiple_record_lookup.sh
new file mode 100755
index 000000000..fbd9a6b13
--- /dev/null
+++ b/src/gns/test_gns_multiple_record_lookup.sh
@@ -0,0 +1,68 @@
1#!/bin/bash
2# This file is in the public domain.
3trap "gnunet-arm -e -c test_gns_lookup_peer1.conf" INT
4trap "gnunet-arm -e -c test_gns_lookup_peer2.conf" INT
5which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 5"
6
7LOCATION=$(which gnunet-config)
8if [ -z $LOCATION ]
9then
10 LOCATION="gnunet-config"
11fi
12$LOCATION --version 1> /dev/null
13if test $? != 0
14then
15 echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
16 exit 77
17fi
18
19rm -rf `gnunet-config -c test_gns_lookup_peer1.conf -f -s paths -o GNUNET_TEST_HOME`
20rm -rf `gnunet-config -c test_gns_lookup_peer2.conf -f -s paths -o GNUNET_TEST_HOME`
21MY_EGO="localego"
22OTHER_EGO="remoteego"
23
24TEST_IP="127.0.0.1"
25TEST_IPV6="dead::beef"
26LABEL="fnord"
27
28gnunet-arm -s -c test_gns_lookup_peer2.conf
29PKEY=`$DO_TIMEOUT gnunet-identity -V -C $OTHER_EGO -c test_gns_lookup_peer2.conf`
30gnunet-namestore -p -z $OTHER_EGO -a -n $LABEL -t A -V $TEST_IP -e 3600s -c test_gns_lookup_peer2.conf
31gnunet-namestore -p -z $OTHER_EGO -a -n $LABEL -t AAAA -V $TEST_IPV6 -e 3600s -c test_gns_lookup_peer2.conf
32gnunet-namestore -D -z $OTHER_EGO -n $LABEL
33gnunet-arm -e -c test_gns_lookup_peer2.conf
34
35echo "Second peer"
36gnunet-arm -s -c test_gns_lookup_peer1.conf
37echo "Second peer started"
38RESP=`$DO_TIMEOUT gnunet-gns --raw -u $LABEL.$PKEY -t ANY -c test_gns_lookup_peer1.conf`
39RESP1=`$DO_TIMEOUT gnunet-gns --raw -u $LABEL.$PKEY -t A -c test_gns_lookup_peer1.conf`
40RESP2=`$DO_TIMEOUT gnunet-gns --raw -u $LABEL.$PKEY -t AAAA -c test_gns_lookup_peer1.conf`
41gnunet-arm -e -c test_gns_lookup_peer1.conf
42
43rm -rf `gnunet-config -c test_gns_lookup_peer1.conf -f -s paths -o GNUNET_TEST_HOME`
44rm -rf `gnunet-config -c test_gns_lookup_peer2.conf -f -s paths -o GNUNET_TEST_HOME`
45
46RESPONSES=($(echo $RESP | tr "\n" " " ))
47
48if [ "$RESP1" == "$TEST_IP" ]
49then
50 echo "PASS: A record resolution from DHT via separate peer"
51else
52 echo "FAIL: A record resolution from DHT via separate peer, got $RESP1, expected $TEST_IP"
53 exit 1
54fi
55if [ "$RESP2" == "$TEST_IPV6" ]
56then
57 echo "PASS: AAAA record resolution from DHT via separate peer"
58else
59 echo "FAIL: AAAA record resolution from DHT via separate peer, got $RESP2, expected $TEST_IPV6"
60 exit 1
61fi
62if [[ "${RESPONSES[0]} ${RESPONSES[1]}" == "$TEST_IPV6 $TEST_IP" ]] || [[ "${RESPONSES[0]} ${RESPONSES[1]}" == "$TEST_IP $TEST_IPV6" ]]
63then
64 echo "PASS: ANY record resolution from DHT via separate peer"
65else
66 echo "FAIL: ANY record resolution from DHT via separate peer, got $RESP, expected $TEST_IPV6 $TEST_IP or $TEST_IP $TEST_IPV6"
67 exit 1
68fi