incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject git commit: Summary: provide deployment config access to marvin's testcase
Date Fri, 19 Oct 2012 05:37:38 GMT
Updated Branches:
  refs/heads/master a3c9a2b22 -> 7460b0189


Summary: provide deployment config access to marvin's testcase

Detail:
Sometimes tests need ssh access to the management server to perform
verification such as:

1. Pings from mgmt_server to agents
2. snapshots exist on secondary storage - mountable from mgmt server

For these the tests will need access to the config of the deployment and
the ip address of the mgmt server.

Egs: integration/component/test_egress.py and integration/component/test_snapshots.py

BUG-ID : CLOUDSTACK-377
Reported-by: Prasanna Santhanam
Signed-off-by: Prasanna Santhanam <tsp@apache.org> 1350624903 +0530


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

Branch: refs/heads/master
Commit: 7460b018935ae224334b44bf3198ce38da2dc105
Parents: a3c9a2b
Author: Prasanna Santhanam <tsp@apache.org>
Authored: Fri Oct 19 11:05:03 2012 +0530
Committer: Prasanna Santhanam <tsp@apache.org>
Committed: Fri Oct 19 11:06:53 2012 +0530

----------------------------------------------------------------------
 tools/marvin/marvin/TestCaseExecuteEngine.py       |    4 ++-
 tools/marvin/marvin/deployAndRun.py                |   17 +++++++++++---
 tools/marvin/marvin/deployDataCenter.py            |    5 ++++
 tools/marvin/marvin/marvinPlugin.py                |    6 +++++
 .../marvin/marvin/sandbox/advanced/advanced_env.py |    2 +
 .../marvin/sandbox/advanced/setup.properties       |    2 +
 tools/marvin/marvin/sandbox/basic/basic_env.py     |    2 +
 tools/marvin/marvin/sandbox/basic/setup.properties |    2 +
 .../marvin/sandbox/demo/simulator/simulator.cfg    |    3 +-
 .../sandbox/demo/simulator/simulator_setup.py      |    2 +
 .../demo/simulator/simulatordemo.properties        |    2 +
 11 files changed, 41 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7460b018/tools/marvin/marvin/TestCaseExecuteEngine.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/TestCaseExecuteEngine.py b/tools/marvin/marvin/TestCaseExecuteEngine.py
index 44a44aa..63e7d0d 100644
--- a/tools/marvin/marvin/TestCaseExecuteEngine.py
+++ b/tools/marvin/marvin/TestCaseExecuteEngine.py
@@ -27,13 +27,14 @@ def testCaseLogger(message, logger=None):
         logger.debug(message)
 
 class TestCaseExecuteEngine(object):
-    def __init__(self, testclient, testcaseLogFile=None, testResultLogFile=None, format="text",
xmlDir="xml-reports"):
+    def __init__(self, testclient, config, testcaseLogFile=None, testResultLogFile=None,
format="text", xmlDir="xml-reports"):
         """
         Initialize the testcase execution engine, just the basics here
         @var testcaseLogFile: client log file
         @var testResultLogFile: summary report file  
         """
         self.testclient = testclient
+        self.config = config
         self.logformat = logging.Formatter("%(asctime)s - %(levelname)s - %(name)s - %(message)s")
         self.loader = unittest.loader.TestLoader()
         self.suite = None
@@ -83,6 +84,7 @@ class TestCaseExecuteEngine(object):
                 
                 #inject testclient and logger into each unittest 
                 setattr(test, "testClient", self.testclient)
+                setattr(test, "config", self.config)
                 setattr(test, "debug", partial(testCaseLogger, logger=testcaselogger))
                 setattr(test.__class__, "clstestclient", self.testclient)
                 if hasattr(test, "UserName"):

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7460b018/tools/marvin/marvin/deployAndRun.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/deployAndRun.py b/tools/marvin/marvin/deployAndRun.py
index 1c82d9f..e7b005c 100644
--- a/tools/marvin/marvin/deployAndRun.py
+++ b/tools/marvin/marvin/deployAndRun.py
@@ -46,21 +46,30 @@ if __name__ == "__main__":
     else:
         deploy.deploy()
         
-    format = "text"
+    fmt = "text"
     xmlDir = None
     if options.xmlrunner is not None:
         xmlDir = options.xmlrunner
