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

    https://github.com/apache/cloudstack/pull/242#discussion_r30214087
  
    --- Diff: test/integration/testpaths/testpath_disable_enable_zone.py ---
    @@ -0,0 +1,485 @@
    +# 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 cases for Disable enable Zone Test Path
    +"""
    +
    +from nose.plugins.attrib import attr
    +from marvin.cloudstackTestCase import cloudstackTestCase
    +from marvin.lib.utils import (cleanup_resources)
    +from marvin.lib.base import (Account,
    +                             VirtualMachine,
    +                             ServiceOffering,
    +                             Zone,
    +                             Template,
    +                             Snapshot,
    +                             Volume,
    +                             DiskOffering,
    +                             Iso
    +                             )
    +from marvin.lib.common import (get_domain,
    +                               get_zone,
    +                               get_template,
    +                               list_volumes,
    +                               list_snapshots,
    +                               get_builtin_template_info
    +                               )
    +
    +from marvin.cloudstackAPI import updateZone
    +import time
    +
    +class TestDisableEnableZone(cloudstackTestCase):
    +
    +    @classmethod
    +    def setUpClass(cls):
    +        testClient = super(TestDisableEnableZone, cls).getClsTestClient()
    +        cls.apiclient = testClient.getApiClient()
    +        cls.testdata = testClient.getParsedTestDataConfig()
    +        cls.hypervisor = cls.testClient.getHypervisorInfo()
    +
    +        # Get Zone, Domain and templates
    +        cls.domain = get_domain(cls.apiclient)
    +        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
    +
    +        cls.template = get_template(
    +            cls.apiclient,
    +            cls.zone.id,
    +            cls.testdata["ostype"])
    +
    +        cls._cleanup = []
    +
    +        try:
    +            cls.service_offering = ServiceOffering.create(
    +                cls.apiclient,
    +                cls.testdata["service_offering"],
    +            )
    +            cls._cleanup.append(cls.service_offering)
    +
    +            cls.disk_offering = DiskOffering.create(
    +                cls.apiclient,
    +                cls.testdata["disk_offering"],
    +            )
    +            cls._cleanup.append(cls.disk_offering)
    +
    +            # Create an account
    +            cls.account = Account.create(
    +                cls.apiclient,
    +                cls.testdata["account"],
    +                domainid=cls.domain.id
    +            )
    +            cls._cleanup.append(cls.account)
    +
    +            # Create user api client of the account
    +            cls.userapiclient = testClient.getUserApiClient(
    +                UserName=cls.account.name,
    +                DomainName=cls.account.domain
    +            )
    +
    +        except Exception as e:
    +            cls.tearDownClass()
    +            raise e
    +        return
    +
    +    @classmethod
    +    def tearDownClass(cls):
    +        try:
    +            pass
    +            cleanup_resources(cls.apiclient, cls._cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +
    +    def setUp(self):
    +        self.apiclient = self.testClient.getApiClient()
    +        self.dbclient = self.testClient.getDbConnection()
    +        self.cleanup = []
    +
    +    def tearDown(self):
    +        try:
    +            cleanup_resources(self.apiclient, self.cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +        return
    +
    +    @attr(tags=["advanced", "basic"],required_hardware=“true”)
    +    def test_01_disable_enable_zone(self):
    +        """snapshot hardning
    +            1. Disable zone and verify following things:
    +                For admin user:
    +                    1. Should be create to start/stop exsiting vms
    +                    2. Should be create to deploy new vm, 
snapshot,volume,template,iso in the same zone
    +                For Non-admin user:
    +                    1. Should be create to start/stop exsiting vms
    +                    2. Should not be create to deploy new vm, 
snapshot,volume,template,iso in the same zone
    +            2. Enable the above disabled zone and verify that:
    +                -All users should be create to deploy new vm, 
snapshot,volume,template,iso in the same zone
    +            3. Try to delete the zone and it should fail with error 
message:
    +                -"The zone is not deletable because there are servers 
running in this zone"
    +
    +        """
    +        # Step 1
    +        vm_user = 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,
    +            mode=self.zone.networktype)
    +
    +        vm_root = VirtualMachine.create(
    +            self.apiclient,
    +            self.testdata["small"],
    +            templateid=self.template.id,
    +            accountid=self.account.name,
    +            domainid=self.account.domainid,
    +            serviceofferingid=self.service_offering.id,
    +            zoneid=self.zone.id,
    +            mode=self.zone.networktype)
    +
    +        cmd = updateZone.updateZoneCmd()
    +        cmd.id = self.zone.id
    +        cmd.allocationstate = "Disabled"
    +        self.apiclient.updateZone(cmd)
    +        zoneList = Zone.list(self.apiclient, id=self.zone.id)
    +
    +        self.assertEqual(zoneList[0].allocationstate,
    +                         "Disabled",
    +                         "Check if the zone is in disabled state"
    +                         )
    +        # Verify the exsisting vms should be running
    --- End diff --
    
    Correct typo


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