You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2013/07/31 13:50:48 UTC

[2/2] git commit: updated refs/heads/master to cce14f3

Cleanup the marvin logger

It is useful to have the same logger used in the marvinplugin into the
testcase. The testcase can then append its name to the logger making
the logs specify exactly which test is executing when the logs are
generated

Signed-off-by: Prasanna Santhanam <ts...@apache.org>
(cherry picked from commit c84a2d8801b7898dbfee18e17950cb9fca7d36e7)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/476bd93e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/476bd93e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/476bd93e

Branch: refs/heads/master
Commit: 476bd93e43497ad3e81017d81d6c60c21050a814
Parents: 3d9fc3d
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Wed Jul 31 15:18:04 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Wed Jul 31 17:20:35 2013 +0530

----------------------------------------------------------------------
 tools/marvin/marvin/marvinPlugin.py    | 20 ++++----------------
 tools/marvin/marvin/remoteSSHClient.py |  4 ++--
 2 files changed, 6 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/476bd93e/tools/marvin/marvin/marvinPlugin.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/marvinPlugin.py b/tools/marvin/marvin/marvinPlugin.py
index 2949109..f7b0664 100644
--- a/tools/marvin/marvin/marvinPlugin.py
+++ b/tools/marvin/marvin/marvinPlugin.py
@@ -25,11 +25,6 @@ from nose.plugins.base import Plugin
 from functools import partial
 
 
-def testCaseLogger(message, logger=None):
-    if logger is not None:
-        logger.debug(message)
-
-
 class MarvinPlugin(Plugin):
     """
     Custom plugin for the cloudstackTestCases to be run using nose
@@ -69,10 +64,6 @@ class MarvinPlugin(Plugin):
         self.setClient(deploy.testClient)
         self.setConfig(deploy.getCfg())
 
-        cfg = nose.config.Config()
-        cfg.logStream = self.result_stream
-        cfg.debugLog = self.debug_stream
-
         self.testrunner = nose.core.TextTestRunner(stream=self.result_stream,
                                                    descriptions=True,
                                                    verbosity=2, config=config)
@@ -133,21 +124,18 @@ class MarvinPlugin(Plugin):
     def beforeTest(self, test):
         testname = test.__str__().split()[0]
         self.testclient.identifier = '-'.join([self.identifier, testname])
+        self.logger.name = test.__str__()
 
     def _injectClients(self, test):
-        testcaselogger = logging.getLogger("testclient.testcase.%s" %
-                                           test.__name__)
         self.debug_stream. \
             setFormatter(logging.
                          Formatter("%(asctime)s - %(levelname)s - %(name)s" +
                                    " - %(message)s"))
-
-        testcaselogger.addHandler(self.debug_stream)
-        testcaselogger.setLevel(logging.DEBUG)
-
+        setattr(test, "debug", self.logger.debug)
+        setattr(test, "info", self.logger.info)
+        setattr(test, "warn", self.logger.warning)
         setattr(test, "testClient", self.testclient)
         setattr(test, "config", self.config)
-        setattr(test, "debug", partial(testCaseLogger, logger=testcaselogger))
         if self.testclient.identifier is None:
             self.testclient.identifier = self.identifier
         setattr(test, "clstestclient", self.testclient)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/476bd93e/tools/marvin/marvin/remoteSSHClient.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/remoteSSHClient.py b/tools/marvin/marvin/remoteSSHClient.py
index 1dd1ef1..764ba2e 100644
--- a/tools/marvin/marvin/remoteSSHClient.py
+++ b/tools/marvin/marvin/remoteSSHClient.py
@@ -24,7 +24,7 @@ from contextlib import closing
 
 
 class remoteSSHClient(object):
-    def __init__(self, host, port, user, passwd, retries=10, delay=5,
+    def __init__(self, host, port, user, passwd, retries=5, delay=30,
                  log_lvl=logging.INFO, keyPairFileLocation=None):
         self.host = host
         self.port = port
@@ -69,7 +69,7 @@ class remoteSSHClient(object):
                                               + "login to %s on port %s" %
                                               (str(host), port))
             else:
-                return
+                return self.ssh
 
     def execute(self, command):
         stdin, stdout, stderr = self.ssh.exec_command(command)