tests/manage/monitoring/conftest.py
def workload_stop_ceph_mgr(measurement_dir):
    """
    Downscales Ceph Manager deployment, measures the time when it was
    downscaled and monitors alerts that were triggered during this event.

    Returns:
        dict: Contains information about `start` and `stop` time for stopping
            Ceph Manager pod
    """
    oc = ocp.OCP(
        kind=constants.DEPLOYMENT,
        namespace=config.ENV_DATA['cluster_namespace']
    )
    mgr_deployments = oc.get(selector=constants.MGR_APP_LABEL)['items']
    mgr = mgr_deployments[0]['metadata']['name']

    def stop_mgr():
        """
        Downscale Ceph Manager deployment for 6 minutes. First 5 minutes
        the alert should be in 'Pending'.
        After 5 minutes it should be 'Firing'.
        This configuration of monitoring can be observed in ceph-mixins which
        are used in the project:
            https://github.com/ceph/ceph-mixins/blob/d22afe8c0da34490cb77e52a202eefcf4f62a869/config.libsonnet#L25

        Returns:
            str: Name of downscaled deployment
        """
        # run_time of operation
        run_time = 60 * 6
        nonlocal oc
        nonlocal mgr
        logger.info(f"Downscaling deployment {mgr} to 0")
        oc.exec_oc_cmd(f"scale --replicas=0 deployment/{mgr}")
        logger.info(f"Waiting for {run_time} seconds")
        time.sleep(run_time)
        return oc.get(mgr)

    test_file = os.path.join(measurement_dir, 'workload_stop_ceph_mgr.json')
    measured_op = measure_operation(stop_mgr, test_file)
    logger.info(f"Upscaling deployment {mgr} back to 1")
    oc.exec_oc_cmd(f"scale --replicas=1 deployment/{mgr}")
    return measured_op

    Downscales Ceph Manager deployment, measures the time when it was
    downscaled and monitors alerts that were triggered during this event.

    Returns:
        dict: Contains information about `start` and `stop` time for stopping
            Ceph Manager pod
    
Downscales Ceph Manager deployment, measures the time when it was
downscaled and monitors alerts that were triggered during this event.
Downscales Ceph Manager deployment measures the time when it was downscaled and monitors alerts that were triggered during this event .
def workload_stop_ceph_mgr(measurement_dir):
    oc = ocp.OCP(
        kind=constants.DEPLOYMENT,
        namespace=config.ENV_DATA['cluster_namespace']
    )
    mgr_deployments = oc.get(selector=constants.MGR_APP_LABEL)['items']
    mgr = mgr_deployments[0]['metadata']['name']
    def stop_mgr():
        run_time = 60 * 6
        nonlocal oc
        nonlocal mgr
        logger.info(f"Downscaling deployment {mgr} to 0")
        oc.exec_oc_cmd(f"scale --replicas=0 deployment/{mgr}")
        logger.info(f"Waiting for {run_time} seconds")
        time.sleep(run_time)
        return oc.get(mgr)
    test_file = os.path.join(measurement_dir, 'workload_stop_ceph_mgr.json')
    measured_op = measure_operation(stop_mgr, test_file)
    logger.info(f"Upscaling deployment {mgr} back to 1")
    oc.exec_oc_cmd(f"scale --replicas=1 deployment/{mgr}")
    return measured_op
def workload_stop_ceph_mgr ( measurement_dir ) : oc = ocp . OCP ( kind = constants . DEPLOYMENT , namespace = config . ENV_DATA [ 'cluster_namespace' ] ) mgr_deployments = oc . get ( selector = constants . MGR_APP_LABEL ) [ 'items' ] mgr = mgr_deployments [ 0 ] [ 'metadata' ] [ 'name' ] def stop_mgr ( ) : """
        Downscale Ceph Manager deployment for 6 minutes. First 5 minutes
        the alert should be in 'Pending'.
        After 5 minutes it should be 'Firing'.
        This configuration of monitoring can be observed in ceph-mixins which
        are used in the project:
            https://github.com/ceph/ceph-mixins/blob/d22afe8c0da34490cb77e52a202eefcf4f62a869/config.libsonnet#L25

        Returns:
            str: Name of downscaled deployment
        """ run_time = 60 * 6 nonlocal oc nonlocal mgr logger . info ( f"Downscaling deployment {mgr} to 0" ) oc . exec_oc_cmd ( f"scale --replicas=0 deployment/{mgr}" ) logger . info ( f"Waiting for {run_time} seconds" ) time . sleep ( run_time ) return oc . get ( mgr ) test_file = os . path . join ( measurement_dir , 'workload_stop_ceph_mgr.json' ) measured_op = measure_operation ( stop_mgr , test_file ) logger . info ( f"Upscaling deployment {mgr} back to 1" ) oc . exec_oc_cmd ( f"scale --replicas=1 deployment/{mgr}" ) return measured_op
Downscales Ceph Manager deployment, measures the time when it was
downscaled and monitors alerts that were triggered during this event.
Downscales Ceph Manager deployment measures the time when it was downscaled and monitors alerts that were triggered during this event .
"""
    Downscales Ceph Manager deployment, measures the time when it was
    downscaled and monitors alerts that were triggered during this event.

    Returns:
        dict: Contains information about `start` and `stop` time for stopping
            Ceph Manager pod
    """ """
        Downscale Ceph Manager deployment for 6 minutes. First 5 minutes
        the alert should be in 'Pending'.
        After 5 minutes it should be 'Firing'.
        This configuration of monitoring can be observed in ceph-mixins which
        are used in the project:
            https://github.com/ceph/ceph-mixins/blob/d22afe8c0da34490cb77e52a202eefcf4f62a869/config.libsonnet#L25

        Returns:
            str: Name of downscaled deployment
        """ # run_time of operation
Contains information about `start` and `stop` time for stopping
Ceph Manager pod
Contains information about ` start ` and ` stop ` time for stopping Ceph Manager pod
dict
measurement_dir