You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by manasaveloori <gi...@git.apache.org> on 2015/04/24 07:40:30 UTC

[GitHub] cloudstack pull request: To Verfiy that list templates by domain a...

GitHub user manasaveloori opened a pull request:

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

    To Verfiy that list templates by domain admin is not listing the templates of other domains...

    results:
    
    test_listtemplate (integration.component.test.TestlistTemplatesDomainAdmin) ... === TestName: test_listtemplate | Status : SUCCESS ===
    ok
    
    ----------------------------------------------------------------------
    Ran 1 test in 307.996s
    
    OK


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

    $ git pull https://github.com/manasaveloori/cloudstack local

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

    https://github.com/apache/cloudstack/pull/189.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 #189
    
----
commit f8659eb0079c48194e264c6400b001ea7a314518
Author: manasaVeloori <ma...@gmail.com>
Date:   2015-04-24T05:35:22Z

    To Verfiy that list templates by domain admin is not listing the templates of other domains

----


---
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: To Verfiy that list templates by domain a...

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

    https://github.com/apache/cloudstack/pull/189#issuecomment-115222723
  
    @gauravaradhye will you do the honors?


---
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: To Verfiy that list templates by domain a...

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

    https://github.com/apache/cloudstack/pull/189#issuecomment-121830729
  
    Patch fails, file already exists? Please rebase and push again, or close PR if this is already merged on master in some other PR


