cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tall...@apache.org
Subject git commit: updated refs/heads/4.4-forward to 8eca370
Date Fri, 16 May 2014 13:26:34 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.4-forward a418ee443 -> 8eca37056


CLOUDSTACK-6657: Adding condition for checking error code 530 across test cases

Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>


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

Branch: refs/heads/4.4-forward
Commit: 8eca37056f5bb1eee10f0bedee785142d7c3437a
Parents: a418ee4
Author: Gaurav Aradhye <gaurav.aradhye@clogeny.com>
Authored: Thu May 15 23:19:06 2014 -0400
Committer: SrikanteswaraRao Talluri <talluri@apache.org>
Committed: Fri May 16 18:55:37 2014 +0530

----------------------------------------------------------------------
 test/integration/component/test_accounts.py     | 21 ++++++++-----
 .../component/test_add_remove_network.py        | 15 ++++++----
 .../component/test_affinity_groups.py           |  8 +++--
 test/integration/component/test_assign_vm.py    | 19 ++++++++++--
 .../component/test_ip_reservation.py            | 14 +++++----
 .../component/test_non_contiguous_vlan.py       | 12 ++++----
 test/integration/component/test_projects.py     | 21 +++++++------
 test/integration/component/test_volumes.py      | 10 ++++---
 test/integration/component/test_vpc.py          |  7 +++--
 test/integration/component/test_vpc_network.py  |  8 +++--
 .../component/test_vpc_network_lbrules.py       |  7 +++--
 .../component/test_vpc_vms_deployment.py        | 15 ++++++----
 test/integration/smoke/test_network.py          | 13 ++++----
 test/integration/smoke/test_nic.py              | 31 ++++++++++----------
 test/integration/smoke/test_primary_storage.py  | 16 +++++-----
 test/integration/smoke/test_volumes.py          | 25 +++++++---------
 16 files changed, 144 insertions(+), 98 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8eca3705/test/integration/component/test_accounts.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_accounts.py b/test/integration/component/test_accounts.py
index cf5f2b6..98a1aa1 100644
--- a/test/integration/component/test_accounts.py
+++ b/test/integration/component/test_accounts.py
@@ -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

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8eca3705/test/integration/component/test_add_remove_network.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_add_remove_network.py b/test/integration/component/test_add_remove_network.py
index c17293d..969d94c 100644
--- a/test/integration/component/test_add_remove_network.py
+++ b/test/integration/component/test_add_remove_network.py
@@ -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"])

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8eca3705/test/integration/component/test_affinity_groups.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_affinity_groups.py b/test/integration/component/test_affinity_groups.py
index d0fa2f7..d31746a 100644
--- a/test/integration/component/test_affinity_groups.py
+++ b/test/integration/component/test_affinity_groups.py
@@ -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"])

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8eca3705/test/integration/component/test_assign_vm.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_assign_vm.py b/test/integration/component/test_assign_vm.py
index 24b63a6..0b07e9f 100644
--- a/test/integration/component/test_assign_vm.py
+++ b/test/integration/component/test_assign_vm.py
@@ -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

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8eca3705/test/integration/component/test_ip_reservation.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_ip_reservation.py b/test/integration/component/test_ip_reservation.py
index c84f63c..eb193d1 100644
--- a/test/integration/component/test_ip_reservation.py
+++ b/test/integration/component/test_ip_reservation.py
@@ -270,8 +270,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"])
@@ -300,8 +302,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)
@@ -1086,7 +1090,7 @@ class TestFailureScnarios(cloudstackTestCase):
         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, response))
+                         %s" % (ERROR_CODE_530, str(response)))
         return
 
     @attr(tags=["advanced", "selfservice"])

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8eca3705/test/integration/component/test_non_contiguous_vlan.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_non_contiguous_vlan.py b/test/integration/component/test_non_contiguous_vlan.py
index 4609af9..1f74252 100644
--- a/test/integration/component/test_non_contiguous_vlan.py
+++ b/test/integration/component/test_non_contiguous_vlan.py
@@ -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)
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8eca3705/test/integration/component/test_projects.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_projects.py b/test/integration/component/test_projects.py
index c593fb6..cf6cec8 100644
--- a/test/integration/component/test_projects.py
+++ b/test/integration/component/test_projects.py
@@ -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
 
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8eca3705/test/integration/component/test_volumes.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_volumes.py b/test/integration/component/test_volumes.py
index b5b08e2..4a91e5d 100644
--- a/test/integration/component/test_volumes.py
+++ b/test/integration/component/test_volumes.py
@@ -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):

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8eca3705/test/integration/component/test_vpc.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc.py b/test/integration/component/test_vpc.py
index e9d396e8..31b421c 100644
--- a/test/integration/component/test_vpc.py
+++ b/test/integration/component/test_vpc.py
@@ -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")
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8eca3705/test/integration/component/test_vpc_network.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_network.py b/test/integration/component/test_vpc_network.py
index a449948..8d12ec6 100644
--- a/test/integration/component/test_vpc_network.py
+++ b/test/integration/component/test_vpc_network.py
@@ -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):

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8eca3705/test/integration/component/test_vpc_network_lbrules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_network_lbrules.py b/test/integration/component/test_vpc_network_lbrules.py
index a5625e7..47bdce5 100644
--- a/test/integration/component/test_vpc_network_lbrules.py
+++ b/test/integration/component/test_vpc_network_lbrules.py
@@ -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
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8eca3705/test/integration/component/test_vpc_vms_deployment.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_vms_deployment.py b/test/integration/component/test_vpc_vms_deployment.py
index 1c1f93d..19aa448 100644
--- a/test/integration/component/test_vpc_vms_deployment.py
+++ b/test/integration/component/test_vpc_vms_deployment.py
@@ -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" %

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8eca3705/test/integration/smoke/test_network.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py
index 6beb071..b82501c 100644
--- a/test/integration/smoke/test_network.py
+++ b/test/integration/smoke/test_network.py
@@ -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):

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8eca3705/test/integration/smoke/test_nic.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_nic.py b/test/integration/smoke/test_nic.py
index 592a839..a76e858 100644
--- a/test/integration/smoke/test_nic.py
+++ b/test/integration/smoke/test_nic.py
@@ -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)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8eca3705/test/integration/smoke/test_primary_storage.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_primary_storage.py b/test/integration/smoke/test_primary_storage.py
index 3147d86..5b24b64 100644
--- a/test/integration/smoke/test_primary_storage.py
+++ b/test/integration/smoke/test_primary_storage.py
@@ -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):

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8eca3705/test/integration/smoke/test_volumes.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py
index 5908e2b..a151df9 100644
--- a/test/integration/smoke/test_volumes.py
+++ b/test/integration/smoke/test_volumes.py
@@ -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


Mime
View raw message