Fixed issues related to CLOUDSTACK-5674

Fixed issues mentioned for CLOUDSTACK-5674.
More changes in the bug

Signed-off-by: Santhosh Edukulla <Santhosh.Edukulla@citrix.com>
Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
This commit is contained in:
Santhosh Edukulla 2014-04-02 20:34:09 +05:30 committed by SrikanteswaraRao Talluri
parent 4779e575bb
commit 65e8f2dc53
8 changed files with 82 additions and 55 deletions

View File

@ -65,10 +65,7 @@ class TestNic(cloudstackTestCase):
zone.id,
self.services["ostype"]
)
if self.template == FAILED:
self.fail("get_template() failed to return template with description %s" % self.services["ostype"])
# Set Zones and disk offerings
# Set Zones and disk offerings
self.services["small"]["zoneid"] = zone.id
self.services["small"]["template"] = template.id

View File

@ -34,8 +34,6 @@ _multiprocess_shared_ = True
class TestSSVMs(cloudstackTestCase):
def setUp(self):
self.testClient = super(TestSSVMs, cls).getClsTestClient()
self.apiclient = self.testClient.getApiClient()
self.hypervisor = self.testClient.getHypervisorInfo()
self.cleanup = []

View File

@ -21,9 +21,9 @@ import base64
import hmac
import hashlib
import time
from .cloudstackAPI import *
from . import jsonHelper
from .codes import (
from cloudstackAPI import *
import jsonHelper
from marvin.codes import (
FAILED,
INVALID_RESPONSE,
INVALID_INPUT,
@ -110,8 +110,8 @@ class CSConnection(object):
break
time.sleep(5)
timeout -= 5
self.logger.debug("JobId:%s is Still Processing, "
"Will TimeOut in:%s" % (str(jobid),
self.logger.debug("=== JobId:%s is Still Processing, "
"Will TimeOut in:%s ====" % (str(jobid),
str(timeout)))
end_time = time.time()
tot_time = int(start_time - end_time)
@ -122,9 +122,9 @@ class CSConnection(object):
str(time.ctime(end_time)), str(tot_time)))
return async_response
except Exception as e:
self.__lastError = GetDetailExceptionInfo(e)
self.logger.exception("__poll: Exception Occurred :%s" %
self.__lastError)
self.__lastError = e
self.logger.exception("==== __poll: Exception Occurred :%s ====" %
str(self.__lastError))
return FAILED
def getLastError(self):
@ -353,7 +353,7 @@ class CSConnection(object):
payload=payload,
method=method)
if cmd_response == FAILED:
return FAILED
raise self.__lastError
'''
4. Check if the Command Response received above is valid or Not.

View File

@ -141,16 +141,14 @@ class CSTestClient(object):
list_user = listUsers.listUsersCmd()
list_user.account = "admin"
list_user_res = self.__apiClient.listUsers(list_user)
if list_user_res == FAILED or list_user_res is None or\
if list_user_res is None or\
(validateList(list_user_res)[0] != PASS):
self.__logger.error("__createApiClient: API "
"Client Creation Failed")
return FAILED
user_id = list_user_res[0].id
api_key = list_user_res[0].apikey
security_key = list_user_res[0].secretkey
if api_key is None:
ret = self.__getKeys(user_id)
if ret != FAILED:
@ -162,6 +160,10 @@ class CSTestClient(object):
"Creation Failed while "
"Registering User")
return FAILED
else:
self.__mgmtDetails.port = 8080
self.__mgmtDetails.apiKey = api_key
self.__mgmtDetails.securityKey = security_key
'''
Now Create the Connection objects and Api Client using
new details

View File

@ -295,7 +295,6 @@ test_data = {
"Lb": {"lbSchemes": "internal", "SupportedLbIsolation": "dedicated"}
}
},
"natrule": {
"privateport": 22,
"publicport": 2222,
@ -350,6 +349,12 @@ test_data = {
},
"templatefilter": 'self',
"templates": {
"displaytext": 'Template',
"name": 'Template',
"ostype": "CentOS 5.3 (64-bit)",
"templatefilter": 'self',
},
"security_group" : { "name": "custom_Sec_Grp" },
"ingress_rule": {
"protocol": "TCP",
@ -414,5 +419,19 @@ test_data = {
"displaytext": "vpc-tier2",
"gateway" : "10.2.1.1",
"netmask" : "255.255.255.192"
}
},
"server": {
"displayname": "TestVM",
"username": "root",
"password": "password",
"ssh_port": 22,
"hypervisor": 'XenServer',
"privateport": 22,
"publicport": 22,
"protocol": 'TCP'
},
"privateport": 22,
"publicport": 22,
"protocol": 'TCP',
"forvirtualnetwork": "true"
}