---
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: To Verfiy that list templates by domain a...

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

    https://github.com/apache/cloudstack/pull/189#discussion_r29025553
  
    --- Diff: test/integration/component/test_escalation_listTemplateDomainAdmin.py ---
    @@ -0,0 +1,157 @@
    +
    +# 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
    +from marvin.lib.base import (Account,
    +                             Domain, Template
    +                             )
    +from marvin.lib.utils import (cleanup_resources)
    +from marvin.lib.common import (get_zone, get_builtin_template_info)
    +from nose.plugins.attrib import attr
    +import time
    +
    +
    +class TestlistTemplatesDomainAdmin(cloudstackTestCase):
    +
    +    @classmethod
    +    def setUpClass(cls):
    +
    +        testClient = super(
    +            TestlistTemplatesDomainAdmin, cls).getClsTestClient()
    +        cls.apiclient = testClient.getApiClient()
    +        cls.testdata = testClient.getParsedTestDataConfig()
    +        cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
    +        cls.hypervisor = cls.testClient.getHypervisorInfo()
    +        builtin_info = get_builtin_template_info(cls.apiclient, cls.zone.id)
    +        cls.testdata["privatetemplate"]["url"] = builtin_info[0]
    +        cls.testdata["privatetemplate"]["hypervisor"] = builtin_info[1]
    +        cls.testdata["privatetemplate"]["format"] = builtin_info[2]
    +        cls.cleanup = []
    +
    +# Create 2 domain admin accounts
    +
    +        cls.domain1 = Domain.create(
    +            cls.apiclient,
    +            cls.testdata["domain"])
    +
    +        cls.domain2 = Domain.create(
    +            cls.apiclient,
    +            cls.testdata["domain"])
    +
    +        cls.account1 = Account.create(
    +            cls.apiclient,
    +            cls.testdata["account"],
    +            admin=True,
    +            domainid=cls.domain1.id)
    +
    +        cls.account2 = Account.create(
    +            cls.apiclient,
    +            cls.testdata["account2"],
    +            admin=True,
    +            domainid=cls.domain2.id)
    +
    +        cls.debug("Created account %s in domain %s" %
    +                  (cls.account1.name, cls.domain1.id))
    +        cls.debug("Created account %s in domain %s" %
    +                  (cls.account2.name, cls.domain2.id))
    +
    +        cls.cleanup.append(cls.account1)
    +        cls.cleanup.append(cls.account2)
    +        cls.cleanup.append(cls.domain1)
    +        cls.cleanup.append(cls.domain2)
    +
    +    @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
    +
    +# test that the template register under root/domain1->account1 is not
    +# listed under root/domain2->account2
    +
    +    @attr(tags=["advanced", "basic"], required_hardware="true")
    +    def test_listtemplate(self):
    +
    +        # Register template under one domain admin(root/domain1->account 1)
    +
    +        template_register = Template.register(
    +            self.apiclient,
    +            self.testdata["privatetemplate"],
    +            zoneid=self.zone.id,
    +            hypervisor=self.hypervisor,
    +            account=self.account1.name,
    +            domainid=self.domain1.id)
    +
    +        template_register.download(self.apiclient)
    +        # self.cleanup.append(self.template_register)
    +
    +        time.sleep(self.testdata["sleep"])
    +        timeout = self.testdata["timeout"]
    +        while True:
    +            listTemplateResponse = Template.list(
    +                self.apiclient,
    +                templatefilter="all",
    +                id=template_register.id,
    +                account=self.account1.name,
    +                domainid=self.domain1.id
    +            )
    +            if isinstance(listTemplateResponse, list):
    +                break
    +            elif timeout == 0:
    +                raise Exception("list template failed")
    +
    +            time.sleep(10)
    +            timeout = timeout - 1
    +
    +            self.assertEqual(
    +                isinstance(listTemplateResponse, list),
    --- End diff --
    
    isinstance and len() check for list can be combined by using validateList method from common.py. Use only single method.


---
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: To Verfiy that list templates by domain a...

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

    https://github.com/apache/cloudstack/pull/189#issuecomment-121830270
  
    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: To Verfiy that list templates by domain a...

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

    https://github.com/apache/cloudstack/pull/189#discussion_r29025564
  
    --- Diff: test/integration/component/test_escalation_listTemplateDomainAdmin.py ---
    @@ -0,0 +1,157 @@
    +
    +# 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
    +from marvin.lib.base import (Account,
    +                             Domain, Template
    +                             )
    +from marvin.lib.utils import (cleanup_resources)
    +from marvin.lib.common import (get_zone, get_builtin_template_info)
    +from nose.plugins.attrib import attr
    +import time
    +
    +
    +class TestlistTemplatesDomainAdmin(cloudstackTestCase):
    +
    +    @classmethod
    +    def setUpClass(cls):
    +
    +        testClient = super(
    +            TestlistTemplatesDomainAdmin, cls).getClsTestClient()
    +        cls.apiclient = testClient.getApiClient()
    +        cls.testdata = testClient.getParsedTestDataConfig()
    +        cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
    +        cls.hypervisor = cls.testClient.getHypervisorInfo()
    +        builtin_info = get_builtin_template_info(cls.apiclient, cls.zone.id)
    +        cls.testdata["privatetemplate"]["url"] = builtin_info[0]
    +        cls.testdata["privatetemplate"]["hypervisor"] = builtin_info[1]
    +        cls.testdata["privatetemplate"]["format"] = builtin_info[2]
    +        cls.cleanup = []
    +
    +# Create 2 domain admin accounts
    +
    +        cls.domain1 = Domain.create(
    +            cls.apiclient,
    +            cls.testdata["domain"])
    +
    +        cls.domain2 = Domain.create(
    +            cls.apiclient,
    +            cls.testdata["domain"])
    +
    +        cls.account1 = Account.create(
    +            cls.apiclient,
    +            cls.testdata["account"],
    +            admin=True,
    +            domainid=cls.domain1.id)
    +
    +        cls.account2 = Account.create(
    +            cls.apiclient,
    +            cls.testdata["account2"],
    +            admin=True,
    +            domainid=cls.domain2.id)
    +
    +        cls.debug("Created account %s in domain %s" %
    +                  (cls.account1.name, cls.domain1.id))
    +        cls.debug("Created account %s in domain %s" %
    +                  (cls.account2.name, cls.domain2.id))
    +
    +        cls.cleanup.append(cls.account1)
    +        cls.cleanup.append(cls.account2)
    +        cls.cleanup.append(cls.domain1)
    +        cls.cleanup.append(cls.domain2)
    +
    +    @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
    +
    +# test that the template register under root/domain1->account1 is not
    +# listed under root/domain2->account2
    +
    +    @attr(tags=["advanced", "basic"], required_hardware="true")
    +    def test_listtemplate(self):
    +
    +        # Register template under one domain admin(root/domain1->account 1)
    +
    +        template_register = Template.register(
    +            self.apiclient,
    +            self.testdata["privatetemplate"],
    +            zoneid=self.zone.id,
    +            hypervisor=self.hypervisor,
    +            account=self.account1.name,
    +            domainid=self.domain1.id)
    +
    +        template_register.download(self.apiclient)
    +        # self.cleanup.append(self.template_register)
    +
    +        time.sleep(self.testdata["sleep"])
    +        timeout = self.testdata["timeout"]
    +        while True:
    +            listTemplateResponse = Template.list(
    +                self.apiclient,
    +                templatefilter="all",
    +                id=template_register.id,
    +                account=self.account1.name,
    +                domainid=self.domain1.id
    +            )
    +            if isinstance(listTemplateResponse, list):
    +                break
    +            elif timeout == 0:
    +                raise Exception("list template failed")
    +
    +            time.sleep(10)
    +            timeout = timeout - 1
    +
    +            self.assertEqual(
    +                isinstance(listTemplateResponse, list),
    +                True,
    +                "Check for list template response return valid data")
    +
    +            self.assertNotEqual(
    +                len(listTemplateResponse),
    +                0,
    +                "Check template available in List Templates")
    +
    +            template_response = listTemplateResponse[0]
    +            self.assertEqual(
    +                template_response.isready,
    +                True,
    +                "Template state is not ready, it is %s" % template_response.isready
    +            )
    +
    +        listtemplate = Template.list(
    +            self.apiclient,
    +            zoneid=self.zone.id,
    +            hypervisor=self.hypervisor,
    +            account=self.account2.name,
    +            domainid=self.account2.domainid,
    +            templatefilter=self.testdata["templatefilter"]
    +
    +        )
    +
    +        self.assertEqual(
    +            listtemplate,
    +            None,
    +            "Check templates are not listed"
    +        )
    +        return
    --- End diff --
    
    All other changes looks good.


---
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: To Verfiy that list templates by domain a...

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

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


---
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.
---