mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-6758: [Marvin] Detect failed job and throw exception
Signed-off-by: Abhinandan Prateek <aprateek@apache.org>
This commit is contained in:
parent
8b39e2ff71
commit
a0ad836fd2
@ -18,6 +18,7 @@
|
|||||||
"""
|
"""
|
||||||
#Import Local Modules
|
#Import Local Modules
|
||||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||||
|
#from marvin.cloudstackAPI import *
|
||||||
from marvin.lib.utils import (random_gen,
|
from marvin.lib.utils import (random_gen,
|
||||||
cleanup_resources)
|
cleanup_resources)
|
||||||
from marvin.lib.base import (Domain,
|
from marvin.lib.base import (Domain,
|
||||||
@ -40,7 +41,7 @@ from marvin.lib.common import (get_domain,
|
|||||||
get_builtin_template_info,
|
get_builtin_template_info,
|
||||||
wait_for_cleanup)
|
wait_for_cleanup)
|
||||||
from nose.plugins.attrib import attr
|
from nose.plugins.attrib import attr
|
||||||
from marvin.codes import ERROR_CODE_530
|
from marvin.cloudstackException import CloudstackAPIException
|
||||||
import time
|
import time
|
||||||
|
|
||||||
class Services:
|
class Services:
|
||||||
@ -1672,18 +1673,16 @@ class TestDomainForceRemove(cloudstackTestCase):
|
|||||||
" to cleanup any remaining resouces")
|
" to cleanup any remaining resouces")
|
||||||
# Sleep 3*account.gc to ensure that all resources are deleted
|
# Sleep 3*account.gc to ensure that all resources are deleted
|
||||||
wait_for_cleanup(self.apiclient, ["account.cleanup.interval"]*3)
|
wait_for_cleanup(self.apiclient, ["account.cleanup.interval"]*3)
|
||||||
response = Domain.list(
|
with self.assertRaises(CloudstackAPIException):
|
||||||
|
Domain.list(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
id=domain.id,
|
id=domain.id,
|
||||||
listall=True
|
listall=True
|
||||||
)
|
)
|
||||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
|
||||||
have failed with error code %s, instead got response \
|
|
||||||
%s" % (ERROR_CODE_530, str(response)))
|
|
||||||
|
|
||||||
self.debug("Checking if the resources in domain are deleted")
|
self.debug("Checking if the resources in domain are deleted")
|
||||||
with self.assertRaises(Exception):
|
with self.assertRaises(CloudstackAPIException):
|
||||||
response = Account.list(
|
Account.list(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
name=self.account_1.name,
|
name=self.account_1.name,
|
||||||
domainid=self.account_1.domainid,
|
domainid=self.account_1.domainid,
|
||||||
@ -1833,8 +1832,6 @@ class TestDomainForceRemove(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.debug("Deleting domain without force option")
|
self.debug("Deleting domain without force option")
|
||||||
response = domain.delete(self.apiclient, cleanup=False)
|
with self.assertRaises(Exception):
|
||||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
domain.delete(self.apiclient, cleanup=False)
|
||||||
have failed with error code %s, instead got response \
|
|
||||||
%s" % (ERROR_CODE_530, str(response)))
|
|
||||||
return
|
return
|
||||||
|
|||||||
@ -58,7 +58,7 @@ from marvin.cloudstackAPI import (addNicToVirtualMachine,
|
|||||||
removeNicFromVirtualMachine,
|
removeNicFromVirtualMachine,
|
||||||
updateDefaultNicForVirtualMachine)
|
updateDefaultNicForVirtualMachine)
|
||||||
|
|
||||||
from marvin.codes import PASS, ERROR_CODE_530
|
from marvin.codes import PASS
|
||||||
import random
|
import random
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@ -466,10 +466,8 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
|
|||||||
self.cleanup.append(vpc)
|
self.cleanup.append(vpc)
|
||||||
self.cleanup.append(vpc_off)
|
self.cleanup.append(vpc_off)
|
||||||
self.debug("Trying to add VPC to vm belonging to isolated network, this should fail")
|
self.debug("Trying to add VPC to vm belonging to isolated network, this should fail")
|
||||||
response = self.virtual_machine.add_nic(self.apiclient, vpc.id)
|
with self.assertRaises(Exception):
|
||||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
self.virtual_machine.add_nic(self.apiclient, vpc.id)
|
||||||
have failed with error code %s, instead got response \
|
|
||||||
%s" % (ERROR_CODE_530, str(response)))
|
|
||||||
self.debug("Starting virtual machine")
|
self.debug("Starting virtual machine")
|
||||||
self.virtual_machine.start(self.apiclient)
|
self.virtual_machine.start(self.apiclient)
|
||||||
self.debug("Disabling vpc offering: %s" % vpc_off.id)
|
self.debug("Disabling vpc offering: %s" % vpc_off.id)
|
||||||
@ -827,10 +825,9 @@ class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase):
|
|||||||
self.assertEqual(len(vm_list[0].nic), 1, "There should only be default nic present in the vm")
|
self.assertEqual(len(vm_list[0].nic), 1, "There should only be default nic present in the vm")
|
||||||
self.debug("Trying to remove the default nic of vm : %s, this should fail" %
|
self.debug("Trying to remove the default nic of vm : %s, this should fail" %
|
||||||
self.virtual_machine.id)
|
self.virtual_machine.id)
|
||||||
response = self.virtual_machine.remove_nic(self.apiclient, vm_list[0].nic[0].id)
|
with self.assertRaises(Exception):
|
||||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
self.virtual_machine.remove_nic(self.apiclient, vm_list[0].nic[0].id)
|
||||||
have failed with error code %s, instead got response \
|
self.debug("Removing default nic of vm failed")
|
||||||
%s" % (ERROR_CODE_530, str(response)))
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advanced"])
|
@attr(tags = ["advanced"])
|
||||||
|
|||||||
@ -29,7 +29,6 @@ from marvin.lib.common import (get_zone,
|
|||||||
get_template,
|
get_template,
|
||||||
list_virtual_machines,
|
list_virtual_machines,
|
||||||
wait_for_cleanup)
|
wait_for_cleanup)
|
||||||
from marvin.codes import ERROR_CODE_530
|
|
||||||
from nose.plugins.attrib import attr
|
from nose.plugins.attrib import attr
|
||||||
|
|
||||||
class Services:
|
class Services:
|
||||||
@ -1087,10 +1086,9 @@ class TestUpdateVMAffinityGroups(cloudstackTestCase):
|
|||||||
vm1, hostid1 = self.create_vm_in_aff_grps([self.aff_grp[0].name], account_name=self.account.name, domain_id=self.domain.id)
|
vm1, hostid1 = self.create_vm_in_aff_grps([self.aff_grp[0].name], account_name=self.account.name, domain_id=self.domain.id)
|
||||||
|
|
||||||
aff_grps = [self.aff_grp[0], self.aff_grp[1]]
|
aff_grps = [self.aff_grp[0], self.aff_grp[1]]
|
||||||
response = vm1.update_affinity_group(self.api_client, affinitygroupnames=[])
|
with self.assertRaises(Exception):
|
||||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
vm1.update_affinity_group(self.api_client, affinitygroupnames=[])
|
||||||
have failed with error code %s, instead got response \
|
|
||||||
%s" % (ERROR_CODE_530, str(response)))
|
|
||||||
vm1.delete(self.api_client)
|
vm1.delete(self.api_client)
|
||||||
#Wait for expunge interval to cleanup VM
|
#Wait for expunge interval to cleanup VM
|
||||||
wait_for_cleanup(self.apiclient, ["expunge.delay", "expunge.interval"])
|
wait_for_cleanup(self.apiclient, ["expunge.delay", "expunge.interval"])
|
||||||
|
|||||||
@ -38,7 +38,6 @@ from marvin.lib.common import (get_domain,
|
|||||||
list_snapshots,
|
list_snapshots,
|
||||||
list_virtual_machines)
|
list_virtual_machines)
|
||||||
from marvin.lib.utils import cleanup_resources
|
from marvin.lib.utils import cleanup_resources
|
||||||
from marvin.codes import ERROR_CODE_530
|
|
||||||
|
|
||||||
def log_test_exceptions(func):
|
def log_test_exceptions(func):
|
||||||
def test_wrap_exception_log(self, *args, **kwargs):
|
def test_wrap_exception_log(self, *args, **kwargs):
|
||||||
@ -370,14 +369,7 @@ class TestVMOwnership(cloudstackTestCase):
|
|||||||
# 1. deploy VM in sub subdomain1
|
# 1. deploy VM in sub subdomain1
|
||||||
# 3. assignVirtualMachine to subdomain2
|
# 3. assignVirtualMachine to subdomain2
|
||||||
self.create_vm(self.sdomain_account_user1['account'], self.sdomain_account_user1['domain'],isRunning=True)
|
self.create_vm(self.sdomain_account_user1['account'], self.sdomain_account_user1['domain'],isRunning=True)
|
||||||
response = self.virtual_machine.assign_virtual_machine(
|
self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, self.apiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id)
|
||||||
self.apiclient,
|
|
||||||
self.sdomain_account_user2['account'].name,
|
|
||||||
self.sdomain_account_user2['domain'].id)
|
|
||||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
|
||||||
have failed with error code %s, instead got response \
|
|
||||||
%s" % (ERROR_CODE_530, str(response)))
|
|
||||||
return
|
|
||||||
|
|
||||||
@attr(tags = ["advanced"])
|
@attr(tags = ["advanced"])
|
||||||
@log_test_exceptions
|
@log_test_exceptions
|
||||||
@ -388,14 +380,7 @@ class TestVMOwnership(cloudstackTestCase):
|
|||||||
# 1. deploy VM in sub subdomain1 with PF rule set.
|
# 1. deploy VM in sub subdomain1 with PF rule set.
|
||||||
# 3. assignVirtualMachine to subdomain2
|
# 3. assignVirtualMachine to subdomain2
|
||||||
self.create_vm(self.sdomain_account_user1['account'], self.sdomain_account_user1['domain'],pfrule=True)
|
self.create_vm(self.sdomain_account_user1['account'], self.sdomain_account_user1['domain'],pfrule=True)
|
||||||
response = self.virtual_machine.assign_virtual_machine(
|
self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, self.apiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id)
|
||||||
self.apiclient,
|
|
||||||
self.sdomain_account_user2['account'].name,
|
|
||||||
self.sdomain_account_user2['domain'].id)
|
|
||||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
|
||||||
have failed with error code %s, instead got response \
|
|
||||||
%s" % (ERROR_CODE_530, str(response)))
|
|
||||||
return
|
|
||||||
|
|
||||||
@attr(tags = ["advanced"])
|
@attr(tags = ["advanced"])
|
||||||
@log_test_exceptions
|
@log_test_exceptions
|
||||||
|
|||||||
@ -38,7 +38,7 @@ from marvin.lib.common import (get_zone,
|
|||||||
createNetworkRulesForVM,
|
createNetworkRulesForVM,
|
||||||
verifyNetworkState)
|
verifyNetworkState)
|
||||||
from marvin.codes import (PASS, FAIL, FAILED, UNKNOWN, FAULT, MASTER,
|
from marvin.codes import (PASS, FAIL, FAILED, UNKNOWN, FAULT, MASTER,
|
||||||
NAT_RULE, STATIC_NAT_RULE, ERROR_CODE_530)
|
NAT_RULE, STATIC_NAT_RULE)
|
||||||
import netaddr
|
import netaddr
|
||||||
|
|
||||||
import random
|
import random
|
||||||
@ -270,10 +270,8 @@ class TestIpReservation(cloudstackTestCase):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail("VM creation failed: %s" % e)
|
self.fail("VM creation failed: %s" % e)
|
||||||
|
|
||||||
response = isolated_network.update(self.apiclient, guestvmcidr=guest_vm_cidr)
|
with self.assertRaises(Exception):
|
||||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
isolated_network.update(self.apiclient, guestvmcidr=guest_vm_cidr)
|
||||||
have failed with error code %s, instead got response \
|
|
||||||
%s" % (ERROR_CODE_530, str(response)))
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags=["advanced"])
|
@attr(tags=["advanced"])
|
||||||
@ -302,10 +300,8 @@ class TestIpReservation(cloudstackTestCase):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail("VM creation failed: %s" % e)
|
self.fail("VM creation failed: %s" % e)
|
||||||
|
|
||||||
response = isolated_network.update(self.apiclient, guestvmcidr=guest_vm_cidr)
|
with self.assertRaises(Exception):
|
||||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
isolated_network.update(self.apiclient, guestvmcidr=guest_vm_cidr)
|
||||||
have failed with error code %s, instead got response \
|
|
||||||
%s" % (ERROR_CODE_530, str(response)))
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@data(NAT_RULE, STATIC_NAT_RULE)
|
@data(NAT_RULE, STATIC_NAT_RULE)
|
||||||
@ -1083,10 +1079,8 @@ class TestFailureScnarios(cloudstackTestCase):
|
|||||||
else:
|
else:
|
||||||
isolated_network = resultSet[1]
|
isolated_network = resultSet[1]
|
||||||
|
|
||||||
response = isolated_network.update(self.apiclient, guestvmcidr="10.1.1.0/26")
|
with self.assertRaises(Exception):
|
||||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
response = isolated_network.update(self.apiclient, guestvmcidr="10.1.1.0/26")
|
||||||
have failed with error code %s, instead got response \
|
|
||||||
%s" % (ERROR_CODE_530, str(response)))
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags=["advanced", "selfservice"])
|
@attr(tags=["advanced", "selfservice"])
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
#Import local modules
|
#Import local modules
|
||||||
|
|
||||||
|
|
||||||
from marvin.cloudstackTestCase import (cloudstackTestCase)
|
from marvin.cloudstackTestCase import (cloudstackTestCase,unittest)
|
||||||
from marvin.lib.base import (Account,
|
from marvin.lib.base import (Account,
|
||||||
ServiceOffering,
|
ServiceOffering,
|
||||||
PhysicalNetwork,
|
PhysicalNetwork,
|
||||||
@ -40,7 +40,6 @@ from marvin.lib.common import (get_zone,
|
|||||||
setNonContiguousVlanIds)
|
setNonContiguousVlanIds)
|
||||||
from marvin.lib.utils import (cleanup_resources,
|
from marvin.lib.utils import (cleanup_resources,
|
||||||
xsplit)
|
xsplit)
|
||||||
from marvin.codes import ERROR_CODE_530
|
|
||||||
|
|
||||||
from nose.plugins.attrib import attr
|
from nose.plugins.attrib import attr
|
||||||
|
|
||||||
@ -318,11 +317,12 @@ class TestNonContiguousVLANRanges(cloudstackTestCase):
|
|||||||
self.debug("Deployed instance in account: %s" % account.name)
|
self.debug("Deployed instance in account: %s" % account.name)
|
||||||
self.debug("Trying to remove vlan range : %s , This should fail" % self.vlan["partial_range"][0])
|
self.debug("Trying to remove vlan range : %s , This should fail" % self.vlan["partial_range"][0])
|
||||||
|
|
||||||
response = self.physicalnetwork.update(self.apiClient, id = self.physicalnetworkid, vlan = self.vlan["partial_range"][0])
|
with self.assertRaises(Exception) as e:
|
||||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
self.physicalnetwork.update(self.apiClient, id = self.physicalnetworkid, vlan = self.vlan["partial_range"][0])
|
||||||
have failed with error code %s, instead got response \
|
|
||||||
%s" % (ERROR_CODE_530, str(response)))
|
self.debug("operation failed with exception: %s" % e.exception)
|
||||||
account.delete(self.apiclient)
|
account.delete(self.apiclient)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail("Exception in test case: %s" % e)
|
self.fail("Exception in test case: %s" % e)
|
||||||
|
|
||||||
|
|||||||
@ -17,13 +17,15 @@
|
|||||||
""" P1 tests for Project
|
""" P1 tests for Project
|
||||||
"""
|
"""
|
||||||
#Import Local Modules
|
#Import Local Modules
|
||||||
|
import marvin
|
||||||
from nose.plugins.attrib import attr
|
from nose.plugins.attrib import attr
|
||||||
from marvin.cloudstackTestCase import *
|
from marvin.cloudstackTestCase import *
|
||||||
from marvin.cloudstackAPI import *
|
from marvin.cloudstackAPI import *
|
||||||
from marvin.lib.utils import *
|
from marvin.lib.utils import *
|
||||||
from marvin.lib.base import *
|
from marvin.lib.base import *
|
||||||
from marvin.lib.common import *
|
from marvin.lib.common import *
|
||||||
from marvin.codes import ERROR_CODE_530
|
from marvin.sshClient import SshClient
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
|
||||||
class Services:
|
class Services:
|
||||||
@ -428,14 +430,13 @@ class TestCrossDomainAccountAdd(cloudstackTestCase):
|
|||||||
self.user.domainid,
|
self.user.domainid,
|
||||||
project.id
|
project.id
|
||||||
))
|
))
|
||||||
# Add user to the project from different domain
|
with self.assertRaises(Exception):
|
||||||
response = project.addAccount(
|
# Add user to the project from different domain
|
||||||
|
project.addAccount(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
self.user.name
|
self.user.name
|
||||||
)
|
)
|
||||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
self.debug("User add to project failed!")
|
||||||
have failed with error code %s, instead got response \
|
|
||||||
%s" % (ERROR_CODE_530, str(response)))
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@ -541,10 +542,10 @@ class TestDeleteAccountWithProject(cloudstackTestCase):
|
|||||||
"Check project name from list response"
|
"Check project name from list response"
|
||||||
)
|
)
|
||||||
# Deleting account who is owner of the project
|
# Deleting account who is owner of the project
|
||||||
response = self.account.delete(self.apiclient)
|
with self.assertRaises(Exception):
|
||||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
self.account.delete(self.apiclient)
|
||||||
have failed with error code %s, instead got response \
|
self.debug("Deleting account %s failed!" %
|
||||||
%s" % (ERROR_CODE_530, str(response)))
|
self.account.name)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,6 @@ from marvin.lib.common import (get_domain,
|
|||||||
get_zone,
|
get_zone,
|
||||||
get_template,
|
get_template,
|
||||||
get_pod)
|
get_pod)
|
||||||
from marvin.codes import ERROR_CODE_530
|
|
||||||
#Import System modules
|
#Import System modules
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@ -342,17 +341,16 @@ class TestAttachVolume(cloudstackTestCase):
|
|||||||
True,
|
True,
|
||||||
"Check list volumes response for valid list"
|
"Check list volumes response for valid list"
|
||||||
)
|
)
|
||||||
self.debug("Trying to Attach volume: %s to VM: %s" % (
|
# Attach volume to VM
|
||||||
|
with self.assertRaises(Exception):
|
||||||
|
self.debug("Trying to Attach volume: %s to VM: %s" % (
|
||||||
volume.id,
|
volume.id,
|
||||||
self.virtual_machine.id
|
self.virtual_machine.id
|
||||||
))
|
))
|
||||||
response = self.virtual_machine.attach_volume(
|
self.virtual_machine.attach_volume(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
volume
|
volume
|
||||||
)
|
)
|
||||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
|
||||||
have failed with error code %s, instead got response \
|
|
||||||
%s" % (ERROR_CODE_530, str(response)))
|
|
||||||
return
|
return
|
||||||
|
|
||||||
class TestAttachDetachVolume(cloudstackTestCase):
|
class TestAttachDetachVolume(cloudstackTestCase):
|
||||||
|
|||||||
@ -25,7 +25,6 @@ from marvin.cloudstackAPI import *
|
|||||||
from marvin.lib.utils import *
|
from marvin.lib.utils import *
|
||||||
from marvin.lib.base import *
|
from marvin.lib.base import *
|
||||||
from marvin.lib.common import *
|
from marvin.lib.common import *
|
||||||
from marvin.codes import ERROR_CODE_530
|
|
||||||
|
|
||||||
|
|
||||||
class Services:
|
class Services:
|
||||||
@ -700,10 +699,8 @@ class TestVPC(cloudstackTestCase):
|
|||||||
self.debug("Created network with ID: %s" % network_2.id)
|
self.debug("Created network with ID: %s" % network_2.id)
|
||||||
|
|
||||||
self.debug("Deleting the VPC with no network")
|
self.debug("Deleting the VPC with no network")
|
||||||
response = vpc.delete(self.apiclient)
|
with self.assertRaises(Exception):
|
||||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
vpc.delete(self.apiclient)
|
||||||
have failed with error code %s, instead got response \
|
|
||||||
%s" % (ERROR_CODE_530, str(response)))
|
|
||||||
self.debug("Delete VPC failed as there are still networks in VPC")
|
self.debug("Delete VPC failed as there are still networks in VPC")
|
||||||
self.debug("Deleting the networks in the VPC")
|
self.debug("Deleting the networks in the VPC")
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,7 @@ from marvin.lib.common import (get_zone,
|
|||||||
# For more info on ddt refer to http://ddt.readthedocs.org/en/latest/api.html#module-ddt
|
# For more info on ddt refer to http://ddt.readthedocs.org/en/latest/api.html#module-ddt
|
||||||
from ddt import ddt, data
|
from ddt import ddt, data
|
||||||
import time
|
import time
|
||||||
from marvin.codes import PASS, ERROR_CODE_530
|
from marvin.codes import PASS
|
||||||
|
|
||||||
class Services:
|
class Services:
|
||||||
"""Test VPC network services
|
"""Test VPC network services
|
||||||
@ -2107,14 +2107,12 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
|
|||||||
self.fail("Failed to stop VMs, %s" % e)
|
self.fail("Failed to stop VMs, %s" % e)
|
||||||
|
|
||||||
self.debug("Upgrading network offering to support PF services")
|
self.debug("Upgrading network offering to support PF services")
|
||||||
response = network_1.update(
|
with self.assertRaises(Exception):
|
||||||
|
network_1.update(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
networkofferingid=nw_off_vr.id,
|
networkofferingid=nw_off_vr.id,
|
||||||
changecidr=True
|
changecidr=True
|
||||||
)
|
)
|
||||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
|
||||||
have failed with error code %s, instead got response \
|
|
||||||
%s" % (ERROR_CODE_530, str(response)))
|
|
||||||
return
|
return
|
||||||
|
|
||||||
class TestVPCNetworkGc(cloudstackTestCase):
|
class TestVPCNetworkGc(cloudstackTestCase):
|
||||||
|
|||||||
@ -39,7 +39,6 @@ from marvin.lib.common import (get_domain,
|
|||||||
get_template,
|
get_template,
|
||||||
list_routers)
|
list_routers)
|
||||||
from marvin.lib.utils import cleanup_resources
|
from marvin.lib.utils import cleanup_resources
|
||||||
from marvin.codes import ERROR_CODE_530
|
|
||||||
import socket
|
import socket
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@ -641,10 +640,8 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
|
|||||||
lb_rule = self.create_LB_Rule(public_ip_1, network_1, [vm_1, vm_2], self.services["lbrule_http"])
|
lb_rule = self.create_LB_Rule(public_ip_1, network_1, [vm_1, vm_2], self.services["lbrule_http"])
|
||||||
# In a VPC, the load balancing service is supported only on a single tier.
|
# In a VPC, the load balancing service is supported only on a single tier.
|
||||||
# http://cloudstack.apache.org/docs/en-US/Apache_CloudStack/4.0.2/html/Installation_Guide/configure-vpc.html
|
# http://cloudstack.apache.org/docs/en-US/Apache_CloudStack/4.0.2/html/Installation_Guide/configure-vpc.html
|
||||||
response = lb_rule.assign(self.apiclient, [vm_3])
|
with self.assertRaises(Exception):
|
||||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
lb_rule.assign(self.apiclient, [vm_3])
|
||||||
have failed with error code %s, instead got response \
|
|
||||||
%s" % (ERROR_CODE_530, str(response)))
|
|
||||||
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
|
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
"""
|
"""
|
||||||
#Import Local Modules
|
#Import Local Modules
|
||||||
from nose.plugins.attrib import attr
|
from nose.plugins.attrib import attr
|
||||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||||
from marvin.lib.base import (VirtualMachine,
|
from marvin.lib.base import (VirtualMachine,
|
||||||
NetworkOffering,
|
NetworkOffering,
|
||||||
VpcOffering,
|
VpcOffering,
|
||||||
@ -43,7 +43,6 @@ from marvin.lib.common import (get_domain,
|
|||||||
get_free_vlan)
|
get_free_vlan)
|
||||||
|
|
||||||
from marvin.lib.utils import cleanup_resources
|
from marvin.lib.utils import cleanup_resources
|
||||||
from marvin.codes import ERROR_CODE_530
|
|
||||||
from marvin.cloudstackAPI import rebootRouter
|
from marvin.cloudstackAPI import rebootRouter
|
||||||
|
|
||||||
|
|
||||||
@ -1623,10 +1622,8 @@ class TestVMDeployVPC(cloudstackTestCase):
|
|||||||
"Vm state should be running for each VM deployed"
|
"Vm state should be running for each VM deployed"
|
||||||
)
|
)
|
||||||
self.debug("Trying to delete network: %s" % network_1.name)
|
self.debug("Trying to delete network: %s" % network_1.name)
|
||||||
response = network_1.delete(self.apiclient)
|
with self.assertRaises(Exception):
|
||||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
network_1.delete(self.apiclient)
|
||||||
have failed with error code %s, instead got response \
|
|
||||||
%s" % (ERROR_CODE_530, str(response)))
|
|
||||||
self.debug("Delete netwpork failed as there are running instances")
|
self.debug("Delete netwpork failed as there are running instances")
|
||||||
|
|
||||||
self.debug("Destroying all the instances in network1: %s" %
|
self.debug("Destroying all the instances in network1: %s" %
|
||||||
@ -2164,10 +2161,8 @@ class TestVMDeployVPC(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.debug("Trying to delete network: %s" % network_1.name)
|
self.debug("Trying to delete network: %s" % network_1.name)
|
||||||
response = network_1.delete(self.apiclient)
|
with self.assertRaises(Exception):
|
||||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
network_1.delete(self.apiclient)
|
||||||
have failed with error code %s, instead got response \
|
|
||||||
%s" % (ERROR_CODE_530, str(response)))
|
|
||||||
self.debug("Delete network failed as there are running instances")
|
self.debug("Delete network failed as there are running instances")
|
||||||
|
|
||||||
self.debug("Destroying all the instances in network1: %s" %
|
self.debug("Destroying all the instances in network1: %s" %
|
||||||
|
|||||||
@ -27,7 +27,6 @@ from marvin.lib.utils import *
|
|||||||
from marvin.lib.base import *
|
from marvin.lib.base import *
|
||||||
from marvin.lib.common import *
|
from marvin.lib.common import *
|
||||||
from nose.plugins.attrib import attr
|
from nose.plugins.attrib import attr
|
||||||
from marvin.codes import ERROR_CODE_530
|
|
||||||
#Import System modules
|
#Import System modules
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@ -390,14 +389,12 @@ class TestPortForwarding(cloudstackTestCase):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
nat_rule.delete(self.apiclient)
|
nat_rule.delete(self.apiclient)
|
||||||
|
list_nat_rule_response = list_nat_rules(
|
||||||
|
self.apiclient,
|
||||||
|
id=nat_rule.id
|
||||||
|
)
|
||||||
except CloudstackAPIException:
|
except CloudstackAPIException:
|
||||||
self.fail("Nat Rule deletion failed: %s" % e)
|
self.fail("Nat Rule Deletion or Listing Failed")
|
||||||
|
|
||||||
response = list_nat_rules(self.apiclient,
|
|
||||||
id=nat_rule.id)
|
|
||||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
|
||||||
have failed with error code %s, instead got response \
|
|
||||||
%s" % (ERROR_CODE_530, str(response)))
|
|
||||||
|
|
||||||
# Check if the Public SSH port is inaccessible
|
# Check if the Public SSH port is inaccessible
|
||||||
with self.assertRaises(Exception):
|
with self.assertRaises(Exception):
|
||||||
|
|||||||
@ -15,17 +15,14 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
""" NIC tests for VM """
|
""" NIC tests for VM """
|
||||||
from marvin.codes import ERROR_CODE_530
|
import marvin
|
||||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
from marvin.codes import FAILED
|
||||||
from marvin.lib.base import(Account,
|
from marvin.cloudstackTestCase import *
|
||||||
ServiceOffering,
|
from marvin.cloudstackAPI import *
|
||||||
Network,
|
from marvin.sshClient import SshClient
|
||||||
VirtualMachine,
|
from marvin.lib.utils import *
|
||||||
NetworkOffering)
|
from marvin.lib.base import *
|
||||||
from marvin.lib.common import (get_zone,
|
from marvin.lib.common import *
|
||||||
get_domain,
|
|
||||||
get_template,
|
|
||||||
list_virtual_machines)
|
|
||||||
from nose.plugins.attrib import attr
|
from nose.plugins.attrib import attr
|
||||||
|
|
||||||
import signal
|
import signal
|
||||||
@ -189,7 +186,7 @@ class TestNic(cloudstackTestCase):
|
|||||||
existing_nic_id = vm_response.nic[0].id
|
existing_nic_id = vm_response.nic[0].id
|
||||||
|
|
||||||
# 1. add a nic
|
# 1. add a nic
|
||||||
self.virtual_machine.add_nic(self.apiclient, self.test_network2.id)
|
add_response = self.virtual_machine.add_nic(self.apiclient, self.test_network2.id)
|
||||||
|
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
# now go get the vm list?
|
# now go get the vm list?
|
||||||
@ -234,11 +231,13 @@ class TestNic(cloudstackTestCase):
|
|||||||
"Verify second adapter is set to default"
|
"Verify second adapter is set to default"
|
||||||
)
|
)
|
||||||
|
|
||||||
response = self.virtual_machine.remove_nic(self.apiclient, new_nic_id)
|
sawException = False
|
||||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
try:
|
||||||
have failed with error code %s, instead got response \
|
self.virtual_machine.remove_nic(self.apiclient, new_nic_id)
|
||||||
%s" % (ERROR_CODE_530, str(response)))
|
except Exception as ex:
|
||||||
|
sawException = True
|
||||||
|
|
||||||
|
self.assertEqual(sawException, True, "Make sure we cannot delete the default NIC")
|
||||||
self.virtual_machine.update_default_nic(self.apiclient, existing_nic_id)
|
self.virtual_machine.update_default_nic(self.apiclient, existing_nic_id)
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
self.virtual_machine.remove_nic(self.apiclient, new_nic_id)
|
self.virtual_machine.remove_nic(self.apiclient, new_nic_id)
|
||||||
|
|||||||
@ -17,18 +17,16 @@
|
|||||||
""" BVT tests for Primary Storage
|
""" BVT tests for Primary Storage
|
||||||
"""
|
"""
|
||||||
#Import Local Modules
|
#Import Local Modules
|
||||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
import marvin
|
||||||
#from marvin.cloudstackAPI import *
|
from marvin.cloudstackTestCase import *
|
||||||
from marvin.lib.utils import cleanup_resources
|
from marvin.cloudstackAPI import *
|
||||||
from marvin.lib.base import StoragePool
|
from marvin.lib.utils import *
|
||||||
from marvin.lib.common import (get_zone,
|
from marvin.lib.base import *
|
||||||
get_pod,
|
from marvin.lib.common import *
|
||||||
list_clusters,
|
|
||||||
list_hosts,
|
|
||||||
list_storage_pools)
|
|
||||||
from nose.plugins.attrib import attr
|
from nose.plugins.attrib import attr
|
||||||
|
|
||||||
#Import System modules
|
#Import System modules
|
||||||
|
import time
|
||||||
_multiprocess_shared_ = True
|
_multiprocess_shared_ = True
|
||||||
|
|
||||||
class TestPrimaryStorageServices(cloudstackTestCase):
|
class TestPrimaryStorageServices(cloudstackTestCase):
|
||||||
|
|||||||
@ -18,9 +18,11 @@
|
|||||||
"""
|
"""
|
||||||
#Import Local Modules
|
#Import Local Modules
|
||||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||||
|
#from marvin.cloudstackException import *
|
||||||
from marvin.cloudstackAPI import (deleteVolume,
|
from marvin.cloudstackAPI import (deleteVolume,
|
||||||
extractVolume,
|
extractVolume,
|
||||||
resizeVolume)
|
resizeVolume)
|
||||||
|
#from marvin.sshClient import SshClient
|
||||||
from marvin.lib.utils import (cleanup_resources,
|
from marvin.lib.utils import (cleanup_resources,
|
||||||
format_volume_to_ext3)
|
format_volume_to_ext3)
|
||||||
from marvin.lib.base import (ServiceOffering,
|
from marvin.lib.base import (ServiceOffering,
|
||||||
@ -33,7 +35,7 @@ from marvin.lib.common import (get_domain,
|
|||||||
get_zone,
|
get_zone,
|
||||||
get_template)
|
get_template)
|
||||||
from marvin.lib.utils import checkVolumeSize
|
from marvin.lib.utils import checkVolumeSize
|
||||||
from marvin.codes import SUCCESS, FAILED, ERROR_CODE_530, XEN_SERVER
|
from marvin.codes import SUCCESS, FAILED, XEN_SERVER
|
||||||
from nose.plugins.attrib import attr
|
from nose.plugins.attrib import attr
|
||||||
#Import System modules
|
#Import System modules
|
||||||
import os
|
import os
|
||||||
@ -402,11 +404,8 @@ class TestVolumes(cloudstackTestCase):
|
|||||||
cmd.zoneid = self.services["zoneid"]
|
cmd.zoneid = self.services["zoneid"]
|
||||||
# A proper exception should be raised;
|
# A proper exception should be raised;
|
||||||
# downloading attach VM is not allowed
|
# downloading attach VM is not allowed
|
||||||
response = self.apiClient.extractVolume(cmd)
|
with self.assertRaises(Exception):
|
||||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
self.apiClient.extractVolume(cmd)
|
||||||
have failed with error code %s, instead got response \
|
|
||||||
%s" % (ERROR_CODE_530, str(response)))
|
|
||||||
return
|
|
||||||
|
|
||||||
@attr(tags = ["advanced", "advancedns", "smoke", "basic", "selfservice"])
|
@attr(tags = ["advanced", "advancedns", "smoke", "basic", "selfservice"])
|
||||||
def test_04_delete_attached_volume(self):
|
def test_04_delete_attached_volume(self):
|
||||||
@ -558,11 +557,15 @@ class TestVolumes(cloudstackTestCase):
|
|||||||
cmd.id = rootvolume.id
|
cmd.id = rootvolume.id
|
||||||
cmd.diskofferingid = self.services['diskofferingid']
|
cmd.diskofferingid = self.services['diskofferingid']
|
||||||
success = False
|
success = False
|
||||||
|
try:
|
||||||
response = self.apiClient.resizeVolume(cmd)
|
self.apiClient.resizeVolume(cmd)
|
||||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
except Exception as ex:
|
||||||
have failed with error code %s, instead got response \
|
if "Can only resize Data volumes" in str(ex):
|
||||||
%s" % (ERROR_CODE_530, str(response)))
|
success = True
|
||||||
|
self.assertEqual(
|
||||||
|
success,
|
||||||
|
True,
|
||||||
|
"ResizeVolume - verify root disks cannot be resized by disk offering id")
|
||||||
|
|
||||||
# Ok, now let's try and resize a volume that is not custom.
|
# Ok, now let's try and resize a volume that is not custom.
|
||||||
cmd.id = self.volume.id
|
cmd.id = self.volume.id
|
||||||
|
|||||||
@ -21,23 +21,14 @@ import base64
|
|||||||
import hmac
|
import hmac
|
||||||
import hashlib
|
import hashlib
|
||||||
import time
|
import time
|
||||||
from cloudstackAPI import *
|
from cloudstackAPI import queryAsyncJobResult
|
||||||
import jsonHelper
|
import jsonHelper
|
||||||
from marvin.codes import (
|
from marvin.codes import (
|
||||||
FAILED,
|
FAILED,
|
||||||
INVALID_RESPONSE,
|
|
||||||
INVALID_INPUT,
|
|
||||||
JOB_FAILED,
|
JOB_FAILED,
|
||||||
JOB_INPROGRESS,
|
|
||||||
JOB_CANCELLED,
|
JOB_CANCELLED,
|
||||||
JOB_SUCCEEDED
|
JOB_SUCCEEDED
|
||||||
)
|
)
|
||||||
from requests import (
|
|
||||||
ConnectionError,
|
|
||||||
HTTPError,
|
|
||||||
Timeout,
|
|
||||||
RequestException
|
|
||||||
)
|
|
||||||
from marvin.cloudstackException import (
|
from marvin.cloudstackException import (
|
||||||
InvalidParameterException,
|
InvalidParameterException,
|
||||||
GetDetailExceptionInfo)
|
GetDetailExceptionInfo)
|
||||||
@ -106,10 +97,12 @@ class CSConnection(object):
|
|||||||
marvinRequest(cmd, response_type=response_cmd)
|
marvinRequest(cmd, response_type=response_cmd)
|
||||||
if async_response != FAILED:
|
if async_response != FAILED:
|
||||||
job_status = async_response.jobstatus
|
job_status = async_response.jobstatus
|
||||||
if job_status in [JOB_FAILED,
|
if job_status in [JOB_CANCELLED,
|
||||||
JOB_CANCELLED,
|
|
||||||
JOB_SUCCEEDED]:
|
JOB_SUCCEEDED]:
|
||||||
break
|
break
|
||||||
|
elif job_status == JOB_FAILED:
|
||||||
|
raise Exception("Job failed: %s"\
|
||||||
|
% async_response)
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
timeout -= 5
|
timeout -= 5
|
||||||
self.logger.debug("=== JobId:%s is Still Processing, "
|
self.logger.debug("=== JobId:%s is Still Processing, "
|
||||||
|
|||||||
@ -60,7 +60,6 @@ JOB_INPROGRESS = 0
|
|||||||
JOB_SUCCEEDED = 1
|
JOB_SUCCEEDED = 1
|
||||||
JOB_FAILED = 2
|
JOB_FAILED = 2
|
||||||
JOB_CANCELLED = 3
|
JOB_CANCELLED = 3
|
||||||
ERROR_CODE_530 = 530
|
|
||||||
'''
|
'''
|
||||||
User Related Codes
|
User Related Codes
|
||||||
'''
|
'''
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user