-        format = "xml"
+        fmt = "xml"
     
     if options.testCaseFolder is None:
         if options.module is None:
             parser.print_usage()
             exit(1)
         else:
-            engine = TestCaseExecuteEngine.TestCaseExecuteEngine(deploy.testClient, testCaseLogFile,
testResultLogFile, format, xmlDir)
+            engine =  \
+            TestCaseExecuteEngine.TestCaseExecuteEngine(deploy.testClient,
+                                                        deploy.getCfg(),
+                                                        testCaseLogFile,
+                                                        testResultLogFile, fmt,
+                                                        xmlDir)
             engine.loadTestsFromFile(options.module)
             engine.run()
     else:
-       engine = TestCaseExecuteEngine.TestCaseExecuteEngine(deploy.testClient, testCaseLogFile,
testResultLogFile, format, xmlDir)
+       engine = TestCaseExecuteEngine.TestCaseExecuteEngine(deploy.testClient,
+                                                            deploy.getCfg(),
+                                                            testCaseLogFile,
+                                                            testResultLogFile,
+                                                            fmt, xmlDir)
        engine.loadTestsFromDir(options.testCaseFolder)
        engine.run()

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7460b018/tools/marvin/marvin/deployDataCenter.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/deployDataCenter.py b/tools/marvin/marvin/deployDataCenter.py
index 571d5a4..f9d837f 100644
--- a/tools/marvin/marvin/deployDataCenter.py
+++ b/tools/marvin/marvin/deployDataCenter.py
@@ -349,6 +349,11 @@ class deployDataCenters():
         self.config.mgtSvr[0].securityKey = securityKey
         return apiKey, securityKey
 
+    def getCfg(self):
+        if self.config:
+            return self.config
+        return None
+
     def loadCfg(self):
         try:
             self.config = configGenerator.get_setup_config(self.configFile)

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7460b018/tools/marvin/marvin/marvinPlugin.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/marvinPlugin.py b/tools/marvin/marvin/marvinPlugin.py
index 0251e96..c15fa4d 100644
--- a/tools/marvin/marvin/marvinPlugin.py
+++ b/tools/marvin/marvin/marvinPlugin.py
@@ -58,6 +58,7 @@ class MarvinPlugin(Plugin):
         deploy = deployDataCenter.deployDataCenters(options.config) 
         deploy.loadCfg() if options.load else deploy.deploy()
         self.setClient(deploy.testClient)
+        self.setConfig(deploy.getCfg())
         
         cfg = nose.config.Config()
         cfg.logStream = self.result_stream
@@ -104,6 +105,10 @@ class MarvinPlugin(Plugin):
         if client:
             self.testclient = client
 
+    def setConfig(self, config):
+        if config:
+            self.config = config
+
     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"))
@@ -111,6 +116,7 @@ class MarvinPlugin(Plugin):
         testcaselogger.setLevel(logging.DEBUG)
         
         setattr(test, "testClient", self.testclient)
+        setattr(test, "config", self.config)
         setattr(test, "debug", partial(testCaseLogger, logger=testcaselogger))
         setattr(test, "clstestclient", self.testclient)
         if hasattr(test, "UserName"):

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7460b018/tools/marvin/marvin/sandbox/advanced/advanced_env.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/sandbox/advanced/advanced_env.py b/tools/marvin/marvin/sandbox/advanced/advanced_env.py
index 136629f..1873f31 100644
--- a/tools/marvin/marvin/sandbox/advanced/advanced_env.py
+++ b/tools/marvin/marvin/sandbox/advanced/advanced_env.py
@@ -101,6 +101,8 @@ def describeResources(config):
     '''Add mgt server'''
     mgt = managementServer()
     mgt.mgtSvrIp = config.get('environment', 'mshost')
+    mgt.user = config.get('environment', 'mshost.user')
+    mgt.passwd = config.get('environment', 'mshost.passwd')
     zs.mgtSvr.append(mgt)
 
     '''Add a database'''

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7460b018/tools/marvin/marvin/sandbox/advanced/setup.properties
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/sandbox/advanced/setup.properties b/tools/marvin/marvin/sandbox/advanced/setup.properties
index 966d1f9..ba44d51 100644
--- a/tools/marvin/marvin/sandbox/advanced/setup.properties
+++ b/tools/marvin/marvin/sandbox/advanced/setup.properties
@@ -36,6 +36,8 @@ secstorage.allowed.internal.sites=10.147.28.0/24
 [environment]
 dns=10.147.28.6
 mshost=10.147.29.111
