mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-6657: Adding condition for checking error code 530 across test cases
Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
This commit is contained in:
parent
2c54e5e2c5
commit
2e9cc58af6
@ -18,7 +18,6 @@
|
||||
"""
|
||||
#Import Local Modules
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
#from marvin.cloudstackAPI import *
|
||||
from marvin.lib.utils import (random_gen,
|
||||
cleanup_resources)
|
||||
from marvin.lib.base import (Domain,
|
||||
@ -41,7 +40,7 @@ from marvin.lib.common import (get_domain,
|
||||
get_builtin_template_info,
|
||||
wait_for_cleanup)
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackException import CloudstackAPIException
|
||||
from marvin.codes import ERROR_CODE_530
|
||||
import time
|
||||
|
||||
class Services:
|
||||
@ -1672,21 +1671,25 @@ class TestDomainForceRemove(cloudstackTestCase):
|
||||
" to cleanup any remaining resouces")
|
||||
# Sleep 3*account.gc to ensure that all resources are deleted
|
||||
wait_for_cleanup(self.apiclient, ["account.cleanup.interval"]*3)
|
||||
with self.assertRaises(CloudstackAPIException):
|
||||
Domain.list(
|
||||
response = Domain.list(
|
||||
self.apiclient,
|
||||
id=domain.id,
|
||||
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")
|
||||
with self.assertRaises(CloudstackAPIException):
|
||||
Account.list(
|
||||
response = Account.list(
|
||||
self.apiclient,
|
||||
name=self.account_1.name,
|
||||
domainid=self.account_1.domainid,
|
||||
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)))
|
||||
return
|
||||
|
||||
@attr(tags=["domains", "advanced", "advancedns", "simulator", "selfservice"])
|
||||
@ -1831,6 +1834,8 @@ class TestDomainForceRemove(cloudstackTestCase):
|
||||
)
|
||||
|
||||
self.debug("Deleting domain without force option")
|
||||
with self.assertRaises(Exception):
|
||||
domain.delete(self.apiclient, cleanup=False)
|
||||
response = domain.delete(self.apiclient, cleanup=False)
|
||||
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
|
||||
|
||||
@ -58,7 +58,7 @@ from marvin.cloudstackAPI import (addNicToVirtualMachine,
|
||||
removeNicFromVirtualMachine,
|
||||
updateDefaultNicForVirtualMachine)
|
||||
|
||||
from marvin.codes import PASS
|
||||
from marvin.codes import PASS, ERROR_CODE_530
|
||||
import random
|
||||
import time
|
||||
|
||||
@ -466,8 +466,10 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
|
||||
self.cleanup.append(vpc)
|
||||
self.cleanup.append(vpc_off)
|
||||
self.debug("Trying to add VPC to vm belonging to isolated network, this should fail")
|
||||
with self.assertRaises(Exception):
|
||||
self.virtual_machine.add_nic(self.apiclient, vpc.id)
|
||||
response = self.virtual_machine.add_nic(self.apiclient, vpc.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)))
|
||||
self.debug("Starting virtual machine")
|
||||
self.virtual_machine.start(self.apiclient)
|
||||
self.debug("Disabling vpc offering: %s" % vpc_off.id)
|
||||
@ -825,9 +827,10 @@ class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase):
|
||||
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.virtual_machine.id)
|
||||
with self.assertRaises(Exception):
|
||||
self.virtual_machine.remove_nic(self.apiclient, vm_list[0].nic[0].id)
|
||||
self.debug("Removing default nic of vm failed")
|
||||
response = self.virtual_machine.remove_nic(self.apiclient, vm_list[0].nic[0].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"])
|
||||
|
||||
@ -29,6 +29,7 @@ from marvin.lib.common import (get_zone,
|
||||
get_template,
|
||||
list_virtual_machines,
|
||||
wait_for_cleanup)
|
||||
from marvin.codes import ERROR_CODE_530
|
||||
from nose.plugins.attrib import attr
|
||||
|
||||
class Services:
|
||||
@ -1086,9 +1087,10 @@ 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)
|
||||
|
||||
aff_grps = [self.aff_grp[0], self.aff_grp[1]]
|
||||
with self.assertRaises(Exception):
|
||||
vm1.update_affinity_group(self.api_client, affinitygroupnames=[])
|
||||
|
||||
response = vm1.update_affinity_group(self.api_client, affinitygroupnames=[])
|
||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
||||
have failed with error code %s, instead got response \
|
||||
%s" % (ERROR_CODE_530, str(response)))
|
||||
vm1.delete(self.api_client)
|
||||
#Wait for expunge interval to cleanup VM
|
||||
wait_for_cleanup(self.apiclient, ["expunge.delay", "expunge.interval"])
|
||||
|
||||
@ -38,6 +38,7 @@ from marvin.lib.common import (get_domain,
|
||||
list_snapshots,
|
||||
list_virtual_machines)
|
||||
from marvin.lib.utils import cleanup_resources
|
||||
from marvin.codes import ERROR_CODE_530
|
||||
|
||||
def log_test_exceptions(func):
|
||||
def test_wrap_exception_log(self, *args, **kwargs):
|
||||
@ -369,7 +370,14 @@ class TestVMOwnership(cloudstackTestCase):
|
||||
# 1. deploy VM in sub subdomain1
|
||||
# 3. assignVirtualMachine to subdomain2
|
||||
self.create_vm(self.sdomain_account_user1['account'], self.sdomain_account_user1['domain'],isRunning=True)
|
||||
self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, self.apiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id)
|
||||
response = self.virtual_machine.assign_virtual_machine(
|
||||
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"])
|
||||
@log_test_exceptions
|
||||
@ -380,7 +388,14 @@ class TestVMOwnership(cloudstackTestCase):
|
||||
# 1. deploy VM in sub subdomain1 with PF rule set.
|
||||
# 3. assignVirtualMachine to subdomain2
|
||||
self.create_vm(self.sdomain_account_user1['account'], self.sdomain_account_user1['domain'],pfrule=True)
|
||||
self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, self.apiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id)
|
||||
response = self.virtual_machine.assign_virtual_machine(
|
||||
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"])
|
||||
@log_test_exceptions
|
||||
|
||||
@ -258,8 +258,10 @@ class TestIpReservation(cloudstackTestCase):
|
||||
except Exception as e:
|
||||
self.fail("VM creation failed: %s" % e)
|
||||
|
||||
with self.assertRaises(Exception):
|
||||
isolated_network.update(self.apiclient, guestvmcidr=guest_vm_cidr)
|
||||
response = isolated_network.update(self.apiclient, guestvmcidr=guest_vm_cidr)
|
||||
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"])
|
||||
@ -288,8 +290,10 @@ class TestIpReservation(cloudstackTestCase):
|
||||
except Exception as e:
|
||||
self.fail("VM creation failed: %s" % e)
|
||||
|
||||
with self.assertRaises(Exception):
|
||||
isolated_network.update(self.apiclient, guestvmcidr=guest_vm_cidr)
|
||||
response = isolated_network.update(self.apiclient, guestvmcidr=guest_vm_cidr)
|
||||
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
|
||||
|
||||
@data(NAT_RULE, STATIC_NAT_RULE)
|
||||
@ -1072,11 +1076,18 @@ class TestFailureScnarios(cloudstackTestCase):
|
||||
#
|
||||
# validation
|
||||
# should throw exception as network is not in implemented state as no vm is created
|
||||
try:
|
||||
update_response = Network.update(self.isolated_network, self.apiclient, id=isolated_network.id, guestvmcidr="10.1.1.0/26")
|
||||
self.fail("Network Update of guest VM CIDR is successful withot any VM deployed in network")
|
||||
except Exception as e:
|
||||
self.debug("Network Update of guest VM CIDR should fail as there is no VM deployed in network")
|
||||
networkOffering = self.isolated_network_offering
|
||||
resultSet = createIsolatedNetwork(self, networkOffering.id)
|
||||
if resultSet[0] == FAIL:
|
||||
self.fail("Failed to create isolated network")
|
||||
else:
|
||||
isolated_network = resultSet[1]
|
||||
|
||||
response = isolated_network.update(self.apiclient, guestvmcidr="10.1.1.0/26")
|
||||
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", "selfservice"])
|
||||
def test_vm_create_after_reservation(self):
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
#Import local modules
|
||||
|
||||
|
||||
from marvin.cloudstackTestCase import (cloudstackTestCase,unittest)
|
||||
from marvin.cloudstackTestCase import (cloudstackTestCase)
|
||||
from marvin.lib.base import (Account,
|
||||
ServiceOffering,
|
||||
PhysicalNetwork,
|
||||
@ -40,6 +40,7 @@ from marvin.lib.common import (get_zone,
|
||||
setNonContiguousVlanIds)
|
||||
from marvin.lib.utils import (cleanup_resources,
|
||||
xsplit)
|
||||
from marvin.codes import ERROR_CODE_530
|
||||
|
||||
from nose.plugins.attrib import attr
|
||||
|
||||
@ -317,12 +318,11 @@ class TestNonContiguousVLANRanges(cloudstackTestCase):
|
||||
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])
|
||||
|
||||
with self.assertRaises(Exception) as e:
|
||||
self.physicalnetwork.update(self.apiClient, id = self.physicalnetworkid, vlan = self.vlan["partial_range"][0])
|
||||
|
||||
self.debug("operation failed with exception: %s" % e.exception)
|
||||
response = self.physicalnetwork.update(self.apiClient, id = self.physicalnetworkid, vlan = self.vlan["partial_range"][0])
|
||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
||||
have failed with error code %s, instead got response \
|
||||
%s" % (ERROR_CODE_530, str(response)))
|
||||
account.delete(self.apiclient)
|
||||
|
||||
except Exception as e:
|
||||
self.fail("Exception in test case: %s" % e)
|
||||
|
||||
|
||||
@ -17,15 +17,13 @@
|
||||
""" P1 tests for Project
|
||||
"""
|
||||
#Import Local Modules
|
||||
import marvin
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import *
|
||||
from marvin.cloudstackAPI import *
|
||||
from marvin.lib.utils import *
|
||||
from marvin.lib.base import *
|
||||
from marvin.lib.common import *
|
||||
from marvin.sshClient import SshClient
|
||||
import datetime
|
||||
from marvin.codes import ERROR_CODE_530
|
||||
|
||||
|
||||
class Services:
|
||||
@ -430,13 +428,14 @@ class TestCrossDomainAccountAdd(cloudstackTestCase):
|
||||
self.user.domainid,
|
||||
project.id
|
||||
))
|
||||
with self.assertRaises(Exception):
|
||||
# Add user to the project from different domain
|
||||
project.addAccount(
|
||||
# Add user to the project from different domain
|
||||
response = project.addAccount(
|
||||
self.apiclient,
|
||||
self.user.name
|
||||
)
|
||||
self.debug("User add to project failed!")
|
||||
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
|
||||
|
||||
|
||||
@ -542,10 +541,10 @@ class TestDeleteAccountWithProject(cloudstackTestCase):
|
||||
"Check project name from list response"
|
||||
)
|
||||
# Deleting account who is owner of the project
|
||||
with self.assertRaises(Exception):
|
||||
self.account.delete(self.apiclient)
|
||||
self.debug("Deleting account %s failed!" %
|
||||
self.account.name)
|
||||
response = self.account.delete(self.apiclient)
|
||||
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
|
||||
|
||||
|
||||
|
||||
@ -36,6 +36,7 @@ from marvin.lib.common import (get_domain,
|
||||
get_zone,
|
||||
get_template,
|
||||
get_pod)
|
||||
from marvin.codes import ERROR_CODE_530
|
||||
#Import System modules
|
||||
import time
|
||||
|
||||
@ -341,16 +342,17 @@ class TestAttachVolume(cloudstackTestCase):
|
||||
True,
|
||||
"Check list volumes response for valid list"
|
||||
)
|
||||
# Attach volume to VM
|
||||
with self.assertRaises(Exception):
|
||||
self.debug("Trying to Attach volume: %s to VM: %s" % (
|
||||
self.debug("Trying to Attach volume: %s to VM: %s" % (
|
||||
volume.id,
|
||||
self.virtual_machine.id
|
||||
))
|
||||
self.virtual_machine.attach_volume(
|
||||
response = self.virtual_machine.attach_volume(
|
||||
self.apiclient,
|
||||
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
|
||||
|
||||
class TestAttachDetachVolume(cloudstackTestCase):
|
||||
|
||||
@ -25,6 +25,7 @@ from marvin.cloudstackAPI import *
|
||||
from marvin.lib.utils import *
|
||||
from marvin.lib.base import *
|
||||
from marvin.lib.common import *
|
||||
from marvin.codes import ERROR_CODE_530
|
||||
|
||||
|
||||
class Services:
|
||||
@ -699,8 +700,10 @@ class TestVPC(cloudstackTestCase):
|
||||
self.debug("Created network with ID: %s" % network_2.id)
|
||||
|
||||
self.debug("Deleting the VPC with no network")
|
||||
with self.assertRaises(Exception):
|
||||
vpc.delete(self.apiclient)
|
||||
response = vpc.delete(self.apiclient)
|
||||
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("Delete VPC failed as there are still networks in 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
|
||||
from ddt import ddt, data
|
||||
import time
|
||||
from marvin.codes import PASS
|
||||
from marvin.codes import PASS, ERROR_CODE_530
|
||||
|
||||
class Services:
|
||||
"""Test VPC network services
|
||||
@ -2107,12 +2107,14 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
|
||||
self.fail("Failed to stop VMs, %s" % e)
|
||||
|
||||
self.debug("Upgrading network offering to support PF services")
|
||||
with self.assertRaises(Exception):
|
||||
network_1.update(
|
||||
response = network_1.update(
|
||||
self.apiclient,
|
||||
networkofferingid=nw_off_vr.id,
|
||||
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
|
||||
|
||||
class TestVPCNetworkGc(cloudstackTestCase):
|
||||
|
||||
@ -39,6 +39,7 @@ from marvin.lib.common import (get_domain,
|
||||
get_template,
|
||||
list_routers)
|
||||
from marvin.lib.utils import cleanup_resources
|
||||
from marvin.codes import ERROR_CODE_530
|
||||
import socket
|
||||
import time
|
||||
|
||||
@ -640,8 +641,10 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
|
||||
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.
|
||||
# http://cloudstack.apache.org/docs/en-US/Apache_CloudStack/4.0.2/html/Installation_Guide/configure-vpc.html
|
||||
with self.assertRaises(Exception):
|
||||
lb_rule.assign(self.apiclient, [vm_3])
|
||||
response = lb_rule.assign(self.apiclient, [vm_3])
|
||||
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.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
|
||||
return
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
"""
|
||||
#Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
from marvin.lib.base import (VirtualMachine,
|
||||
NetworkOffering,
|
||||
VpcOffering,
|
||||
@ -43,6 +43,7 @@ from marvin.lib.common import (get_domain,
|
||||
get_free_vlan)
|
||||
|
||||
from marvin.lib.utils import cleanup_resources
|
||||
from marvin.codes import ERROR_CODE_530
|
||||
from marvin.cloudstackAPI import rebootRouter
|
||||
|
||||
|
||||
@ -1622,8 +1623,10 @@ class TestVMDeployVPC(cloudstackTestCase):
|
||||
"Vm state should be running for each VM deployed"
|
||||
)
|
||||
self.debug("Trying to delete network: %s" % network_1.name)
|
||||
with self.assertRaises(Exception):
|
||||
network_1.delete(self.apiclient)
|
||||
response = network_1.delete(self.apiclient)
|
||||
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("Delete netwpork failed as there are running instances")
|
||||
|
||||
self.debug("Destroying all the instances in network1: %s" %
|
||||
@ -2161,8 +2164,10 @@ class TestVMDeployVPC(cloudstackTestCase):
|
||||
)
|
||||
|
||||
self.debug("Trying to delete network: %s" % network_1.name)
|
||||
with self.assertRaises(Exception):
|
||||
network_1.delete(self.apiclient)
|
||||
response = network_1.delete(self.apiclient)
|
||||
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("Delete network failed as there are running instances")
|
||||
|
||||
self.debug("Destroying all the instances in network1: %s" %
|
||||
|
||||
@ -27,6 +27,7 @@ from marvin.lib.utils import *
|
||||
from marvin.lib.base import *
|
||||
from marvin.lib.common import *
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.codes import ERROR_CODE_530
|
||||
#Import System modules
|
||||
import time
|
||||
|
||||
@ -389,12 +390,14 @@ class TestPortForwarding(cloudstackTestCase):
|
||||
|
||||
try:
|
||||
nat_rule.delete(self.apiclient)
|
||||
list_nat_rule_response = list_nat_rules(
|
||||
self.apiclient,
|
||||
id=nat_rule.id
|
||||
)
|
||||
except CloudstackAPIException:
|
||||
self.fail("Nat Rule Deletion or Listing Failed")
|
||||
self.fail("Nat Rule deletion failed: %s" % e)
|
||||
|
||||
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
|
||||
with self.assertRaises(Exception):
|
||||
|
||||
@ -15,14 +15,17 @@
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
""" NIC tests for VM """
|
||||
import marvin
|
||||
from marvin.codes import FAILED
|
||||
from marvin.cloudstackTestCase import *
|
||||
from marvin.cloudstackAPI import *
|
||||
from marvin.sshClient import SshClient
|
||||
from marvin.lib.utils import *
|
||||
from marvin.lib.base import *
|
||||
from marvin.lib.common import *
|
||||
from marvin.codes import ERROR_CODE_530
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
from marvin.lib.base import(Account,
|
||||
ServiceOffering,
|
||||
Network,
|
||||
VirtualMachine,
|
||||
NetworkOffering)
|
||||
from marvin.lib.common import (get_zone,
|
||||
get_domain,
|
||||
get_template,
|
||||
list_virtual_machines)
|
||||
from nose.plugins.attrib import attr
|
||||
|
||||
import signal
|
||||
@ -186,7 +189,7 @@ class TestNic(cloudstackTestCase):
|
||||
existing_nic_id = vm_response.nic[0].id
|
||||
|
||||
# 1. add a nic
|
||||
add_response = self.virtual_machine.add_nic(self.apiclient, self.test_network2.id)
|
||||
self.virtual_machine.add_nic(self.apiclient, self.test_network2.id)
|
||||
|
||||
time.sleep(5)
|
||||
# now go get the vm list?
|
||||
@ -231,13 +234,11 @@ class TestNic(cloudstackTestCase):
|
||||
"Verify second adapter is set to default"
|
||||
)
|
||||
|
||||
sawException = False
|
||||
try:
|
||||
self.virtual_machine.remove_nic(self.apiclient, new_nic_id)
|
||||
except Exception as ex:
|
||||
sawException = True
|
||||
response = self.virtual_machine.remove_nic(self.apiclient, new_nic_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)))
|
||||
|
||||
self.assertEqual(sawException, True, "Make sure we cannot delete the default NIC")
|
||||
self.virtual_machine.update_default_nic(self.apiclient, existing_nic_id)
|
||||
time.sleep(5)
|
||||
self.virtual_machine.remove_nic(self.apiclient, new_nic_id)
|
||||
|
||||
@ -17,16 +17,18 @@
|
||||
""" BVT tests for Primary Storage
|
||||
"""
|
||||
#Import Local Modules
|
||||
import marvin
|
||||
from marvin.cloudstackTestCase import *
|
||||
from marvin.cloudstackAPI import *
|
||||
from marvin.lib.utils import *
|
||||
from marvin.lib.base import *
|
||||
from marvin.lib.common import *
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
#from marvin.cloudstackAPI import *
|
||||
from marvin.lib.utils import cleanup_resources
|
||||
from marvin.lib.base import StoragePool
|
||||
from marvin.lib.common import (get_zone,
|
||||
get_pod,
|
||||
list_clusters,
|
||||
list_hosts,
|
||||
list_storage_pools)
|
||||
from nose.plugins.attrib import attr
|
||||
|
||||
#Import System modules
|
||||
import time
|
||||
_multiprocess_shared_ = True
|
||||
|
||||
class TestPrimaryStorageServices(cloudstackTestCase):
|
||||
|
||||
@ -18,11 +18,9 @@
|
||||
"""
|
||||
#Import Local Modules
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
#from marvin.cloudstackException import *
|
||||
from marvin.cloudstackAPI import (deleteVolume,
|
||||
extractVolume,
|
||||
resizeVolume)
|
||||
#from marvin.sshClient import SshClient
|
||||
from marvin.lib.utils import (cleanup_resources,
|
||||
format_volume_to_ext3)
|
||||
from marvin.lib.base import (ServiceOffering,
|
||||
@ -35,7 +33,7 @@ from marvin.lib.common import (get_domain,
|
||||
get_zone,
|
||||
get_template)
|
||||
from marvin.lib.utils import checkVolumeSize
|
||||
from marvin.codes import SUCCESS, FAILED
|
||||
from marvin.codes import SUCCESS, FAILED, ERROR_CODE_530
|
||||
from nose.plugins.attrib import attr
|
||||
#Import System modules
|
||||
import os
|
||||
@ -395,8 +393,11 @@ class TestVolumes(cloudstackTestCase):
|
||||
cmd.zoneid = self.services["zoneid"]
|
||||
# A proper exception should be raised;
|
||||
# downloading attach VM is not allowed
|
||||
with self.assertRaises(Exception):
|
||||
self.apiClient.extractVolume(cmd)
|
||||
response = self.apiClient.extractVolume(cmd)
|
||||
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", "advancedns", "smoke", "basic", "selfservice"])
|
||||
def test_04_delete_attached_volume(self):
|
||||
@ -548,15 +549,11 @@ class TestVolumes(cloudstackTestCase):
|
||||
cmd.id = rootvolume.id
|
||||
cmd.diskofferingid = self.services['diskofferingid']
|
||||
success = False
|
||||
try:
|
||||
self.apiClient.resizeVolume(cmd)
|
||||
except Exception as ex:
|
||||
if "Can only resize Data volumes" in str(ex):
|
||||
success = True
|
||||
self.assertEqual(
|
||||
success,
|
||||
True,
|
||||
"ResizeVolume - verify root disks cannot be resized by disk offering id")
|
||||
|
||||
response = self.apiClient.resizeVolume(cmd)
|
||||
self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
|
||||
have failed with error code %s, instead got response \
|
||||
%s" % (ERROR_CODE_530, str(response)))
|
||||
|
||||
# Ok, now let's try and resize a volume that is not custom.
|
||||
cmd.id = self.volume.id
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user