cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From santhosheduku...@apache.org
Subject git commit: updated refs/heads/master to 1e3a689
Date Thu, 07 Aug 2014 07:19:47 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master f424a04b0 -> 1e3a68979


CLOUDSTACK-6873: Moved test cases that run only on simulator and those should be run serially to misc folder and also tagged them with required_hardware='simulator only'

Signed-off-by: Santhosh Edukulla <santhosh.edukulla@gmail.com>


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

Branch: refs/heads/master
Commit: 1e3a689793278bb58a864a6fce266240f8f2c827
Parents: f424a04
Author: Gaurav Aradhye <gaurav.aradhye@clogeny.com>
Authored: Tue Aug 5 11:42:44 2014 +0530
Committer: Santhosh Edukulla <santhosh.edukulla@gmail.com>
Committed: Thu Aug 7 12:49:28 2014 +0530

----------------------------------------------------------------------
 test/integration/smoke/misc/__init__.py       |  16 +
 test/integration/smoke/misc/test_deploy_vm.py | 257 ++++++++++++++
 test/integration/smoke/misc/test_vm_ha.py     | 201 +++++++++++
 test/integration/smoke/test_deploy_vm.py      | 385 ---------------------
 test/integration/smoke/test_vm_ha.py          | 202 -----------
 test/integration/smoke/test_vm_life_cycle.py  |  70 +++-
 6 files changed, 537 insertions(+), 594 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1e3a6897/test/integration/smoke/misc/__init__.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/misc/__init__.py b/test/integration/smoke/misc/__init__.py
