CLOUDSTACK-6158: Fix few changes

This commit is contained in:
Santhosh Edukulla 2014-02-24 18:55:41 +05:30 committed by Girish Shilamkar
parent 47c5b63881
commit d06f2b6a70
5 changed files with 564 additions and 216 deletions

View File

@ -244,6 +244,7 @@ class CSConnection(object):
cmd_name = ''
payload = {}
required = []
isAsync = "false"
for attribute in dir(cmd):
if not attribute.startswith('__'):
if attribute == "isAsync":
@ -274,7 +275,6 @@ class CSConnection(object):
for k, v in val.iteritems():
payload["%s[%d].%s" % (param, i, k)] = v
i += 1
return cmd_name.strip(), isAsync, payload
except Exception, e:
self.logger.\

View File

@ -99,7 +99,7 @@ class CSTestClient(object):
if self.__parsedTestDataConfig:
ret = self.__parsedTestDataConfig.get("zone")
if ret != "NA":
self.__zone = ret
self.__zone = ret
return self.__zone
def __setHypervisorToClient(self):

File diff suppressed because it is too large Load Diff

View File

@ -143,13 +143,12 @@ class MarvinLog:
else:
temp_path = str(test_module_name) + "__" + str(temp_ts)
temp_dir = "MarvinLogs"
if ((log_cfg is not None) and
('LogFolderPath' in log_cfg.__dict__.keys()) and
(log_cfg.__dict__.get('LogFolderPath') is not None)):
temp_dir = \
log_cfg.__dict__.get('LogFolderPath') + "/MarvinLogs"
else:
temp_dir = "MarvinLogs"
self.__logFolderDir = temp_dir + "//" + temp_path
print "\n*********Log Folder Path: %s. " \

View File

@ -30,6 +30,7 @@ from marvin.cloudstackException import GetDetailExceptionInfo
class MarvinPlugin(Plugin):
"""
Custom plugin for the cloudstackTestCases to be run using nose
"""
@ -53,7 +54,7 @@ class MarvinPlugin(Plugin):
'''
self.__deployDcFlag = None
self.conf = None
self.__debugStream = stdout
self.__resultStream = stdout
self.__testRunner = None
self.__testResult = SUCCESS
self.__startTime = None
@ -128,7 +129,7 @@ class MarvinPlugin(Plugin):
os.system("python " + filename)
return True
return False
except ImportError, e:
except ImportError as e:
print "FileName :%s : Error : %s" % \
(filename, GetDetailExceptionInfo(e))
return False
@ -161,15 +162,28 @@ class MarvinPlugin(Plugin):
str(self.__testName) + " :::::::::::")
self.__startTime = time.time()
def printMsg(self, status, tname, err):
if self.__tcRunLogger:
self.__tcRunLogger.\
fatal("%s: %s: %s" % (status,
tname,
GetDetailExceptionInfo(err)))
write_str = "=== TestName: %s | Status : %s ===\n" % (tname, status)
self.__resultStream.write(write_str)
print write_str
def addSuccess(test):
'''
Adds the Success Messages to logs
'''
printMsg(SUCCESS, self.__testName, "Test Case Passed")
self.__testresult = SUCCESS
def handleError(self, test, err):
'''
Adds Exception throwing test cases and information to log.
'''
if self.__tcRunLogger:
self.__tcRunLogger.\
fatal("%s: %s: %s" % (EXCEPTION,
self.__testName,
GetDetailExceptionInfo(err)))
self.printMsg(EXCEPTION, self.__testName, GetDetailExceptionInfo(err))
self.__testResult = EXCEPTION
def prepareTestRunner(self, runner):
@ -180,10 +194,7 @@ class MarvinPlugin(Plugin):
'''
Adds Failing test cases and information to log.
'''
if self.__tcRunLogger:
self.__tcRunLogger.\
fatal("%s: %s: %s" %
(FAILED, self.__testName, GetDetailExceptionInfo(err)))
self.printMsg(FAILED, self.__testName, GetDetailExceptionInfo(err))
self.__testResult = FAILED
def __getModName(self, inp, type='file'):
@ -202,7 +213,7 @@ class MarvinPlugin(Plugin):
def __runSuite(self, test_suite=None):
try:
if test_suite:
if self.wantFile(test_suite) is True:
if self.wantFile(test_suite):
test_mod_name = self.__getModName(test_suite)
temp_obj = MarvinInit(self.__configFile,
None, test_mod_name,
@ -213,14 +224,14 @@ class MarvinPlugin(Plugin):
self.__testClient = temp_obj.getTestClient()
self.__tcRunLogger = temp_obj.getLogger()
self.__parsedConfig = temp_obj.getParsedConfig()
self.__debugStream = temp_obj.getResultFile()
self.__resultStream = temp_obj.getResultFile()
self.__testRunner = nose.core.\
TextTestRunner(stream=self.__debugStream,
TextTestRunner(stream=self.__resultStream,
descriptions=True,
verbosity=2)
return SUCCESS
return FAILED
except Exception, e:
except Exception as e:
print "\n Exception Occurred when running suite :%s Error : %s" \
% (test_suite, GetDetailExceptionInfo(e))
return FAILED
@ -259,7 +270,7 @@ class MarvinPlugin(Plugin):
if os.path.isfile(suites):
self.__runSuite(suites)
return SUCCESS
except Exception, e:
except Exception as e:
print "Exception Occurred under startMarvin: %s" % \
GetDetailExceptionInfo(e)
return FAILED