[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [ascension] 32/57: testing and added logging of executed co
From: |
gnunet |
Subject: |
[GNUnet-SVN] [ascension] 32/57: testing and added logging of executed commands to debug |
Date: |
Sat, 13 Apr 2019 13:32:29 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository ascension.
commit 046fbf4919c81ccc287a9c0cca1488826c68cc74
Author: rexxnor <address@hidden>
AuthorDate: Mon Nov 12 23:40:11 2018 +0100
testing and added logging of executed commands to debug
---
gnsmigrator/gnsmigrator.py | 19 +++++--
gnsmigrator/test/test_gnsmigrator_simple.sh | 81 +++++++++++++++++++++++++++--
2 files changed, 92 insertions(+), 8 deletions(-)
diff --git a/gnsmigrator/gnsmigrator.py b/gnsmigrator/gnsmigrator.py
index 2cef855..853d97d 100644
--- a/gnsmigrator/gnsmigrator.py
+++ b/gnsmigrator/gnsmigrator.py
@@ -43,7 +43,7 @@ class GNSMigrator():
@classmethod
def __init__(cls, domain, transferns, port):
cls.domain = domain
- cls.port = port
+ cls.port = int(port)
cls.soa = None
cls.transferns = transferns
cls.zone = None
@@ -89,10 +89,11 @@ class GNSMigrator():
pkey_line.stdout.close()
# Create identity in GNUnet
try:
- sp.run([GNUNET_ZONE_CREATION_COMMAND,
- '-C', domainpart],
- stdout=sp.DEVNULL,
- stderr=sp.DEVNULL)
+ ret = sp.run([GNUNET_ZONE_CREATION_COMMAND,
+ '-C', domainpart],
+ stdout=sp.DEVNULL,
+ stderr=sp.DEVNULL)
+ logging.info("executed command: %s", " ".join(ret.args))
except sp.CalledProcessError:
logging.info("Zone %s already exists!", domainpart)
pkey_lookup = sp.Popen([GNUNET_ZONE_CREATION_COMMAND,
@@ -122,6 +123,7 @@ class GNSMigrator():
'-t', 'PKEY',
'-V', pkey_zone,
'-e', 'never'])
+ logging.info("executed command: %s", " ".join(ret.args))
if ret.returncode != 0:
logging.warning("failed to add record %s", domainpart)
logging.warning("failed to add %s record %s",
@@ -312,6 +314,7 @@ class GNSMigrator():
'-t', rtype_str,
'-V', str(rdata),
'-e', '%ds' % ttl])
+ logging.info("executed command: %s", " ".join(ret.args))
if ret.returncode != 0:
logging.warning("failed to add %s record %s",
rtype_str, str(dnsname))
@@ -339,6 +342,7 @@ class GNSMigrator():
'-t', rtype_str,
'-V', str(value),
'-e', '%ds' % ttl])
+ logging.info("executed command: %s", " ".join(ret.args))
if ret.returncode != 0:
logging.warning("failed to add %s record %s",
rtype_str, dnsname_str)
@@ -357,6 +361,7 @@ class GNSMigrator():
'-t', rtype_str,
'-V', str(rdata),
'-e', '%ds' % ttl])
+ logging.info("executed command: %s", " ".join(ret.args))
if ret.returncode != 0:
logging.warning("failed to add %s record %s",
rtype_str, str(dnsname))
@@ -366,6 +371,7 @@ class GNSMigrator():
'-t', 'LEHO',
'-V', '%s.%s' % (str(dnsname), domain),
'-e', '%ds' % ttl])
+ logging.info("executed command: %s", " ".join(ret.args))
if ret.returncode != 0:
logging.warning("failed to add %s record %s",
"LEHO", str(dnsname))
@@ -394,6 +400,7 @@ class GNSMigrator():
int(expiry), int(irefresh)
),
'-e', '%ds' % ttl])
+ logging.info("executed command: %s", " ".join(ret.args))
if ret.returncode != 0:
logging.warning("failed to add %s record %s", "SOA", "@")
@@ -431,6 +438,7 @@ class GNSMigrator():
'-t', 'GNS2DNS',
'-u', '%s.%s' % (str(dnsname), zonename)],
stdout=sp.PIPE)
+ logging.info("executed command: %s", " ".join(ret.args))
if 'Got'.encode() not in ret.stdout:
ret = sp.run([GNUNET_NAMESTORE_COMMAND,
'-z', zonename,
@@ -458,6 +466,7 @@ class GNSMigrator():
'-t', dns.rdatatype.to_text(rdata.rdtype),
'-V', value,
'-e', '%ds' % int(ttl)])
+ logging.info("executed command: %s", " ".join(ret.args))
if ret.returncode != 0:
logging.warning("failed to add %s record %s",
"GNS2DNS", str(dnsname))
diff --git a/gnsmigrator/test/test_gnsmigrator_simple.sh
b/gnsmigrator/test/test_gnsmigrator_simple.sh
index 2cb6045..f0e6eb2 100644
--- a/gnsmigrator/test/test_gnsmigrator_simple.sh
+++ b/gnsmigrator/test/test_gnsmigrator_simple.sh
@@ -1,24 +1,99 @@
#!/bin/bash
+# Author: rexxnor
+# Returns 1 on basic error
+# Returns 2 on explicit test case errors
+# Returns 3 on implicit test case errors
+
+# Shutdown named
+function cleanup {
+ pkill named
+ gnunet-identity -D gnunet
+ gnunet-identity -D org
+}
# Check for required packages
+
if ! [ -x "$(command -v named)" ]; then
echo 'bind/named is not installed' >&2
exit 1
fi
+if ! [ -x "$(command -v gnsmigrator)" ]; then
+ echo 'gnsmigrator is not installed' >&2
+ exit 1
+fi
+
# Start named with a simple zone
named -c basic_named.conf -p 5000
# Check if domain resolves
nslookup gnunet.org 127.0.0.1 -port=5000
-if $?; then
+if [ "$?" -ne 0 ]; then
echo "Something went wrong with named"
+ cleanup
exit 1
fi
# Let gnsmigrator run on gnunet.org test domain
+gnsmigrator gnunet.org -ns 127.0.0.1 -p 5000
+if [ "$?" -ne 0 ]; then
+ echo "gnsmigrator failed adding the records!"
+ cleanup
+ exit 1
+fi
+function checkfailexp {
+ if [ "$?" -ne 0 ]; then
+ echo "required record not present"
+ cleanup
+ exit 2
+ fi
+}
+function checkfailimp {
+ if [ "$?" -ne 0 ]; then
+ echo "implied record not present"
+ cleanup
+ exit 3
+ fi
+}
-# Shutdown named
-pkill named
+# TESTING explicit records
+gnunet-gns -t CNAME -u asdf.gnunet
+checkfailexp
+gnunet-gns -t AAAA -u foo.gnunet
+checkfailexp
+gnunet-gns -t A -u mail.gnunet
+checkfailexp
+gnunet-gns -t A -u ns1.gnunet
+checkfailexp
+gnunet-gns -t A -u ns2.gnunet
+checkfailexp
+gnunet-gns -t A -u ns2.gnunet.org
+checkfailexp
+gnunet-gns -t MX -u mail.gnunet
+checkfailexp
+gnunet-gns -t A -u nextcloud.gnunet
+checkfailexp
+gnunet-gns -t SOA -u @.gnunet
+checkfailexp
+
+# TESTING implicit records
+gnunet-gns -t LEHO -u foo.gnunet
+checkfailimp
+gnunet-gns -t LEHO -u mail.gnunet
+checkfailimp
+gnunet-gns -t LEHO -u nextcloud.gnunet
+checkfailimp
+gnunet-gns -t LEHO -u owncloud.gnunet
+checkfailimp
+gnunet-gns -t LEHO -u ns1.gnunet
+checkfailimp
+gnunet-gns -t LEHO -u ns2.gnunet
+checkfailimp
+
+# cleanup if we get this far
+cleanup
+
+# finish
+echo "All records added successfully!!"
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [ascension] 54/57: lint manpage, (continued)
- [GNUnet-SVN] [ascension] 54/57: lint manpage, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 39/57: added daemonization, bumped version, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 57/57: ascension.1: remove texinfo syntax, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 49/57: minor cleanup, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 51/57: removed daemonization, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 26/57: added definitive support for IXFR, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 37/57: updated README, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 22/57: finished refactoring, fixed a few bugs, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 30/57: updated gnsmigrator and removed c rebuilds, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 44/57: updated README, cleanup, PEP8, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 32/57: testing and added logging of executed commands to debug,
gnunet <=
- [GNUnet-SVN] [ascension] 28/57: refactored code, added debug mode, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 35/57: unify all records under label, added SUPPORTED_RECORDS global, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 40/57: improvements, better case separation, more logging, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 50/57: flags adjustment and soa record is now public by default, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 33/57: added needed return statement; add glue records first, then NS, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 25/57: fixed bugs, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 38/57: renamed project to ascension, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 31/57: added testing for gnunet -K option and more, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 52/57: changed argument -ns to -n, removed gnunet.py, gnunet, 2019/04/13
- [GNUnet-SVN] [ascension] 46/57: added license headers, GNU coding style guidelines, gnunet, 2019/04/13