+mshost.user=root
+mshost.passwd=password
 mysql.host=10.147.29.111
 mysql.cloud.user=cloud
 mysql.cloud.passwd=cloud

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7460b018/tools/marvin/marvin/sandbox/basic/basic_env.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/sandbox/basic/basic_env.py b/tools/marvin/marvin/sandbox/basic/basic_env.py
index 7c2a0b1..e588fdc 100644
--- a/tools/marvin/marvin/sandbox/basic/basic_env.py
+++ b/tools/marvin/marvin/sandbox/basic/basic_env.py
@@ -102,6 +102,8 @@ def describeResources(config):
     '''Add mgt server'''
     mgt = managementServer()
     mgt.mgtSvrIp = config.get('environment', 'mshost')
+    mgt.user = config.get('environment', 'mshost.user')
+    mgt.passwd = config.get('environment', 'mshost.passwd')
     zs.mgtSvr.append(mgt)
 
     '''Add a database'''

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7460b018/tools/marvin/marvin/sandbox/basic/setup.properties
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/sandbox/basic/setup.properties b/tools/marvin/marvin/sandbox/basic/setup.properties
index e9c0f4d..8833b50 100644
--- a/tools/marvin/marvin/sandbox/basic/setup.properties
+++ b/tools/marvin/marvin/sandbox/basic/setup.properties
@@ -36,6 +36,8 @@ secstorage.allowed.internal.sites=10.147.28.0/24
 [environment]
 dns=10.147.28.6
 mshost=10.147.39.69
+mshost.user=root
+mshost.passwd=password
 mysql.host=10.147.39.69
 mysql.cloud.user=cloud
 mysql.cloud.passwd=cloud

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7460b018/tools/marvin/marvin/sandbox/demo/simulator/simulator.cfg
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/sandbox/demo/simulator/simulator.cfg b/tools/marvin/marvin/sandbox/demo/simulator/simulator.cfg
index 7d250c8..219c4db 100644
--- a/tools/marvin/marvin/sandbox/demo/simulator/simulator.cfg
+++ b/tools/marvin/marvin/sandbox/demo/simulator/simulator.cfg
@@ -16,7 +16,6 @@
 # under the License.
 
 
-
 {
     "zones": [
         {
@@ -193,6 +192,8 @@
     "mgtSvr": [
         {
             "mgtSvrIp": "localhost", 
+            "passwd": "password", 
+            "user": "root", 
             "port": 8096
         }
     ]

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7460b018/tools/marvin/marvin/sandbox/demo/simulator/simulator_setup.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/sandbox/demo/simulator/simulator_setup.py b/tools/marvin/marvin/sandbox/demo/simulator/simulator_setup.py
index 2bd52f1..0d34140 100644
--- a/tools/marvin/marvin/sandbox/demo/simulator/simulator_setup.py
+++ b/tools/marvin/marvin/sandbox/demo/simulator/simulator_setup.py
@@ -103,6 +103,8 @@ def describeResources(config):
     '''Add mgt server'''
     mgt = managementServer()
     mgt.mgtSvrIp = config.get('environment', 'mshost')
+    mgt.user = config.get('environment', 'mshost.user')
+    mgt.passwd = config.get('environment', 'mshost.passwd')
     zs.mgtSvr.append(mgt)
 
     '''Add a database'''

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7460b018/tools/marvin/marvin/sandbox/demo/simulator/simulatordemo.properties
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/sandbox/demo/simulator/simulatordemo.properties b/tools/marvin/marvin/sandbox/demo/simulator/simulatordemo.properties
index aa3deb0..9d9f14b 100644
--- a/tools/marvin/marvin/sandbox/demo/simulator/simulatordemo.properties
+++ b/tools/marvin/marvin/sandbox/demo/simulator/simulatordemo.properties
@@ -37,6 +37,8 @@ secstorage.allowed.internal.sites=10.147.28.0/24
 [environment]
 dns=10.147.28.6
 mshost=localhost
+mshost.user=root
+mshost.passwd=password
 mysql.host=localhost
 mysql.cloud.user=cloud
 mysql.cloud.passwd=cloud


Mime
View raw message