aboutsummaryrefslogtreecommitdiff
path: root/ca/tests
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2014-05-29 19:18:40 +0000
committerRob Austein <sra@hactrn.net>2014-05-29 19:18:40 +0000
commite6047c9f737275d898d88737719dd09a6ee4f25c (patch)
tree2741504894c594473b574146b632d0433a5b7186 /ca/tests
parent839c6b3650472ac6c66fe0dadc87ac419a5a70d4 (diff)
Provide our own logging Formatter class rather than straining to
subclass the stock one. Replace all uses of rpki.log.traceback() with logging package .exception() calls. Use LoggingAdapter for all the whacky per-stream logging code in rpki.http. Fix default logging priority for non-daemon programs like rpkic. svn path=/trunk/; revision=5843
Diffstat (limited to 'ca/tests')
-rw-r--r--ca/tests/smoketest.py14
-rw-r--r--ca/tests/testpoke.py1
-rw-r--r--ca/tests/yamlconf.py3
-rw-r--r--ca/tests/yamltest.py3
4 files changed, 9 insertions, 12 deletions
diff --git a/ca/tests/smoketest.py b/ca/tests/smoketest.py
index 87927a81..1f0215f2 100644
--- a/ca/tests/smoketest.py
+++ b/ca/tests/smoketest.py
@@ -159,7 +159,7 @@ def main():
Main program.
"""
- rpki.log.init(smoketest_name)
+ rpki.log.init(smoketest_name, argparse.Namespace(log_level = logging.DEBUG, log_stream = sys.stdout))
logger.info("Starting")
pubd_process = None
@@ -299,12 +299,9 @@ def main():
logger.info("Event loop exited normally")
except Exception, e:
-
- logger.info("Event loop exited with an exception: %r" % e)
- rpki.log.traceback(logger)
+ logger.exception("Event loop exited with an exception")
finally:
-
logger.info("Cleaning up")
for a in db.engines:
a.kill_daemons()
@@ -631,7 +628,7 @@ class allocation(object):
def done(e):
if isinstance(e, Exception):
- rpki.log.traceback(logger)
+ logger.exception("Exception while rekeying %s", self.name)
raise e
cb()
@@ -648,7 +645,7 @@ class allocation(object):
def done(e):
if isinstance(e, Exception):
- rpki.log.traceback(logger)
+ logger.exception("Exception while revoking %s", self.name)
raise e
cb()
@@ -1295,8 +1292,7 @@ def call_pubd(pdus, cb):
cb(r_msg)
def call_pubd_eb(e):
- logger.warning("Problem calling pubd: %s" % e)
- rpki.log.traceback(logger)
+ logger.exception("Problem calling pubd")
rpki.http.client(
url = q_url,
diff --git a/ca/tests/testpoke.py b/ca/tests/testpoke.py
index bf1e1e43..9ca03dce 100644
--- a/ca/tests/testpoke.py
+++ b/ca/tests/testpoke.py
@@ -130,7 +130,6 @@ def do_revoke():
dispatch = { "list" : do_list, "issue" : do_issue, "revoke" : do_revoke }
def fail(e): # pylint: disable=W0621
- rpki.log.traceback(logger, args.debug)
sys.exit("Testpoke failed: %s" % e)
cms_ta = get_PEM("cms-ca-cert", rpki.x509.X509)
diff --git a/ca/tests/yamlconf.py b/ca/tests/yamlconf.py
index 56bec483..7b737836 100644
--- a/ca/tests/yamlconf.py
+++ b/ca/tests/yamlconf.py
@@ -34,6 +34,7 @@ import os
import sys
import yaml
import time
+import logging
import argparse
import subprocess
import lxml.etree
@@ -672,7 +673,7 @@ def main():
quiet = args.quiet
yaml_file = args.yaml_file
- rpki.log.init("yamlconf")
+ rpki.log.init("yamlconf", argparse.Namespace(log_level = logging.DEBUG, log_stream = sys.stdout))
# Allow optional config file for this tool to override default
# passwords: this is mostly so that I can show a complete working
diff --git a/ca/tests/yamltest.py b/ca/tests/yamltest.py
index f8be9c65..df60ec17 100644
--- a/ca/tests/yamltest.py
+++ b/ca/tests/yamltest.py
@@ -41,6 +41,7 @@ and waits for one of them to exit.
import subprocess
import re
import os
+import logging
import argparse
import sys
import yaml
@@ -665,7 +666,7 @@ try:
if args.pidfile is not None:
open(args.pidfile, "w").write("%s\n" % os.getpid())
- rpki.log.init("yamltest")
+ rpki.log.init("yamltest", argparse.Namespace(log_level = logging.DEBUG, log_stream = sys.stdout))
# Allow optional config file for this tool to override default
# passwords: this is mostly so that I can show a complete working