new file mode 100644
index 0000000..13a8339
--- /dev/null
+++ b/test/integration/smoke/misc/__init__.py
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1e3a6897/test/integration/smoke/misc/test_deploy_vm.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/misc/test_deploy_vm.py b/test/integration/smoke/misc/test_deploy_vm.py
new file mode 100644
index 0000000..071d15d
--- /dev/null
+++ b/test/integration/smoke/misc/test_deploy_vm.py
@@ -0,0 +1,257 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#Test from the Marvin - Testing in Python wiki
+
+#All tests inherit from cloudstackTestCase
+from marvin.cloudstackTestCase import cloudstackTestCase
+
+#Import Integration Libraries
+
+from marvin.codes import FAILED
+#base - contains all resources as entities and defines create, delete, list operations on them
+from marvin.lib.base import Account, VirtualMachine, ServiceOffering, SimulatorMock
+
+#utils - utility classes for common cleanup, external library wrappers etc
+from marvin.lib.utils import cleanup_resources
+
+#common - commonly used methods for all tests are listed here
+from marvin.lib.common import get_zone, get_domain, get_template
+
+from nose.plugins.attrib import attr
+
+class TestDeployVMVolumeCreationFailure(cloudstackTestCase):
+    """Test VM deploy into user account with volume creation failure
+    """
+
+    def setUp(self):
+        self.testdata =  self.testClient.getParsedTestDataConfig()
+        self.apiclient = self.testClient.getApiClient()
+
+        # Get Zone, Domain and Default Built-in template
+        self.domain = get_domain(self.apiclient)
+        self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
+        self.testdata["mode"] = self.zone.networktype
+        self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"])
+
+        #create a user account
+        self.account = Account.create(
+            self.apiclient,
+            self.testdata["account"],
+            domainid=self.domain.id
+        )
+        #create a service offering
+        self.service_offering = ServiceOffering.create(
+            self.apiclient,
+            self.testdata["service_offerings"]["small"]
+        )
+        #create first VM
+        self.virtual_machine = VirtualMachine.create(
+            self.apiclient,
+            self.testdata["virtual_machine"],
+            accountid=self.account.name,
+            zoneid=self.zone.id,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+            templateid=self.template.id)
+        #mock to simulate volume creation failure
+        self.mock_volume_failure = SimulatorMock.create(
+            apiclient=self.apiclient,
+            command="CopyCommand",
+            count=6)
+        #build cleanup list
+        self.cleanup = [
+            self.service_offering,
+            self.account,
+            self.mock_volume_failure
+        ]
+
+
+    @attr(tags = ['advanced'], required_hardware="simulator only")
+    def test_deploy_vm_volume_creation_failure(self):
+        """Test Deploy Virtual Machine - volume creation failure and retry
+
+        # Validate the following:
+        # 1. 1st VM creation failed
+        # 2. Check there were 4 failed volume creation retries (mock count = (6-4) = 2)
+        # 3. 2nd VM creation succeeded
+        # 4. Check there were 2 failed volume creation retries (mock count = (2-2) = 0)
+        # 5. ListVM returns accurate information
+        """
+        self.virtual_machine = None
+        with self.assertRaises(Exception):
+            self.virtual_machine = VirtualMachine.create(
+                self.apiclient,
+                self.testdata["virtual_machine2"],
+                accountid=self.account.name,
+                zoneid=self.zone.id,
+                domainid=self.account.domainid,
+                serviceofferingid=self.service_offering.id,
+                templateid=self.template.id)
+
+        self.mock_volume_failure = self.mock_volume_failure.query(self.apiclient)
+        self.assertEqual(
+            self.mock_volume_failure.count,
+            2,
+            msg="Volume failure mock not executed")
+
+        self.virtual_machine = VirtualMachine.create(
+            self.apiclient,
+            self.testdata["virtual_machine3"],
+            accountid=self.account.name,
+            zoneid=self.zone.id,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+            templateid=self.template.id)
+        list_vms = VirtualMachine.list(self.apiclient, id=self.virtual_machine.id)
+        self.assertTrue(isinstance(list_vms, list) and len(list_vms) > 0, msg="List VM response empty")
+        vm = list_vms[0]
+        self.assertEqual(
+            vm.id,
+            self.virtual_machine.id,
+            "VM ids do not match")
+        self.assertEqual(
+            vm.name,
+            self.virtual_machine.name,
+            "VM names do not match")
+        self.assertEqual(
+            vm.state,
+            "Running",
+            msg="VM is not in Running state")
+
+        self.mock_volume_failure = self.mock_volume_failure.query(self.apiclient)
+        self.assertEqual(
+            self.mock_volume_failure.count,
+            0,
+            msg="Volume failure mock not executed")
+
+    def tearDown(self):
+        try:
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+
+class TestDeployVMStartFailure(cloudstackTestCase):
+    """Test VM deploy into user account with start operation failure
+    """
+
+    def setUp(self):
+        self.testdata = self.testClient.getParsedTestDataConfig()
+        self.apiclient = self.testClient.getApiClient()
+
+        # Get Zone, Domain and Default Built-in template
+        self.domain = get_domain(self.apiclient)
+        self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
+        self.testdata["mode"] = self.zone.networktype
+        self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"])
+
+        #create a user account
+        self.account = Account.create(
+            self.apiclient,
+            self.testdata["account"],
+            domainid=self.domain.id
+        )
+        #create a service offering
+        self.service_offering = ServiceOffering.create(
+            self.apiclient,
+            self.testdata["service_offerings"]["small"]
+        )
+        #create first VM
+        self.virtual_machine = VirtualMachine.create(
+            self.apiclient,
+            self.testdata["virtual_machine"],
+            accountid=self.account.name,
+            zoneid=self.zone.id,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+            templateid=self.template.id)
+        #mock to simulate vm start failure
+        self.mock_start_failure = SimulatorMock.create(
+            apiclient=self.apiclient,
+            command="StartCommand",
+            count=6)
+        #build cleanup list
+        self.cleanup = [
+            self.service_offering,
+            self.account,
+            self.mock_start_failure
+        ]
+
+    @attr(tags = ['advanced'], required_hardware="simulator only")
+    def test_deploy_vm_start_failure(self):
+        """Test Deploy Virtual Machine - start operation failure and retry
+
+        # Validate the following:
+        # 1. 1st VM creation failed
+        # 2. Check there were 4 failed start operation retries (mock count = (6-4) = 2)
+        # 3. 2nd VM creation succeeded
+        # 4. Check there were 2 failed start operation retries (mock count = (2-2) = 0)
+        # 5. ListVM returns accurate information
+        """
+        self.virtual_machine = None
+        with self.assertRaises(Exception):
+            self.virtual_machine = VirtualMachine.create(
+                self.apiclient,
+                self.testdata["virtual_machine2"],
+                accountid=self.account.name,
+                zoneid=self.zone.id,
+                domainid=self.account.domainid,
+                serviceofferingid=self.service_offering.id,
+                templateid=self.template.id)
+
+        self.mock_start_failure = self.mock_start_failure.query(self.apiclient)
+        self.assertEqual(
+            self.mock_start_failure.count,
+            2,
+            msg="Start failure mock not executed")
+
+        self.virtual_machine = VirtualMachine.create(
+            self.apiclient,
+            self.testdata["virtual_machine3"],
+            accountid=self.account.name,
+            zoneid=self.zone.id,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+            templateid=self.template.id)
+        list_vms = VirtualMachine.list(self.apiclient, id=self.virtual_machine.id)
+        self.assertTrue(isinstance(list_vms, list) and len(list_vms) > 0, msg="List VM response empty")
+        vm = list_vms[0]
+        self.assertEqual(
+            vm.id,
+            self.virtual_machine.id,
+            "VM ids do not match")
+        self.assertEqual(
+            vm.name,
+            self.virtual_machine.name,
+            "VM names do not match")
+        self.assertEqual(
+            vm.state,
+            "Running",
+            msg="VM is not in Running state")
+
+        self.mock_start_failure = self.mock_start_failure.query(self.apiclient)
+        self.assertEqual(
+            self.mock_start_failure.count,
+            0,
+            msg="Start failure mock not executed")
+
+    def tearDown(self):
+        try:
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1e3a6897/test/integration/smoke/misc/test_vm_ha.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/misc/test_vm_ha.py b/test/integration/smoke/misc/test_vm_ha.py
new file mode 100644
index 0000000..601354e
--- /dev/null
+++ b/test/integration/smoke/misc/test_vm_ha.py
@@ -0,0 +1,201 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#Test from the Marvin - Testing in Python wiki
+
+import time
+
+#All tests inherit from cloudstackTestCase
+from marvin.cloudstackTestCase import cloudstackTestCase
+
+#Import Integration Libraries
+
+#base - contains all resources as entities and defines create, delete, list operations on them
+from marvin.lib.base import Account, VirtualMachine, Cluster, Host, ServiceOffering, Configurations, SimulatorMock
+
+#utils - utility classes for common cleanup, external library wrappers etc
+from marvin.lib.utils import cleanup_resources, validateList
+
+#common - commonly used methods for all tests are listed here
+from marvin.lib.common import get_zone, get_domain, get_template
+from marvin.codes import PASS
+
+from nose.plugins.attrib import attr
+
+class TestDeployVMHA(cloudstackTestCase):
+    """Test VM HA
+    """
+
+    def setUp(self):
+        self.testdata = self.testClient.getParsedTestDataConfig()
+        self.apiclient = self.testClient.getApiClient()
+
+        # Get Zone, Domain and Default Built-in template
+        self.domain = get_domain(self.apiclient)
+        self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
+
+        self.testdata["mode"] = self.zone.networktype
+        self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"])
+
+        self.hosts = []
+        suitablecluster = None
+        clusters = Cluster.list(self.apiclient)
+        self.assertTrue(isinstance(clusters, list) and len(clusters) > 0, msg = "No clusters found")
+        for cluster in clusters:
+            self.hosts = Host.list(self.apiclient, clusterid=cluster.id, type='Routing')
+            if isinstance(self.hosts, list) and len(self.hosts) >= 2:
+                suitablecluster = cluster
+                break
+        self.assertEqual(validateList(self.hosts)[0], PASS, "hosts list validation failed")
+        if len(self.hosts) < 2:
+            self.skipTest("Atleast 2 hosts required in cluster for VM HA test")
+        #update host tags
+        for host in self.hosts:
+            Host.update(self.apiclient, id=host.id, hosttags=self.testdata["service_offerings"]["hasmall"]["hosttags"])
+
+        #create a user account
+        self.account = Account.create(
+            self.apiclient,
+            self.testdata["account"],
+            domainid=self.domain.id
+        )
+        #create a service offering
+        self.service_offering = ServiceOffering.create(
+            self.apiclient,
+            self.testdata["service_offerings"]["hasmall"]
+        )
+        #deploy ha vm
+        self.virtual_machine = VirtualMachine.create(
+            self.apiclient,
+            self.testdata["virtual_machine"],
+            accountid=self.account.name,
+            zoneid=self.zone.id,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+            templateid=self.template.id
+        )
+        list_vms = VirtualMachine.list(self.apiclient, id=self.virtual_machine.id)
+        self.debug(
+            "Verify listVirtualMachines response for virtual machine: %s"\
+            % self.virtual_machine.id
+        )
+        self.assertTrue(isinstance(list_vms, list) and len(list_vms) == 1, msg = "List VM response was empty")
+        self.virtual_machine = list_vms[0]
+
+        self.mock_checkhealth = SimulatorMock.create(
+            apiclient=self.apiclient,
+            command="CheckHealthCommand",
+            zoneid=suitablecluster.zoneid,
+            podid=suitablecluster.podid,
+            clusterid=suitablecluster.id,
+            hostid=self.virtual_machine.hostid,
+            value="result:fail")
+        self.mock_ping = SimulatorMock.create(
+            apiclient=self.apiclient,
+            command="PingCommand",
+            zoneid=suitablecluster.zoneid,
+            podid=suitablecluster.podid,
+            clusterid=suitablecluster.id,
+            hostid=self.virtual_machine.hostid,
+            value="result:fail")
+        self.mock_checkvirtualmachine = SimulatorMock.create(
+            apiclient=self.apiclient,
+            command="CheckVirtualMachineCommand",
+            zoneid=suitablecluster.zoneid,
+            podid=suitablecluster.podid,
+            clusterid=suitablecluster.id,
+            hostid=self.virtual_machine.hostid,
+            value="result:fail")
+        self.mock_pingtest = SimulatorMock.create(
+            apiclient=self.apiclient,
+            command="PingTestCommand",
+            zoneid=suitablecluster.zoneid,
+            podid=suitablecluster.podid,
+            value="result:fail")
+        self.mock_checkonhost_list = []
+        for host in self.hosts:
+            if host.id != self.virtual_machine.hostid:
+                self.mock_checkonhost_list.append(SimulatorMock.create(
+                    apiclient=self.apiclient,
+                    command="CheckOnHostCommand",
+                    zoneid=suitablecluster.zoneid,
+                    podid=suitablecluster.podid,
+                    clusterid=suitablecluster.id,
+                    hostid=host.id,
+                    value="result:fail"))
+        #build cleanup list
+        self.cleanup = [
+            self.service_offering,
+            self.account,
+            self.mock_checkhealth,
+            self.mock_ping,
+            self.mock_checkvirtualmachine,
+            self.mock_pingtest
+        ]
+        self.cleanup = self.cleanup + self.mock_checkonhost_list
+
+    @attr(tags = ['advanced'], required_hardware="simulator only")
+    def test_vm_ha(self):
+        """Test VM HA
+
+        # Validate the following:
+        # VM started on other host in cluster
+        """
+
+        #wait for VM to HA
+        ping_timeout = Configurations.list(self.apiclient, name="ping.timeout")
+        ping_interval = Configurations.list(self.apiclient, name="ping.interval")
+        total_duration = int(float(ping_timeout[0].value) * float(ping_interval[0].value))
+        time.sleep(total_duration)
+
+        duration = 0
+        vm = None
+        while duration < total_duration:
+            list_vms = VirtualMachine.list(self.apiclient, id=self.virtual_machine.id)
+            self.assertTrue(isinstance(list_vms, list) and len(list_vms) == 1, msg = "List VM response was empty")
+            vm = list_vms[0]
+            if vm.hostid != self.virtual_machine.hostid and vm.state == "Running":
+                break
+            else:
+                time.sleep(10)
+                duration = duration + 10
+
+        self.assertEqual(
+            vm.id,
+            self.virtual_machine.id,
+            "VM ids do not match")
+        self.assertEqual(
+            vm.name,
+            self.virtual_machine.name,
+            "VM names do not match")
+        self.assertEqual(
+            vm.state,
+            "Running",
+            msg="VM is not in Running state")
+        self.assertNotEqual(
+            vm.hostid,
+            self.virtual_machine.hostid,
+            msg="VM is not started on another host as part of HA")
+
+    def tearDown(self):
+        try:
+            for host in self.hosts:
+                Host.update(self.apiclient, id=host.id, hosttags="")
+
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1e3a6897/test/integration/smoke/test_deploy_vm.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vm.py b/test/integration/smoke/test_deploy_vm.py
deleted file mode 100644
index 29cdb96..0000000
--- a/test/integration/smoke/test_deploy_vm.py
+++ /dev/null
@@ -1,385 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-#Test from the Marvin - Testing in Python wiki
-
-#All tests inherit from cloudstackTestCase
-from marvin.cloudstackTestCase import cloudstackTestCase
-
-#Import Integration Libraries
-
-from marvin.codes import FAILED
-#base - contains all resources as entities and defines create, delete, list operations on them
-from marvin.lib.base import Account, VirtualMachine, ServiceOffering, SimulatorMock
-
-#utils - utility classes for common cleanup, external library wrappers etc
-from marvin.lib.utils import cleanup_resources
-
-#common - commonly used methods for all tests are listed here
-from marvin.lib.common import get_zone, get_domain, get_template
-
-from nose.plugins.attrib import attr
-
-class TestDeployVM(cloudstackTestCase):
-    """Test deploy a VM into a user account
-    """
-
-    def setUp(self):
-        self.apiclient = self.testClient.getApiClient()
-
-        self.testdata = self.testClient.getParsedTestDataConfig()
-        # Get Zone, Domain and Default Built-in template
-        self.domain = get_domain(self.apiclient)
-        self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
-        self.testdata["mode"] = self.zone.networktype
-        self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"])
-
-        if self.template == FAILED:
-            self.fail("get_template() failed to return template with description %s" % self.testdata["ostype"])
-
-        #create a user account
-        self.account = Account.create(
-            self.apiclient,
-            self.testdata["account"],
-            domainid=self.domain.id
-        )
-        #create a service offering
-        self.service_offering = ServiceOffering.create(
-            self.apiclient,
-            self.testdata["service_offerings"]["small"]
-        )
-        #build cleanup list
-        self.cleanup = [
-            self.service_offering,
-            self.account
-        ]
-
-    @attr(tags = ['advanced'], required_hardware="false")
-    def test_deploy_vm(self):
-        """Test Deploy Virtual Machine
-
-        # Validate the following:
-        # 1. Virtual Machine is accessible via SSH
-        # 2. listVirtualMachines returns accurate information
-        """
-        self.virtual_machine = VirtualMachine.create(
-            self.apiclient,
-            self.testdata["virtual_machine"],
-            accountid=self.account.name,
-            zoneid=self.zone.id,
-            domainid=self.account.domainid,
-            serviceofferingid=self.service_offering.id,
-            templateid=self.template.id
-        )
-        if not self.virtual_machine:
-            self.fail("Deploying a Virtual Machine Failed")
-        list_vms = VirtualMachine.list(self.apiclient, id=self.virtual_machine.id)
-        self.debug(
-            "Verify listVirtualMachines response for virtual machine: %s"\
-            % self.virtual_machine.id
-        )
-        self.assertTrue(isinstance(list_vms, list) and len(list_vms) > 0, msg="List VM response empty")
-
-        vm = list_vms[0]
-        self.assertEqual(
-            vm.id,
-            self.virtual_machine.id,
-            "Virtual Machine ids do not match"
-        )
-        self.assertEqual(
-            vm.name,
-            self.virtual_machine.name,
-            "Virtual Machine names do not match"
-        )
-        self.assertEqual(
-            vm.state,
-            "Running",
-            msg="VM is not in Running state"
-        )
-
-    @attr(tags = ['advanced','basic','sg'], required_hardware="false")
-    def test_deploy_vm_multiple(self):
-        """Test Multiple Deploy Virtual Machine
-
-        # Validate the following:
-        # 1. deploy 2 virtual machines
-        # 2. listVirtualMachines using 'ids' parameter returns accurate information
-        """
-        self.virtual_machine = VirtualMachine.create(
-            self.apiclient,
-            self.testdata["virtual_machine"],
-            accountid=self.account.name,
-            zoneid=self.zone.id,
-            domainid=self.account.domainid,
-            serviceofferingid=self.service_offering.id,
-            templateid=self.template.id
-        )
-
-        self.virtual_machine2 = VirtualMachine.create(
-            self.apiclient,
-            self.testdata["virtual_machine2"],
-            accountid=self.account.name,
-            zoneid=self.zone.id,
-            domainid=self.account.domainid,
-            serviceofferingid=self.service_offering.id,
-            templateid=self.template.id
-        )
-
-        list_vms = VirtualMachine.list(self.apiclient, ids=[self.virtual_machine.id, self.virtual_machine2.id], listAll=True)
-        self.debug(
-            "Verify listVirtualMachines response for virtual machines: %s, %s" % (self.virtual_machine.id, self.virtual_machine2.id)
-        )
-        self.assertEqual(
-            isinstance(list_vms, list),
-            True,
-            "List VM response was not a valid list"
-        )
-        self.assertEqual(
-            len(list_vms),
-            2,
-            "List VM response was empty, expected 2 VMs"
-        )
-
-    def tearDown(self):
-        try:
-            cleanup_resources(self.apiclient, self.cleanup)
-        except Exception as e:
-            self.debug("Warning! Exception in tearDown: %s" % e)
-
-class TestDeployVMVolumeCreationFailure(cloudstackTestCase):
-    """Test VM deploy into user account with volume creation failure
-    """
-
-    def setUp(self):
-        self.testdata =  self.testClient.getParsedTestDataConfig()
-        self.apiclient = self.testClient.getApiClient()
-
-        # Get Zone, Domain and Default Built-in template
-        self.domain = get_domain(self.apiclient)
-        self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
-        self.testdata["mode"] = self.zone.networktype
-        self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"])
-
-        #create a user account
-        self.account = Account.create(
-            self.apiclient,
-            self.testdata["account"],
-            domainid=self.domain.id
-        )
-        #create a service offering
-        self.service_offering = ServiceOffering.create(
-            self.apiclient,
-            self.testdata["service_offerings"]["small"]
-        )
-        #create first VM
-        self.virtual_machine = VirtualMachine.create(
-            self.apiclient,
-            self.testdata["virtual_machine"],
-            accountid=self.account.name,
-            zoneid=self.zone.id,
-            domainid=self.account.domainid,
-            serviceofferingid=self.service_offering.id,
-            templateid=self.template.id)
-        #mock to simulate volume creation failure
-        self.mock_volume_failure = SimulatorMock.create(
-            apiclient=self.apiclient,
-            command="CopyCommand",
-            count=6)
-        #build cleanup list
-        self.cleanup = [
-            self.service_offering,
-            self.account,
-            self.mock_volume_failure
-        ]
-
-
-    @attr(tags = ['advanced'], required_hardware="false")
-    def test_deploy_vm_volume_creation_failure(self):
-        """Test Deploy Virtual Machine - volume creation failure and retry
-
-        # Validate the following:
-        # 1. 1st VM creation failed
-        # 2. Check there were 4 failed volume creation retries (mock count = (6-4) = 2)
-        # 3. 2nd VM creation succeeded
-        # 4. Check there were 2 failed volume creation retries (mock count = (2-2) = 0)
-        # 5. ListVM returns accurate information
-        """
-        self.virtual_machine = None
-        with self.assertRaises(Exception):
-            self.virtual_machine = VirtualMachine.create(
-                self.apiclient,
-                self.testdata["virtual_machine2"],
-                accountid=self.account.name,
-                zoneid=self.zone.id,
-                domainid=self.account.domainid,
-                serviceofferingid=self.service_offering.id,
-                templateid=self.template.id)
-
-        self.mock_volume_failure = self.mock_volume_failure.query(self.apiclient)
-        self.assertEqual(
-            self.mock_volume_failure.count,
-            2,
-            msg="Volume failure mock not executed")
-
-        self.virtual_machine = VirtualMachine.create(
-            self.apiclient,
-            self.testdata["virtual_machine3"],
-            accountid=self.account.name,
-            zoneid=self.zone.id,
-            domainid=self.account.domainid,
-            serviceofferingid=self.service_offering.id,
-            templateid=self.template.id)
-        list_vms = VirtualMachine.list(self.apiclient, id=self.virtual_machine.id)
-        self.assertTrue(isinstance(list_vms, list) and len(list_vms) > 0, msg="List VM response empty")
-        vm = list_vms[0]
-        self.assertEqual(
-            vm.id,
-            self.virtual_machine.id,
-            "VM ids do not match")
-        self.assertEqual(
-            vm.name,
-            self.virtual_machine.name,
-            "VM names do not match")
-        self.assertEqual(
-            vm.state,
-            "Running",
-            msg="VM is not in Running state")
-
-        self.mock_volume_failure = self.mock_volume_failure.query(self.apiclient)
-        self.assertEqual(
-            self.mock_volume_failure.count,
-            0,
-            msg="Volume failure mock not executed")
-
-    def tearDown(self):
-        try:
-            cleanup_resources(self.apiclient, self.cleanup)
-        except Exception as e:
-            self.debug("Warning! Exception in tearDown: %s" % e)
-
-
-class TestDeployVMStartFailure(cloudstackTestCase):
-    """Test VM deploy into user account with start operation failure
-    """
-
-    def setUp(self):
-        self.testdata = self.testClient.getParsedTestDataConfig()
-        self.apiclient = self.testClient.getApiClient()
-
-        # Get Zone, Domain and Default Built-in template
-        self.domain = get_domain(self.apiclient)
-        self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
-        self.testdata["mode"] = self.zone.networktype
-        self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"])
-
-        #create a user account
-        self.account = Account.create(
-            self.apiclient,
-            self.testdata["account"],
-            domainid=self.domain.id
-        )
-        #create a service offering
-        self.service_offering = ServiceOffering.create(
-            self.apiclient,
-            self.testdata["service_offerings"]["small"]
-        )
-        #create first VM
-        self.virtual_machine = VirtualMachine.create(
-            self.apiclient,
-            self.testdata["virtual_machine"],
-            accountid=self.account.name,
-            zoneid=self.zone.id,
-            domainid=self.account.domainid,
-            serviceofferingid=self.service_offering.id,
-            templateid=self.template.id)
-        #mock to simulate vm start failure
-        self.mock_start_failure = SimulatorMock.create(
-            apiclient=self.apiclient,
-            command="StartCommand",
-            count=6)
-        #build cleanup list
-        self.cleanup = [
-            self.service_offering,
-            self.account,
-            self.mock_start_failure
-        ]
-
-    @attr(tags = ['advanced'], required_hardware="false")
-    def test_deploy_vm_start_failure(self):
-        """Test Deploy Virtual Machine - start operation failure and retry
-
-        # Validate the following:
-        # 1. 1st VM creation failed
-        # 2. Check there were 4 failed start operation retries (mock count = (6-4) = 2)
-        # 3. 2nd VM creation succeeded
-        # 4. Check there were 2 failed start operation retries (mock count = (2-2) = 0)
-        # 5. ListVM returns accurate information
-        """
-        self.virtual_machine = None
-        with self.assertRaises(Exception):
-            self.virtual_machine = VirtualMachine.create(
-                self.apiclient,
-                self.testdata["virtual_machine2"],
-                accountid=self.account.name,
-                zoneid=self.zone.id,
-                domainid=self.account.domainid,
-                serviceofferingid=self.service_offering.id,
-                templateid=self.template.id)
-
-        self.mock_start_failure = self.mock_start_failure.query(self.apiclient)
-        self.assertEqual(
-            self.mock_start_failure.count,
-            2,
-            msg="Start failure mock not executed")
-
-        self.virtual_machine = VirtualMachine.create(
-            self.apiclient,
-            self.testdata["virtual_machine3"],
-            accountid=self.account.name,
-            zoneid=self.zone.id,
-            domainid=self.account.domainid,
-            serviceofferingid=self.service_offering.id,
-            templateid=self.template.id)
-        list_vms = VirtualMachine.list(self.apiclient, id=self.virtual_machine.id)
-        self.assertTrue(isinstance(list_vms, list) and len(list_vms) > 0, msg="List VM response empty")
-        vm = list_vms[0]
-        self.assertEqual(
-            vm.id,
-            self.virtual_machine.id,
-            "VM ids do not match")
-        self.assertEqual(
-            vm.name,
-            self.virtual_machine.name,
-            "VM names do not match")
-        self.assertEqual(
-            vm.state,
-            "Running",
-            msg="VM is not in Running state")
-
-        self.mock_start_failure = self.mock_start_failure.query(self.apiclient)
-        self.assertEqual(
-            self.mock_start_failure.count,
-            0,
-            msg="Start failure mock not executed")
-
-    def tearDown(self):
-        try:
-            cleanup_resources(self.apiclient, self.cleanup)
-        except Exception as e:
-            self.debug("Warning! Exception in tearDown: %s" % e)
-
-

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1e3a6897/test/integration/smoke/test_vm_ha.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_vm_ha.py b/test/integration/smoke/test_vm_ha.py
deleted file mode 100644
index c7d1648..0000000
--- a/test/integration/smoke/test_vm_ha.py
+++ /dev/null
@@ -1,202 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-#Test from the Marvin - Testing in Python wiki
-
-import time
-
-#All tests inherit from cloudstackTestCase
-from marvin.cloudstackTestCase import cloudstackTestCase
-
-#Import Integration Libraries
-
-#base - contains all resources as entities and defines create, delete, list operations on them
-from marvin.lib.base import Account, VirtualMachine, Cluster, Host, ServiceOffering, Configurations, SimulatorMock
-
-#utils - utility classes for common cleanup, external library wrappers etc
-from marvin.lib.utils import cleanup_resources, validateList
-
-#common - commonly used methods for all tests are listed here
-from marvin.lib.common import get_zone, get_domain, get_template
-from marvin.codes import PASS
-
-from nose.plugins.attrib import attr
-
-class TestDeployVMHA(cloudstackTestCase):
-    """Test VM HA
-    """
-
-    def setUp(self):
-        self.testdata = self.testClient.getParsedTestDataConfig()
-        self.apiclient = self.testClient.getApiClient()
-
-        # Get Zone, Domain and Default Built-in template
-        self.domain = get_domain(self.apiclient)
-        self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
-
-        self.testdata["mode"] = self.zone.networktype
-        self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"])
-
-        self.hosts = []
-        suitablecluster = None
-        clusters = Cluster.list(self.apiclient)
-        self.assertTrue(isinstance(clusters, list) and len(clusters) > 0, msg = "No clusters found")
-        for cluster in clusters:
-            self.hosts = Host.list(self.apiclient, clusterid=cluster.id, type='Routing')
-            if isinstance(self.hosts, list) and len(self.hosts) >= 2:
-                suitablecluster = cluster
-                break
-        self.assertEqual(validateList(self.hosts)[0], PASS, "hosts list validation failed")
-        if len(self.hosts) < 2:
-            self.skipTest("Atleast 2 hosts required in cluster for VM HA test")
-        #update host tags
-        for host in self.hosts:
-            Host.update(self.apiclient, id=host.id, hosttags=self.testdata["service_offerings"]["hasmall"]["hosttags"])
-
-        #create a user account
-        self.account = Account.create(
-            self.apiclient,
-            self.testdata["account"],
-            domainid=self.domain.id
-        )
-        #create a service offering
-        self.service_offering = ServiceOffering.create(
-            self.apiclient,
-            self.testdata["service_offerings"]["hasmall"]
-        )
-        #deploy ha vm
-        self.virtual_machine = VirtualMachine.create(
-            self.apiclient,
-            self.testdata["virtual_machine"],
-            accountid=self.account.name,
-            zoneid=self.zone.id,
-            domainid=self.account.domainid,
-            serviceofferingid=self.service_offering.id,
-            templateid=self.template.id
-        )
-        list_vms = VirtualMachine.list(self.apiclient, id=self.virtual_machine.id)
-        self.debug(
-            "Verify listVirtualMachines response for virtual machine: %s"\
-            % self.virtual_machine.id
-        )
-        self.assertTrue(isinstance(list_vms, list) and len(list_vms) == 1, msg = "List VM response was empty")
-        self.virtual_machine = list_vms[0]
-
-        self.mock_checkhealth = SimulatorMock.create(
-            apiclient=self.apiclient,
-            command="CheckHealthCommand",
-            zoneid=suitablecluster.zoneid,
-            podid=suitablecluster.podid,
-            clusterid=suitablecluster.id,
-            hostid=self.virtual_machine.hostid,
-            value="result:fail")
-        self.mock_ping = SimulatorMock.create(
-            apiclient=self.apiclient,
-            command="PingCommand",
-            zoneid=suitablecluster.zoneid,
-            podid=suitablecluster.podid,
-            clusterid=suitablecluster.id,
-            hostid=self.virtual_machine.hostid,
-            value="result:fail")
-        self.mock_checkvirtualmachine = SimulatorMock.create(
-            apiclient=self.apiclient,
-            command="CheckVirtualMachineCommand",
-            zoneid=suitablecluster.zoneid,
-            podid=suitablecluster.podid,
-            clusterid=suitablecluster.id,
-            hostid=self.virtual_machine.hostid,
-            value="result:fail")
-        self.mock_pingtest = SimulatorMock.create(
-            apiclient=self.apiclient,
-            command="PingTestCommand",
-            zoneid=suitablecluster.zoneid,
-            podid=suitablecluster.podid,
-            value="result:fail")
-        self.mock_checkonhost_list = []
-        for host in self.hosts:
-            if host.id != self.virtual_machine.hostid:
-                self.mock_checkonhost_list.append(SimulatorMock.create(
-                    apiclient=self.apiclient,
-                    command="CheckOnHostCommand",
-                    zoneid=suitablecluster.zoneid,
-                    podid=suitablecluster.podid,
-                    clusterid=suitablecluster.id,
-                    hostid=host.id,
-                    value="result:fail"))
-        #build cleanup list
-        self.cleanup = [
-            self.service_offering,
-            self.account,
-            self.mock_checkhealth,
-            self.mock_ping,
-            self.mock_checkvirtualmachine,
-            self.mock_pingtest
-        ]
-        self.cleanup = self.cleanup + self.mock_checkonhost_list
-
-    @attr(tags = ['advanced'], required_hardware="false")
-    def test_vm_ha(self):
-        """Test VM HA
-
-        # Validate the following:
-        # VM started on other host in cluster
-        """
-
-        #wait for VM to HA
-        ping_timeout = Configurations.list(self.apiclient, name="ping.timeout")
-        ping_interval = Configurations.list(self.apiclient, name="ping.interval")
-        total_duration = int(float(ping_timeout[0].value) * float(ping_interval[0].value))
-        time.sleep(total_duration)
-
-        duration = 0
-        vm = None
-        while duration < total_duration:
-            list_vms = VirtualMachine.list(self.apiclient, id=self.virtual_machine.id)
-            self.assertTrue(isinstance(list_vms, list) and len(list_vms) == 1, msg = "List VM response was empty")
-            vm = list_vms[0]
-            if vm.hostid != self.virtual_machine.hostid and vm.state == "Running":
-                break
-            else:
-                time.sleep(10)
-                duration = duration + 10
-
-        self.assertEqual(
-            vm.id,
-            self.virtual_machine.id,
-            "VM ids do not match")
-        self.assertEqual(
-            vm.name,
-            self.virtual_machine.name,
-            "VM names do not match")
-        self.assertEqual(
-            vm.state,
-            "Running",
-            msg="VM is not in Running state")
-        self.assertNotEqual(
-            vm.hostid,
-            self.virtual_machine.hostid,
-            msg="VM is not started on another host as part of HA")
-
-    def tearDown(self):
-        try:
-            for host in self.hosts:
-                Host.update(self.apiclient, id=host.id, hosttags="")
-
-            cleanup_resources(self.apiclient, self.cleanup)
-        except Exception as e:
-            self.debug("Warning! Exception in tearDown: %s" % e)
-

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1e3a6897/test/integration/smoke/test_vm_life_cycle.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py
index eef4dc1..f11eec9 100644
--- a/test/integration/smoke/test_vm_life_cycle.py
+++ b/test/integration/smoke/test_vm_life_cycle.py
@@ -50,7 +50,7 @@ class TestDeployVM(cloudstackTestCase):
         cls.services = testClient.getParsedTestDataConfig()
 
         # Get Zone, Domain and templates
