@pytest.mark.parametrize(argnames=['interface_type', 'bulk_size'], argvalues=[pytest.param(*[constants.CEPHBLOCKPOOL, 120]), pytest.param(*[constants.CEPHBLOCKPOOL, 240]), pytest.param(*[constants.CEPHFILESYSTEM, 120]), pytest.param(*[constants.CEPHFILESYSTEM, 240])])
@pytest.mark.usefixtures(base_setup.__name__)
@polarion_id('OCS-1620')
def test_bulk_pod_attach_performance(self, teardown_factory, bulk_size):
    '\n        Measures pods attachment time in bulk_size bulk\n\n        Args:\n            teardown_factory: A fixture used when we want a new resource that was created during the tests\n                               to be removed in the teardown phase.\n            bulk_size: Size of the bulk to be tested\n        Returns:\n\n        '
    test_start_time = PASTest.get_time()
    log.info(f'Start creating bulk of new {bulk_size} PVCs')
    (pvc_objs, _) = helpers.create_multiple_pvcs(sc_name=self.sc_obj.name, namespace=self.namespace, number_of_pvc=bulk_size, size=self.pvc_size, burst=True)
    for pvc_obj in pvc_objs:
        pvc_obj.reload()
        teardown_factory(pvc_obj)
    with ThreadPoolExecutor(max_workers=5) as executor:
        for pvc_obj in pvc_objs:
            executor.submit(helpers.wait_for_resource_state, pvc_obj, constants.STATUS_BOUND)
            executor.submit(pvc_obj.reload)
    start_time = helpers.get_provision_time(self.interface, pvc_objs, status='start')
    end_time = helpers.get_provision_time(self.interface, pvc_objs, status='end')
    total_time = (end_time - start_time).total_seconds()
    log.info(f'{self.interface}: Bulk of {bulk_size} PVCs creation time is {total_time} seconds.')
    pvc_names_list = []
    for pvc_obj in pvc_objs:
        pvc_names_list.append(pvc_obj.name)
    log.info(f'{self.interface} : Before pod attach')
    bulk_start_time = time.time()
    pod_data_list = list()
    pod_data_list.extend(scale_lib.attach_multiple_pvc_to_pod_dict(pvc_list=pvc_names_list, namespace=self.namespace, pvcs_per_pod=1))
    lcl = locals()
    tmp_path = pathlib.Path(ocsci_log_path())
    obj_name = 'obj1'
    lcl[f'pod_kube_{obj_name}'] = ObjectConfFile(name=f'pod_kube_{obj_name}', obj_dict_list=pod_data_list, project=defaults.ROOK_CLUSTER_NAMESPACE, tmp_path=tmp_path)
    lcl[f'pod_kube_{obj_name}'].create(namespace=self.namespace)
    log.info('Checking that pods are running')
    pod_running_list = scale_lib.check_all_pod_reached_running_state_in_kube_job(kube_job_obj=lcl[f'pod_kube_{obj_name}'], namespace=self.namespace, no_of_pod=len(pod_data_list), timeout=180)
    for pod_name in pod_running_list:
        pod_obj = get_pod_obj(pod_name, self.namespace)
        teardown_factory(pod_obj)
    bulk_end_time = time.time()
    bulk_total_time = (bulk_end_time - bulk_start_time)
    log.info(f'Bulk attach time of {len(pod_running_list)} pods is {bulk_total_time} seconds')
    self.get_env_info()
    full_log_path = get_full_test_logs_path(cname=self)
    self.results_path = get_full_test_logs_path(cname=self)
    full_log_path += f'-{self.sc}'
    full_results = self.init_full_results(ResultsAnalyse(self.uuid, self.crd_data, full_log_path, 'pod_bulk_attachtime'))
    full_results.add_key('storageclass', self.sc)
    full_results.add_key('pod_bulk_attach_time', bulk_total_time)
    full_results.add_key('pvc_size', self.pvc_size)
    full_results.add_key('bulk_size', bulk_size)
    test_end_time = PASTest.get_time()
    full_results.add_key('test_time', {'start': test_start_time, 'end': test_end_time})
    if full_results.es_write():
        res_link = full_results.results_link()
        log.info(f'The result can be found at : {res_link}')
        self.write_result_to_file(res_link)
Measures pods attachment time in bulk_size bulk

