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

    https://github.com/apache/cloudstack/pull/1516#discussion_r63894357
  
    --- Diff: test/integration/component/maint/test_capacity_host_delete.py ---
    @@ -0,0 +1,195 @@
    +# 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   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 from the Marvin - Testing in Python wiki
    +
    +# All tests inherit from cloudstackTestCase
    +from marvin.cloudstackTestCase import cloudstackTestCase, unittest
    +
    +# Import Integration Libraries
    +
    +# base - contains all resources as entities and defines create, delete,
    +# list operations on them
    +from marvin.lib.base import Host, Cluster, Zone, Pod
    +
    +# utils - utility classes for common cleanup, external library wrappers etc
    +from marvin.lib.utils import cleanup_resources
    +
    +# common - commonly used methods for all tests are listed here
    +from marvin.lib.common import get_zone, get_domain, list_hosts, get_pod
    +
    +from nose.plugins.attrib import attr
    +
    +import time
    +import logging
    +# These tests need to be run separately and not in parallel with other 
tests.
    +# Because it disables the host
    +# host_id column of op_host_capacity refers to host_id or a storage pool id
    +#
    +# This test is to make sure that Disable host only disables the capacities 
of type
    +# CPU and MEMORY
    +#
    +# TEST:
    +# Base Condition: There exists a host and storage pool with same id
    +#
    +# Steps:
    +# 1. Find a host and storage pool having same id
    +# 2. Disable the host
    +# 3. verify that the CPU(1) and MEMORY(0) capacity in op_host_capacity for 
above host
    +#    is disabled
    +# 4. verify that the STORAGE(3) capacity in op_host_capacity for storage 
pool with id
    +#    same as above host is not disabled
    +#
    +
    +def update_host(apiclient, state, host_id):
    +    """
    +    Function to Enable/Disable Host
    +    """
    +    host_status = Host.update(
    +        apiclient,
    +        id=host_id,
    +        allocationstate=state
    +    )
    +    return host_status.resourcestate
    +
    +
    +def check_db(self, host_state):
    +    """
    +    Function to check capacity_state in op_host_capacity table
    +    """
    +    capacity_state = self.dbclient.execute(
    +        "select capacity_state from op_host_capacity where host_id='%s' 
and capacity_type in (0,1) order by capacity_type asc;" %
    +        self.host_db_id[0][0])
    --- End diff --
    
    This check is not required. The check_db will only be invoked if there is a 
host_db_id, storage_pool_db_id and capacity check =3. 
    In my last check in I have added checks for this.


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