You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by pritisarap12 <gi...@git.apache.org> on 2015/08/11 10:52:31 UTC

[GitHub] cloudstack pull request: CLOUDSTACK-8723: Verify API call "listUsa...

GitHub user pritisarap12 opened a pull request:

    https://github.com/apache/cloudstack/pull/675

    CLOUDSTACK-8723: Verify API call "listUsageRecords" returns usage of new volume created after restore VM

    After restoring a running VM current ROOT disk gets destroyed and new ROOT disk gets created.
    This testcase is to check if volume usage of this newly created volume is listed in listUsageRecords API.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/pritisarap12/cloudstack CLOUDSTACK-8723-Verify-API-call-listUsageRecords-returns-usage-of-new-volume-created-after-restore-VM

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cloudstack/pull/675.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #675
    
----
commit c7e30029c17cc9c0d1f72803da481cc896ecc5e7
Author: Priti Sarap <pr...@clogeny.com>
Date:   2015-08-11T08:45:13Z

    CLOUDSTACK-8723: Verify API call "listUsageRecords" returns usage of new volume created after restore VM

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8723: Verify API call "listUsa...

Posted by nitt10prashant <gi...@git.apache.org>.
Github user nitt10prashant commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/675#discussion_r36732367
  
    --- Diff: test/integration/testpaths/testpath_usage.py ---
    @@ -2879,6 +2882,60 @@ def test_07_positive_tests_usage(self):
             # aggregation period and current period will give the network usage
             return
     
    +    @attr(tags=["advanced", "basic"], required_hardware="false")
    +    def test_08_checkNewVolumein_listUsageRecords(self):
    +        """ Test case to check if new volume crated after
    +        restore VM is listed in listUsageRecords
    +        # 1. Launch a VM
    +        # 2. Restore the VM
    +        # 3. Check if the new volume created is listed in listUsageRecords API
    +        """
    +
    +        # Step 1
    +        vm_cluster = VirtualMachine.create(
    +            self.userapiclient,
    +            self.testdata["small"],
    +            templateid=self.template.id,
    +            accountid=self.account.name,
    +            domainid=self.account.domainid,
    +            serviceofferingid=self.service_offering.id,
    +            zoneid=self.zone.id,
    +        )
    +
    +        volumes_root_list = list_volumes(
    +            self.apiclient,
    +            virtualmachineid=vm_cluster.id,
    +            type='ROOT',
    +            listall=True
    +        )
    +
    +        root_volume = volumes_root_list[0]
    +
    +        # Step 2
    +        vm_cluster.restore(self.apiclient)
    +
    +        qresultset = self.dbclient.execute(
    +            "select id from volumes where name='%s' and state='Ready';" %
    +            root_volume.name)
    +
    +        self.assertNotEqual(
    +            len(qresultset),
    +            0,
    +            "Check DB Query result set"
    +        )
    +
    +        volumeCheck = "Volume Id: " + str(qresultset[0][0]) + " usage time"
    +
    +        response = self.listUsageRecords(usagetype=6)
    +        self.assertEqual(response[0], PASS, response[1])
    +        UsageRecords = [record for record in response[1]
    +                        if volumeCheck in record.description]
    +        # Step 3
    +        self.assertNotEqual(
    --- End diff --
    
    even  if  UsageRecords is empty test case will pass , is that we are expecting ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8723: Verify API call "listUsa...

Posted by bhaisaab <gi...@git.apache.org>.
Github user bhaisaab commented on the pull request:

    https://github.com/apache/cloudstack/pull/675#issuecomment-134919453
  
    LGTM


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8723: Verify API call "listUsa...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cloudstack/pull/675


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Re: [GitHub] cloudstack pull request: CLOUDSTACK-8723: Verify API call "listUsa...

Posted by Sanjeev N <sa...@apache.org>.
LGTM!!

On Tue, Aug 11, 2015 at 4:56 PM, pritisarap12 <gi...@git.apache.org> wrote:

> Github user pritisarap12 commented on a diff in the pull request:
>
>     https://github.com/apache/cloudstack/pull/675#discussion_r36734678
>
>     --- Diff: test/integration/testpaths/testpath_usage.py ---
>     @@ -2879,6 +2882,60 @@ def test_07_positive_tests_usage(self):
>              # aggregation period and current period will give the network
> usage
>              return
>
>     +    @attr(tags=["advanced", "basic"], required_hardware="false")
>     +    def test_08_checkNewVolumein_listUsageRecords(self):
>     +        """ Test case to check if new volume crated after
>     +        restore VM is listed in listUsageRecords
>     +        # 1. Launch a VM
>     +        # 2. Restore the VM
>     +        # 3. Check if the new volume created is listed in
> listUsageRecords API
>     +        """
>     +
>     +        # Step 1
>     +        vm_cluster = VirtualMachine.create(
>     +            self.userapiclient,
>     +            self.testdata["small"],
>     +            templateid=self.template.id,
>     +            accountid=self.account.name,
>     +            domainid=self.account.domainid,
>     +            serviceofferingid=self.service_offering.id,
>     +            zoneid=self.zone.id,
>     +        )
>     +
>     +        volumes_root_list = list_volumes(
>     +            self.apiclient,
>     +            virtualmachineid=vm_cluster.id,
>     +            type='ROOT',
>     +            listall=True
>     +        )
>     +
>     +        root_volume = volumes_root_list[0]
>     +
>     +        # Step 2
>     +        vm_cluster.restore(self.apiclient)
>     +
>     +        qresultset = self.dbclient.execute(
>     +            "select id from volumes where name='%s' and
> state='Ready';" %
>     +            root_volume.name)
>     +
>     +        self.assertNotEqual(
>     +            len(qresultset),
>     +            0,
>     +            "Check DB Query result set"
>     +        )
>     +
>     +        volumeCheck = "Volume Id: " + str(qresultset[0][0]) + " usage
> time"
>     +
>     +        response = self.listUsageRecords(usagetype=6)
>     +        self.assertEqual(response[0], PASS, response[1])
>     +        UsageRecords = [record for record in response[1]
>     +                        if volumeCheck in record.description]
>     +        # Step 3
>     +        self.assertNotEqual(
>     --- End diff --
>
>     No, In step 3 we are verifying that UsageRecords should not be None.
>     or I have updated test case to fail it if UsageRecords  is empty.
>
>
> ---
> If your project is set up for it, you can reply to this email and have your
> reply appear on GitHub as well. If your project does not have this feature
> enabled and wishes so, or if the feature is enabled but not working, please
> contact infrastructure at infrastructure@apache.org or file a JIRA ticket
> with INFRA.
> ---
>

[GitHub] cloudstack pull request: CLOUDSTACK-8723: Verify API call "listUsa...

Posted by pritisarap12 <gi...@git.apache.org>.
Github user pritisarap12 commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/675#discussion_r36734678
  
    --- Diff: test/integration/testpaths/testpath_usage.py ---
    @@ -2879,6 +2882,60 @@ def test_07_positive_tests_usage(self):
             # aggregation period and current period will give the network usage
             return
     
    +    @attr(tags=["advanced", "basic"], required_hardware="false")
    +    def test_08_checkNewVolumein_listUsageRecords(self):
    +        """ Test case to check if new volume crated after
    +        restore VM is listed in listUsageRecords
    +        # 1. Launch a VM
    +        # 2. Restore the VM
    +        # 3. Check if the new volume created is listed in listUsageRecords API
    +        """
    +
    +        # Step 1
    +        vm_cluster = VirtualMachine.create(
    +            self.userapiclient,
    +            self.testdata["small"],
    +            templateid=self.template.id,
    +            accountid=self.account.name,
    +            domainid=self.account.domainid,
    +            serviceofferingid=self.service_offering.id,
    +            zoneid=self.zone.id,
    +        )
    +
    +        volumes_root_list = list_volumes(
    +            self.apiclient,
    +            virtualmachineid=vm_cluster.id,
    +            type='ROOT',
    +            listall=True
    +        )
    +
    +        root_volume = volumes_root_list[0]
    +
    +        # Step 2
    +        vm_cluster.restore(self.apiclient)
    +
    +        qresultset = self.dbclient.execute(
    +            "select id from volumes where name='%s' and state='Ready';" %
    +            root_volume.name)
    +
    +        self.assertNotEqual(
    +            len(qresultset),
    +            0,
    +            "Check DB Query result set"
    +        )
    +
    +        volumeCheck = "Volume Id: " + str(qresultset[0][0]) + " usage time"
    +
    +        response = self.listUsageRecords(usagetype=6)
    +        self.assertEqual(response[0], PASS, response[1])
    +        UsageRecords = [record for record in response[1]
    +                        if volumeCheck in record.description]
    +        # Step 3
    +        self.assertNotEqual(
    --- End diff --
    
    No, In step 3 we are verifying that UsageRecords should not be None.
    or I have updated test case to fail it if UsageRecords  is empty.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8723: Verify API call "listUsa...

Posted by nitt10prashant <gi...@git.apache.org>.
Github user nitt10prashant commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/675#discussion_r36731289
  
    --- Diff: test/integration/testpaths/testpath_usage.py ---
    @@ -2879,6 +2882,60 @@ def test_07_positive_tests_usage(self):
             # aggregation period and current period will give the network usage
             return
     
    +    @attr(tags=["advanced", "basic"], required_hardware="false")
    +    def test_08_checkNewVolumein_listUsageRecords(self):
    +        """ Test case to check if new volume crated after
    +        restore VM is listed in listUsageRecords
    +        # 1. Launch a VM
    +        # 2. Restore the VM
    +        # 3. Check if the new volume created is listed in listUsageRecords API
    +        """
    +
    +        # Step 1
    +        vm_cluster = VirtualMachine.create(
    +            self.userapiclient,
    +            self.testdata["small"],
    +            templateid=self.template.id,
    +            accountid=self.account.name,
    +            domainid=self.account.domainid,
    +            serviceofferingid=self.service_offering.id,
    +            zoneid=self.zone.id,
    +        )
    +
    +        volumes_root_list = list_volumes(
    +            self.apiclient,
    +            virtualmachineid=vm_cluster.id,
    +            type='ROOT',
    +            listall=True
    +        )
    --- End diff --
    
    use validate list  


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---