-        domain = get_domain(cls.apiclient)
+        cls.domain = get_domain(cls.apiclient)
         cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
         cls.services['mode'] = cls.zone.networktype
 
@@ -80,7 +80,7 @@ class TestDeployVM(cloudstackTestCase):
         cls.account = Account.create(
             cls.apiclient,
             cls.services["account"],
-            domainid=domain.id
+            domainid=cls.domain.id
         )
         cls.debug(cls.account.id)
 
@@ -108,11 +108,12 @@ class TestDeployVM(cloudstackTestCase):
         try:
             cleanup_resources(cls.apiclient, cls.cleanup)
         except Exception as e:
-            cls.debug("Warning! Exception in tearDown: %s" % e)
+            raise Exception("Warning: Exception during cleanup : %s" % e)
 
     def setUp(self):
         self.apiclient = self.testClient.getApiClient()
         self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
 
 
     @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
@@ -200,8 +201,57 @@ class TestDeployVM(cloudstackTestCase):
         self.assertEqual(router.state, 'Running', msg="Router is not in running state")
         self.assertEqual(router.account, self.account.name, msg="Router does not belong to the account")
 
+    @attr(tags = ['advanced','basic','sg'], required_hardware="false")
+    def test_deploy_vm_multiple(self):
+        """Test Multiple Deploy Virtual Machine
+
+        # Validate the following:
+        # 1. deploy 2 virtual machines
+        # 2. listVirtualMachines using 'ids' parameter returns accurate information
+        """
+        account = Account.create(
+            self.apiclient,
+            self.services["account"],
+            domainid=self.domain.id
+        )
+        self.cleanup.append(account)
+        virtual_machine1 = VirtualMachine.create(
+            self.apiclient,
+            self.services["small"],
+            accountid=account.name,
+            domainid=account.domainid,
+            serviceofferingid=self.service_offering.id
+        )
+
+        virtual_machine2 = VirtualMachine.create(
+            self.apiclient,
+            self.services["small"],
+            accountid=account.name,
+            domainid=account.domainid,
+            serviceofferingid=self.service_offering.id
+        )
+
+        list_vms = VirtualMachine.list(self.apiclient, ids=[virtual_machine1.id, virtual_machine2.id], listAll=True)
+        self.debug(
+            "Verify listVirtualMachines response for virtual machines: %s, %s" % (self.virtual_machine.id, self.virtual_machine2.id)
+        )
+        self.assertEqual(
+            isinstance(list_vms, list),
+            True,
+            "List VM response was not a valid list"
+        )
+        self.assertEqual(
+            len(list_vms),
+            2,
+            "List VM response was empty, expected 2 VMs"
+        )
+
     def tearDown(self):
-        pass
+        try:
+            # Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
 
 
 class TestVMLifeCycle(cloudstackTestCase):
@@ -290,7 +340,10 @@ class TestVMLifeCycle(cloudstackTestCase):
     @classmethod
     def tearDownClass(cls):
         cls.apiclient = super(TestVMLifeCycle, cls).getClsTestClient().getApiClient()
-        cleanup_resources(cls.apiclient, cls._cleanup)
+        try:
+            cleanup_resources(cls.apiclient, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
     def setUp(self):
@@ -299,8 +352,11 @@ class TestVMLifeCycle(cloudstackTestCase):
         self.cleanup = []
 
     def tearDown(self):
-        #Clean up, terminate the created ISOs
-        cleanup_resources(self.apiclient, self.cleanup)
+        try:
+            #Clean up, terminate the created ISOs
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
 


Mime
View raw message