Github user shwetaag commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/646#discussion_r36620849
  
    --- Diff: test/integration/component/maint/test_escalation_templates.py ---
    @@ -0,0 +1,394 @@
    +# 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.
    +
    +from marvin.cloudstackTestCase import cloudstackTestCase, unittest
    +from marvin.lib.base import (Account,
    +                             Domain, Template, 
Configurations,VirtualMachine,Snapshot,ServiceOffering
    +                             )
    +from marvin.lib.utils import (cleanup_resources, validateList)
    +from marvin.lib.common import (get_zone, get_template, 
get_builtin_template_info,update_resource_limit,list_volumes )
    +from nose.plugins.attrib import attr
    +from marvin.codes import PASS
    +from marvin.sshClient import SshClient
    +from marvin.cloudstackException import CloudstackAPIException
    +import time
    +
    +
    +class TestlistTemplates(cloudstackTestCase):
    +
    +    @classmethod
    +    def setUpClass(cls):
    +
    +        testClient = super(
    +            TestlistTemplates, cls).getClsTestClient()
    +        cls.apiclient = testClient.getApiClient()
    +        cls.testdata = testClient.getParsedTestDataConfig()
    +        cls.zone = get_zone(cls.apiclient, 
cls.testClient.getZoneForTests())
    +        cls.template = get_template(
    +                cls.apiclient,
    +                cls.zone.id,
    +                cls.testdata["ostype"]
    +            )
    +        cls.hypervisor = cls.testClient.getHypervisorInfo()
    +        builtin_info = get_builtin_template_info(cls.apiclient, 
cls.zone.id)
    +        cls.testdata["templates"]["url"] = builtin_info[0]
    +        cls.testdata["templates"]["hypervisor"] = builtin_info[1]
    +        cls.testdata["templates"]["format"] = builtin_info[2]
    +        if cls.zone.localstorageenabled:
    +            cls.storagetype = 'local'
    +            cls.testdata["service_offerings"]["tiny"]["storagetype"] = 
'local'
    +            cls.testdata["disk_offering"]["storagetype"] = 'local'
    +        else:
    +            cls.storagetype = 'shared'
    +            cls.testdata["service_offerings"]["tiny"]["storagetype"] = 
'shared'
    +            cls.testdata["disk_offering"]["storagetype"] = 'shared'
    +        cls.testdata["virtual_machine"]["hypervisor"] = cls.hypervisor
    +        cls.testdata["virtual_machine"]["zoneid"] = cls.zone.id
    +        cls.testdata["virtual_machine"]["template"] = cls.template.id
    +        cls.testdata["custom_volume"]["zoneid"] = cls.zone.id
    +        cls.service_offering = ServiceOffering.create(
    +                cls.apiclient,
    +                cls.testdata["service_offerings"]["tiny"]
    +            )
    +        cls.mgtSvrDetails = cls.config.__dict__["mgtSvr"][0].__dict__
    +        cls.cleanup = []
    +
    +        # Create 1 domain admin account
    +
    +        cls.domain = Domain.create(
    +            cls.apiclient,
    +            cls.testdata["domain"])
    +
    +        cls.account = Account.create(
    +            cls.apiclient,
    +            cls.testdata["account"],
    +            admin=True,
    +            domainid=cls.domain.id)
    +
    +        cls.debug("Created account %s in domain %s" %
    +                  (cls.account.name, cls.domain.id))
    +
    +        cls.cleanup.append(cls.account)
    +        cls.cleanup.append(cls.domain)
    +
    +    @classmethod
    +    def tearDownClass(cls):
    +        try:
    +            # Cleanup resources used
    +            cleanup_resources(cls.apiclient, cls.cleanup)
    +
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +        return
    +    def RestartServers(self):
    +        """ Restart management server and usage server """
    +
    +        sshClient = SshClient(
    +            self.mgtSvrDetails["mgtSvrIp"],
    +            22,
    +            self.mgtSvrDetails["user"],
    +            self.mgtSvrDetails["passwd"]
    +        )
    +        command = "service cloudstack-management restart"
    +        sshClient.execute(command)
    +        return
    +
    +    def updateConfigurAndRestart(self,name, value):
    +        Configurations.update(self.apiclient,
    +                              name,value )
    +        self.RestartServers()
    +        time.sleep(self.testdata["sleep"])
    +      
    +      
    +    @attr(tags=["advanced", "basic"], required_hardware="true")
    +    def test_01_CS40139_listtemplate_with_different_pagesize(self):
    +        """
    +        @Desc verify list template gives same result with 
pagesize=500&page=(1,2) and pagesize=1000 when
    +        there are around 1000 templates
    +        @steps:
    +        1: register around 850 templates
    +        2. call list template api with pagesize=500&page=1 and then page=2
    +        3.call list template api with pagesize=1000 & page=1
    +        4. Verify list template returns same list of template in both step 
2 and 3
    +        """
    +        if self.hypervisor.lower() not in ['xenserver']:
    +            raise unittest.SkipTest("hypervisor in not xenserver")
    +            return
    +        self.updateConfigurAndRestart("default.page.size", "1000")
    +        self.debug("Updating template resource limit for account: %s" %
    +                                                self.account.name)
    +        # Set usage_template=1000 for Account 1
    +        update_resource_limit(
    +                              self.apiclient,
    +                              4, # Template
    +                              account=self.account.name,
    +                              domainid=self.domain.id,
    +                              max=1000
    +                              )
    +        
    +        self.testdata["template"]["url"]= 
"http://10.147.28.7/templates/DOS.vhd.bz2";
    --- End diff --
    
    Done


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to