summaryrefslogtreecommitdiffstats
path: root/test/test_nfvbench.py
diff options
context:
space:
mode:
authorahothan <ahothan@cisco.com>2017-08-22 17:41:16 -0700
committerahothan <ahothan@cisco.com>2017-08-22 17:41:57 -0700
commit2d55474511a5057015e77547c326120c1649c0b7 (patch)
treee5f1db615655d73c9778d0499d7a312e8de2cc3e /test/test_nfvbench.py
parent6c4e55c53c65b7e63c17c85367b4813443c5d942 (diff)
NFVBENCH-6 Add support for sending logs to fluentd with fluentd client library
Change-Id: I1bc01b26f9e43f78c169b5fcd26247debcfe31bf Signed-off-by: ahothan <ahothan@cisco.com>
Diffstat (limited to 'test/test_nfvbench.py')
-rw-r--r--test/test_nfvbench.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test_nfvbench.py b/test/test_nfvbench.py
index a70e71a..ad78a9e 100644
--- a/test/test_nfvbench.py
+++ b/test/test_nfvbench.py
@@ -15,9 +15,12 @@
#
from attrdict import AttrDict
+import logging
from nfvbench.config import get_err_config
from nfvbench.connection import SSH
from nfvbench.credentials import Credentials
+from nfvbench.fluentd import FluentLogHandler
+import nfvbench.log
from nfvbench.network import Interface
from nfvbench.network import Network
from nfvbench.specs import Encaps
@@ -632,6 +635,9 @@ def test_ndr_pdr_search(traffic_client):
# Other tests
# =========================================================================
+def setup_module(module):
+ nfvbench.log.setup(mute_stdout=True)
+
def test_no_credentials():
cred = Credentials('/completely/wrong/path/openrc', None, False)
if cred.rc_auth_url:
@@ -656,3 +662,15 @@ def test_config():
assert(get_err_config({2: 100}, refcfg) == {2: 100})
# both correctly fail and invalid value type
assert(get_err_config({2: 100, 5: 10}, refcfg) == {2: 100, 5: 10})
+
+def test_fluentd():
+ logger = logging.getLogger('fluent-logger')
+ handler = FluentLogHandler('nfvbench', fluentd_port=7081)
+ logger.addHandler(handler)
+ logger.setLevel(logging.INFO)
+ logger.info('test')
+ logger.warning('test %d', 100)
+ try:
+ raise Exception("test")
+ except Exception:
+ logger.exception("got exception")