Args:
    teardown_factory: A fixture used when we want a new resource that was created during the tests
                       to be removed in the teardown phase.
    bulk_size: Size of the bulk to be tested
Returns:
@pytest.mark.parametrize(argnames=['interface_type', 'bulk_size'], argvalues=[pytest.param(*[constants.CEPHBLOCKPOOL, 120]), pytest.param(*[constants.CEPHBLOCKPOOL, 240]), pytest.param(*[constants.CEPHFILESYSTEM, 120]), pytest.param(*[constants.CEPHFILESYSTEM, 240])])
@pytest.mark.usefixtures(base_setup.__name__)
@polarion_id('OCS-1620')
def test_bulk_pod_attach_performance(self, teardown_factory, bulk_size):
    '\n        Measures pods attachment time in bulk_size bulk\n\n        Args:\n            teardown_factory: A fixture used when we want a new resource that was created during the tests\n                               to be removed in the teardown phase.\n            bulk_size: Size of the bulk to be tested\n        Returns:\n\n        '
    test_start_time = PASTest.get_time()
    log.info(f'Start creating bulk of new {bulk_size} PVCs')
    (pvc_objs, _) = helpers.create_multiple_pvcs(sc_name=self.sc_obj.name, namespace=self.namespace, number_of_pvc=bulk_size, size=self.pvc_size, burst=True)
    for pvc_obj in pvc_objs:
        pvc_obj.reload()
        teardown_factory(pvc_obj)
    with ThreadPoolExecutor(max_workers=5) as executor:
        for pvc_obj in pvc_objs:
            executor.submit(helpers.wait_for_resource_state, pvc_obj, constants.STATUS_BOUND)
            executor.submit(pvc_obj.reload)
    start_time = helpers.get_provision_time(self.interface, pvc_objs, status='start')
    end_time = helpers.get_provision_time(self.interface, pvc_objs, status='end')
    total_time = (end_time - start_time).total_seconds()
    log.info(f'{self.interface}: Bulk of {bulk_size} PVCs creation time is {total_time} seconds.')
    pvc_names_list = []
    for pvc_obj in pvc_objs:
        pvc_names_list.append(pvc_obj.name)
    log.info(f'{self.interface} : Before pod attach')
    bulk_start_time = time.time()
    pod_data_list = list()
    pod_data_list.extend(scale_lib.attach_multiple_pvc_to_pod_dict(pvc_list=pvc_names_list, namespace=self.namespace, pvcs_per_pod=1))
    lcl = locals()
    tmp_path = pathlib.Path(ocsci_log_path())
    obj_name = 'obj1'
    lcl[f'pod_kube_{obj_name}'] = ObjectConfFile(name=f'pod_kube_{obj_name}', obj_dict_list=pod_data_list, project=defaults.ROOK_CLUSTER_NAMESPACE, tmp_path=tmp_path)
    lcl[f'pod_kube_{obj_name}'].create(namespace=self.namespace)
    log.info('Checking that pods are running')
    pod_running_list = scale_lib.check_all_pod_reached_running_state_in_kube_job(kube_job_obj=lcl[f'pod_kube_{obj_name}'], namespace=self.namespace, no_of_pod=len(pod_data_list), timeout=180)
    for pod_name in pod_running_list:
        pod_obj = get_pod_obj(pod_name, self.namespace)
        teardown_factory(pod_obj)
    bulk_end_time = time.time()
    bulk_total_time = (bulk_end_time - bulk_start_time)
    log.info(f'Bulk attach time of {len(pod_running_list)} pods is {bulk_total_time} seconds')
    self.get_env_info()
    full_log_path = get_full_test_logs_path(cname=self)
    self.results_path = get_full_test_logs_path(cname=self)
    full_log_path += f'-{self.sc}'
    full_results = self.init_full_results(ResultsAnalyse(self.uuid, self.crd_data, full_log_path, 'pod_bulk_attachtime'))
    full_results.add_key('storageclass', self.sc)
    full_results.add_key('pod_bulk_attach_time', bulk_total_time)
    full_results.add_key('pvc_size', self.pvc_size)
    full_results.add_key('bulk_size', bulk_size)
    test_end_time = PASTest.get_time()
    full_results.add_key('test_time', {'start': test_start_time, 'end': test_end_time})
    if full_results.es_write():
        res_link = full_results.results_link()
        log.info(f'The result can be found at : {res_link}')
        self.write_result_to_file(res_link)