View File

@ -25,6 +25,7 @@ from marvin.codes import (SUCCESS,
FAILED
)
from marvin.cloudstackException import GetDetailExceptionInfo
from marvin.lib.utils import random_gen
class MarvinLog:
@ -140,9 +141,9 @@ class MarvinLog:
temp_ts = time.strftime("%b_%d_%Y_%H_%M_%S",
time.localtime())
if test_module_name is None:
temp_path = temp_ts
temp_path = temp_ts + "_" + random_gen()
else:
temp_path = str(test_module_name) + "__" + str(temp_ts)
temp_path = str(test_module_name) + "__" + str(temp_ts) + "_" + random_gen()
temp_dir = "MarvinLogs"
if ((log_cfg is not None) and

View File

@ -26,6 +26,7 @@ from nose.plugins.base import Plugin
from marvin.codes import (SUCCESS,
FAILED,
EXCEPTION)
from marvin.lib.utils import random_gen
from marvin.cloudstackException import GetDetailExceptionInfo
@ -230,7 +231,8 @@ class MarvinPlugin(Plugin):
self.__testRunner = nose.core.\
TextTestRunner(stream=self.__resultStream,
descriptions=True,
verbosity=2)
verbosity=2,
config=self.conf)
return SUCCESS
return FAILED
except Exception as e:
@ -272,7 +274,13 @@ class MarvinPlugin(Plugin):
test.AcctType)
def finalize(self, result):
src = self.__logFolderPath.strip("//")
dst = os.path.split(src)[0] + "/" + self.__testModName
os.system("mv " + src + " " + dst)
print "===Final Results: %s===" % str(dst)
try:
src = self.__logFolderPath
log_cfg = self.__parsedConfig.logger
tmp = log_cfg.__dict__.get('LogFolderPath') + "/MarvinLogs"
dst = tmp + "/" + self.__testName + "_" + random_gen()
cmd = "mv " + src + " " + dst
os.system(cmd)
print "===Final Results: %s===" % str(dst)
except Exception, e:
print "=== Exception occurred under finalize :%s"%str(GetDetailExceptionInfo(e))

View File

@ -6,9 +6,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@ -30,33 +30,35 @@ except ImportError:
VERSION = '0.1.0'
import os
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read().strip()
setup(name="Marvin",
version=VERSION,
description="Marvin - Python client for Apache CloudStack",
author="Edison Su",
author_email="Edison.Su@citrix.com",
maintainer="Prasanna Santhanam",
maintainer_email="tsp@apache.org",
long_description="Marvin is the Apache CloudStack python client written around the unittest framework",
platforms=("Any",),
url="https://builds.apache.org/job/cloudstack-marvin/",
packages=["marvin", "marvin.cloudstackAPI",
"marvin.lib", "marvin.config","marvin.sandbox",
"marvin.sandbox.advanced", "marvin.sandbox.advancedsg", "marvin.sandbox.basic"],
license="LICENSE.txt",
install_requires=[
"mysql-connector-python",
"requests",
"paramiko",
"nose",
"ddt >= 0.4.0"
],
py_modules=['marvin.marvinPlugin'],
zip_safe=False,
entry_points={
'nose.plugins': ['marvinPlugin = marvin.marvinPlugin:MarvinPlugin']
},
)
version=VERSION,
description="Marvin - Python client for Apache CloudStack",
author="Edison Su",
author_email="Edison.Su@citrix.com",
maintainer="Prasanna Santhanam",
maintainer_email="tsp@apache.org",
long_description="Marvin is the Apache CloudStack python client written around the unittest framework",
platforms=("Any",),
url="https://builds.apache.org/job/cloudstack-marvin/",
packages=["marvin", "marvin.cloudstackAPI",
"marvin.lib", "marvin.config", "marvin.sandbox",
"marvin.sandbox.advanced", "marvin.sandbox.advancedsg", "marvin.sandbox.basic"],
license="LICENSE.txt",
install_requires=[
"mysql-connector-python",
"requests",
"paramiko",
"nose",
"ddt >= 0.4.0"
],
py_modules=['marvin.marvinPlugin'],
zip_safe=False,
entry_points={
'nose.plugins': ['marvinPlugin = marvin.marvinPlugin:MarvinPlugin']
},
)