def __init__(self, application: BaseApplication): bzt_log = BztFileReader() self.log_dir = bzt_log.log_dir self.conf = application.config self.app_type = application.type self.results_log = ResultsFileReader() self.run_id = str(uuid.uuid1()) self.tool_version = TOOLKIT_VERSION self.os = get_os() self.duration = convert_to_sec(self.conf.duration) self.concurrency = self.conf.concurrency self.actual_duration = bzt_log.actual_run_time self.test_actions_success_rate, self.test_actions_timing = self.results_log.all_tests_actions self.selenium_test_rates, self.jmeter_test_rates, self.locust_test_rates, self.app_specific_rates = \ generate_test_actions_by_type(test_actions=self.test_actions_success_rate, application=application) self.time_stamp = get_timestamp() self.date = get_date() self.application_version = application.version self.nodes_count = application.nodes_count self.dataset_information = application.dataset_information # JSM app type has additional concurrency fields: concurrency_agents, concurrency_customers if self.app_type == JSM: self.concurrency_agents = self.conf.agents_concurrency self.concurrency_customers = self.conf.customers_concurrency if self.app_type == CROWD: self.crowd_sync_test = get_crowd_sync_test_results(bzt_log) self.ramp_up = application.config.ramp_up self.total_actions_per_hour = application.config.total_actions_per_hour
def __init__(self, application: BaseApplication): bzt_log = BztFileReader() self.log_dir = bzt_log.log_dir self.conf = application.config self.app_type = application.type self.results_log = ResultsFileReader() self.run_id = str(uuid.uuid1()) self.tool_version = TOOLKIT_VERSION self.os = get_os() self.duration = convert_to_sec(self.conf.duration) self.concurrency = self.conf.concurrency self.actual_duration = bzt_log.actual_run_time self.all_test_actions = bzt_log.all_test_actions self.selenium_test_rates, self.jmeter_test_rates, self.locust_test_rates, self.app_specific_rates = \ generate_test_actions_by_type(test_actions=self.all_test_actions, application=application) self.time_stamp = get_timestamp() self.date = get_date() self.application_version = application.version self.nodes_count = application.nodes_count self.dataset_information = application.dataset_information
def __init__(self, application: BaseApplication): bzt_log = BztFileReader() self.log_dir = bzt_log.log_dir self.conf = application.config self.app_type = application.type self.results_log = ResultsFileReader() self.run_id = str(uuid.uuid1()) self.tool_version = TOOLKIT_VERSION self.os = get_os() self.duration = convert_to_sec(self.conf.duration) self.concurrency = self.conf.concurrency self.actual_duration = bzt_log.actual_run_time self.selenium_test_rates = bzt_log.selenium_test_rates self.jmeter_test_rates = bzt_log.jmeter_test_rates if self.conf.load_executor == 'jmeter' else dict() self.locust_test_rates = bzt_log.locust_test_rates if self.conf.load_executor == 'locust' else dict() self.time_stamp = get_timestamp() self.date = get_date() self.application_version = application.version self.nodes_count = application.nodes_count self.dataset_information = application.dataset_information
def is_compliant(self): message = 'OK' if self.app_type == JSM: compliant = (self.actual_duration >= MIN_DEFAULTS[self.app_type]['test_duration'] and self.concurrency_customers >= MIN_DEFAULTS[self.app_type]['customer_concurrency'] and self.concurrency_agents >= MIN_DEFAULTS[self.app_type]['agent_concurrency']) elif self.app_type == CROWD: rps_compliant = CROWD_RPS[self.nodes_count] total_actions_compliant = rps_compliant * 3600 ramp_up_compliant = MIN_DEFAULTS[CROWD][ 'concurrency'] / rps_compliant ramp_up = convert_to_sec(self.ramp_up) compliant = (ramp_up >= ramp_up_compliant and self.total_actions_per_hour >= total_actions_compliant and self.actual_duration >= MIN_DEFAULTS[self.app_type]['test_duration']) else: compliant = (self.actual_duration >= MIN_DEFAULTS[self.app_type]['test_duration'] and self.concurrency >= MIN_DEFAULTS[self.app_type]['concurrency']) if not compliant: err_msg = [] if self.actual_duration < MIN_DEFAULTS[ self.app_type]['test_duration']: err_msg.append( f"Test run duration {self.actual_duration} sec < than minimum test " f"duration {MIN_DEFAULTS[self.app_type]['test_duration']} sec." ) if self.app_type == JSM: if self.concurrency_customers < MIN_DEFAULTS[JSM][ 'customer_concurrency']: err_msg.append( f"The concurrency_customers = {self.concurrency_customers} is less than " f"required value {MIN_DEFAULTS[JSM]['customer_concurrency']}." ) if self.concurrency_agents < MIN_DEFAULTS[JSM][ 'agent_concurrency']: err_msg.append( f"The concurrency_agents = {self.concurrency_agents} is less than " f"required value {MIN_DEFAULTS[JSM]['agent_concurrency']}." ) elif self.app_type == CROWD: if ramp_up < ramp_up_compliant: err_msg.append( f"The run ramp-up {ramp_up} is less than minimum ramp-up " f"required for the {self.nodes_count} nodes {ramp_up_compliant}" ) if self.total_actions_per_hour < total_actions_compliant: err_msg.append( f"The run total_actions_per_hour {self.total_actions_per_hour} is less " f"than minimum total_actions_per_hour " f"required for the {self.nodes_count} nodes {total_actions_compliant}" ) else: if self.concurrency < MIN_DEFAULTS[ self.app_type]['concurrency']: err_msg.append( f"Test run concurrency {self.concurrency} < than minimum test " f"concurrency {MIN_DEFAULTS[self.app_type]['concurrency']}." ) message = ' '.join(err_msg) return compliant, message