You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ta...@apache.org on 2015/01/13 10:50:06 UTC

[4/4] git commit: updated refs/heads/master to f11e570

CLOUDSTACK-8145: Adding new test to test blocker bugs and modifying other test case to work around the bug

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


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

Branch: refs/heads/master
Commit: f11e5707961f7a8e18238d06848d1bce6f0172ab
Parents: 9056e4c
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Fri Jan 9 15:41:03 2015 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Tue Jan 13 15:15:10 2015 +0530

----------------------------------------------------------------------
 test/integration/component/test_blocker_bugs.py | 146 ++++++++++++++++++-
 .../component/test_reset_ssh_keypair.py         |   6 +
 2 files changed, 150 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f11e5707/test/integration/component/test_blocker_bugs.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_blocker_bugs.py b/test/integration/component/test_blocker_bugs.py
index 8ba563f..3ea7545 100644
--- a/test/integration/component/test_blocker_bugs.py
+++ b/test/integration/component/test_blocker_bugs.py
@@ -106,7 +106,6 @@ class Services:
                         "sleep": 180,
                      }
 
-
 class TestTemplate(cloudstackTestCase):
 
     def setUp(self):
@@ -253,7 +252,6 @@ class TestTemplate(cloudstackTestCase):
                         )
         return
 
-
 class TestNATRules(cloudstackTestCase):
 
     @classmethod
@@ -1005,3 +1003,147 @@ class TestTemplates(cloudstackTestCase):
                             "Check the name of the template"
                         )
         return
+
+class TestDataPersistency(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.testClient = super(TestDataPersistency, cls).getClsTestClient()
+        cls.api_client = cls.testClient.getApiClient()
+
+        cls.services = cls.testClient.getParsedTestDataConfig()
+        # Get Zone, Domain and templates
+        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+        cls.domain = get_domain(cls.api_client)
+        cls.services['mode'] = cls.zone.networktype
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostype"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+
+        #Create an account, network, VM and IP addresses
+        cls.account = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     domainid=cls.domain.id
+                                     )
+
+        cls.userapiclient = cls.testClient.getUserApiClient(
+                            UserName=cls.account.name,
+                            DomainName=cls.account.domain)
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["virtual_machine"],
+                                    templateid=template.id,
+                                    accountid=cls.account.name,
+                                    domainid=cls.account.domainid,
+                                    serviceofferingid=cls.service_offering.id,
+                                    mode=cls.services["mode"]
+                                    )
+        cls.cleanup = [
+                       cls.account,
+                       cls.service_offering
+                       ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Clean up, terminate the created templates
+            cleanup_resources(cls.api_client, cls.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        return
+
+    def tearDown(self):
+        # No need
+        return
+
+    @attr(tags=["advanced", "basic", "advancedns", "eip"], required_hardware="true")
+    def test_01_data_persistency_root_disk(self):
+        """
+        Test the timing issue of root disk data sync
+
+        # 1. Write data to root disk of a VM
+        # 2. Create a template from the root disk of VM
+        # 3. Create a new VM from this template
+        # 4. Check that the data is present in the new VM
+
+        This is to test that data is persisted on root disk of VM or not
+        when template is created immediately from it
+        """
+
+        ssh = self.virtual_machine.get_ssh_client()
+
+        sampleText = "This is sample data"
+
+        cmds = [
+                "cd /root/",
+                "touch testFile.txt",
+                "chmod 600 testFile.txt",
+                "echo %s >> testFile.txt" % sampleText
+                ]
+        for c in cmds:
+            ssh.execute(c)
+
+        #Stop virtual machine
+        self.virtual_machine.stop(self.api_client)
+
+        list_volume = Volume.list(
+                            self.api_client,
+                            virtualmachineid=self.virtual_machine.id,
+                            type='ROOT',
+                            listall=True)
+
+        if isinstance(list_volume, list):
+            self.volume = list_volume[0]
+        else:
+            raise Exception(
+                "Exception: Unable to find root volume for VM: %s" %
+                self.virtual_machine.id)
+
+        self.services["template"]["ostype"] = self.services["ostype"]
+        #Create templates for Edit, Delete & update permissions testcases
+        customTemplate = Template.create(
+                self.userapiclient,
+                self.services["template"],
+                self.volume.id,
+                account=self.account.name,
+                domainid=self.account.domainid
+            )
+        self.cleanup.append(customTemplate)
+        # Delete the VM - No longer needed
+        self.virtual_machine.delete(self.apiclient)
+
+        virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    templateid=customTemplate.id,
+                                    accountid=self.account.name,
+                                    domainid=self.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    mode=self.services["mode"]
+                                    )
+
+        ssh = virtual_machine.get_ssh_client()
+
+        response = ssh.execute("cat /root/testFile.txt")
+        res = str(response[0])
+
+        self.assertEqual(res, sampleText, "The data %s does not match\
+                with sample test %s" %
+                (res, sampleText))
+        return

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f11e5707/test/integration/component/test_reset_ssh_keypair.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_reset_ssh_keypair.py b/test/integration/component/test_reset_ssh_keypair.py
index a2e743a..db7e9b8 100644
--- a/test/integration/component/test_reset_ssh_keypair.py
+++ b/test/integration/component/test_reset_ssh_keypair.py
@@ -200,6 +200,9 @@ class TestResetSSHKeypair(cloudstackTestCase):
             for c in cmds:
                 ssh.execute(c)
 
+            # Adding delay of 120 sec to avoid data loss due to timing issue
+            time.sleep(120)
+
             #Stop virtual machine
             cls.virtual_machine.stop(cls.api_client)
 
@@ -1031,6 +1034,9 @@ class TestResetSSHKeyUserRights(cloudstackTestCase):
         for c in cmds:
             ssh.execute(c)
 
+        # Adding delay of 120 sec to avoid data loss due to timing issue
+        time.sleep(120)
+
         try:
             #Stop virtual machine
             cls.virtual_machine.stop(cls.api_client)