def run_test_logic(tests_settings: Any, c: Any, failed_playbooks: list, integrations: list, playbook_id: str, succeed_playbooks: list, test_message: str, test_options: dict, slack: Any, circle_ci: str, build_number: str, server_url: str, demisto_user: str, demisto_pass: str, build_name: str, prints_manager: Any, thread_index: int = 0) -> bool: """ run_test_logic handles the testing of the integration by triggering check_integration. afterwards it will check the status of the test and report success or add the failed test to the list of failed integrations. :param tests_settings: SettingsTester object which contains the test variables :param c: Client for connecting to XSOAR via demisto-py :param failed_playbooks: List of failed playbooks, additional failed playbooks will be added if they failed. :param integrations: List of integrations being tested. :param playbook_id: ID of the test playbook being tested. :param succeed_playbooks: List of playbooks which have passed tests. :param test_message: Name of the playbook/integration being tested. This is reported back in the build and used to print in the console the test being ran. :param test_options: Options being passed to the test. PID, Docker Threshold, Timeout, etc. :param slack: Slack client used for notifications. :param circle_ci: CircleCI token. Used to get name of dev who triggered the build. :param build_number: The build number of the CI run. Used in slack message. :param server_url: The FQDN of the server tests are being ran on. :param demisto_user: Username of the demisto user running the tests. :param demisto_pass: Password of the demisto user running the tests. :param build_name: Name of the build. (Nightly, etc.) :param prints_manager: PrintsManager object used in reporting. Will be deprecated. :param thread_index: Integer indicating what thread the test is running on. :return: Boolean indicating if the test was successful. """ status, inc_id = check_integration(c, server_url, demisto_user, demisto_pass, integrations, playbook_id, prints_manager, test_options, thread_index=thread_index) if status == PB_Status.COMPLETED: prints_manager.add_print_job('PASS: {} succeed'.format(test_message), print_color, thread_index, message_color=LOG_COLORS.GREEN) succeed_playbooks.append(playbook_id) elif status == PB_Status.NOT_SUPPORTED_VERSION: not_supported_version_message = 'PASS: {} skipped - not supported version'.format( test_message) prints_manager.add_print_job(not_supported_version_message, print, thread_index) succeed_playbooks.append(playbook_id) else: error_message = 'Failed: {} failed'.format(test_message) prints_manager.add_print_job(error_message, print_error, thread_index) playbook_id_with_mock = playbook_id playbook_id_with_mock += " (Mock Disabled)" failed_playbooks.append(playbook_id_with_mock) if not tests_settings.is_local_run: notify_failed_test(slack, circle_ci, playbook_id, build_number, inc_id, server_url, build_name) succeed = status in (PB_Status.COMPLETED, PB_Status.NOT_SUPPORTED_VERSION) return succeed
def run_test_logic(tests_settings: Any, c: Any, failed_playbooks: list, integrations: list, playbook_id: str, succeed_playbooks: list, test_message: str, test_options: dict, slack: Any, circle_ci: str, build_number: str, server_url: str, demisto_user: str, demisto_pass: str, build_name: str) -> bool: """ run_test_logic handles the testing of the integration by triggering check_integration. afterwards it will check the status of the test and report success or add the failed test to the list of failed integrations. :param tests_settings: SettingsTester object which contains the test variables :param c: Client for connecting to XSOAR via demisto-py :param failed_playbooks: List of failed playbooks, additional failed playbooks will be added if they failed. :param integrations: List of integrations being tested. :param playbook_id: ID of the test playbook being tested. :param succeed_playbooks: List of playbooks which have passed tests. :param test_message: Name of the playbook/integration being tested. This is reported back in the build and used to print in the console the test being ran. :param test_options: Options being passed to the test. PID, Docker Threshold, Timeout, etc. :param slack: Slack client used for notifications. :param circle_ci: CircleCI token. Used to get name of dev who triggered the build. :param build_number: The build number of the CI run. Used in slack message. :param server_url: The FQDN of the server tests are being ran on. :param demisto_user: Username of the demisto user running the tests. :param demisto_pass: Password of the demisto user running the tests. :param build_name: Name of the build. (Nightly, etc.) :return: Boolean indicating if the test was successful. """ status, inc_id = check_integration(c, server_url, demisto_user, demisto_pass, integrations, playbook_id, options=test_options) if status == PB_Status.COMPLETED: logging.success(f'PASS: {test_message} succeed') succeed_playbooks.append(playbook_id) elif status == PB_Status.NOT_SUPPORTED_VERSION: logging.info(f'PASS: {test_message} skipped - not supported version') succeed_playbooks.append(playbook_id) else: logging.error(f'Failed: {test_message} failed') playbook_id_with_mock = playbook_id playbook_id_with_mock += " (Mock Disabled)" failed_playbooks.append(playbook_id_with_mock) succeed = status in (PB_Status.COMPLETED, PB_Status.NOT_SUPPORTED_VERSION) return succeed