def run(): tests = [ bad_db_type, json_db_no_feed_name, json_db_wrong_feed_name_type, json_db_no_data_field, json_db_wrong_data_type, json_db_empty_data, json_db_no_entry_field, json_db_no_usable_entry_field, json_db_wrong_entry_type, exec_one_good, exec_one_bad, exec_one_bad_no_score, exec_one_bad_score_lt_0, exec_one_bad_score_gt_100, exec_one_bad_wrong_score_type, exec_multiple_good, exec_multiple_bad, exec_one_bad_multiple_good, exec_multiple_bad_multiple_good, exec_text_multiple_bad_multiple_good, exec_no_db_type_multiple_bad_multiple_good, ] for i in tests: print_result("hostlookup: " + i.__name__, i)
def run(): tests = [ good_format_tokens_test, bad_format_tokens_test, ] for i in tests: print_result("dga: " + i.__name__, i)
def run(): tests = [ new_connection_test, known_connection_test, new_connection_to_known_test, ] for i in tests: print_result("connection: " + i.__name__, i)
def run(): tests = [ unique_untrusted_host_test, unique_trusted_host_test, multiple_trusted_host_test, multiple_untrusted_host_test, multiple_host_test, init_data_test ] for i in tests: print_result("hostlookup: " + i.__name__, i)
def run(): tests = [ not_enough_data_test, no_data_list_test, line_too_short_test, line_no_string_test, line_no_int_test, line_no_data_list_test, one_set_data_test, multiple_set_data_test, negative_value_in_data_test, badly_formatted_ip_test ] for i in tests: print_result("anomaly: " + i.__name__, i)
def run(): tests = [ well_formatted_data_test, not_data_list_ignored_test, not_data_string_ignored_test, not_data_int_ignored_test, data_too_short_ignored_test, data_too_long_ignored_test, multiple_sources_test, multiple_outputs_redis_test, multiple_inputs_redis_test, missing_data_in_conf, thread_working_test, fanomaly_connector_and_send_test, fsofa_connector_test ] for i in tests: print_result("buffer: " + i.__name__, i)
def run(): tests = [ simple_master_server, master_slave, master_slave_master_fail, master_slave_master_off, master_timeout_restart, multi_thread_master ] for i in tests: print_result("Redis tests: " + i.__name__, i)
def run(): tests = [ simple_master_server, master_replica, master_replica_master_temp_fail, master_replica_transfer_no_healthcheck, master_replica_transfer_with_healthcheck, master_replica_failover_no_healthcheck, master_replica_failover_with_healthcheck, multi_thread_master, master_replica_discovery_rate_limiting ] for i in tests: print_result("Redis tests: " + i.__name__, i)
def run(): tests = [ proc_stats_default, proc_stats_other_defaults, proc_stats_custom, proc_stats_wrong, redis_reports, file_reports, file_and_redis_simple_report, ] for i in tests: print_result("Stats reporting: " + i.__name__, i)
def run(): tests = [ multiple_filters_running, multiple_filters_running_conf_v2, multiple_filters_running_one_fail, multiple_filters_running_one_fail_conf_v2, one_filters_running, one_filters_running_conf_v2, no_filter, ] for i in tests: print_result("Monitoring: " + i.__name__, i)
def run(): tests = [ check_start_stop, check_pid_file, check_socket_create_delete, check_socket_connection, check_socket_monitor_create_delete, check_socket_monitor_connection, check_start_wrong_conf, check_start_no_conf, ] for i in tests: print_result("Basic tests: " + i.__name__, i)
def run(): tests = [ well_formatted_data_test, data_too_short_ignored_test, not_data_string_ignored_test, not_data_list_ignored_test, invalid_field_ignored_test, empty_field_ignored_test, invalid_protocol_ignored_test, thread_working_test, alert_in_redis_test, alert_published_test, alert_in_file_test, ] for i in tests: print_result("tanomaly: " + i.__name__, i)
def run(): tests = [ single_log_to_file, single_log_to_redis, single_log_to_redis_channel, single_log_to_all, multiple_log_to_file, multiple_log_to_redis, multiple_log_to_redis_channel, multiple_log_to_all, empty_log_to_file, empty_log_to_redis, empty_log_to_redis_channel, empty_log_to_all ] for i in tests: print_result("logs: " + i.__name__, i)
def run(): tests = [ good_format_data_test, good_format_with_colons_data_test, data_too_short_test, data_too_long_test, data_ip_not_string_test, data_port_not_string_test, data_hotname_not_string_test, data_os_not_string_test, data_proto_not_string_test, python_false_return_test, data_bad_list_test, blank_return_file_test, no_return_file_test, ] for i in tests: print_result("sofa: " + i.__name__, i)
def run(): tests = [ check_start_stop, check_pid_file, check_socket_create_delete, check_socket_connection, check_socket_monitor_create_delete, check_socket_monitor_connection, check_start_wrong_conf, check_start_no_conf, check_start_invalid_thread_num, check_start_invalid_cache_num, check_start_invalid_threshold_num, check_start_outbound_thread_num, check_start_outbound_cache_num, check_start_outbound_threshold_num, ] for i in tests: print_result("Basic tests: " + i.__name__, i)
def run(): tests = [ no_filter_to_none, no_filter_to_one, no_filter_to_one_conf_v2, no_filter_to_many, no_filter_to_many_conf_v2, one_filter_to_none, one_filter_to_none_conf_v2, many_filters_to_none, many_filters_to_none_conf_v2, many_filters_to_one, many_filters_to_one_conf_v2, one_update_none, one_update_none_conf_v2, one_update_one, one_update_one_conf_v2, one_update_one_wrong_conf, one_update_one_wrong_conf_conf_v2, many_update_none, many_update_none_conf_v2, many_update_one, many_update_one_conf_v2, many_update_many, many_update_many_conf_v2, many_update_two_wrong_conf_conf_v2, many_update_two_wrong_conf, many_update_all, many_update_all_conf_v2, many_update_all_wrong_conf, many_update_all_wrong_conf_conf_v2, non_existing_filter, non_existing_filter_conf_v2, update_no_filter, many_update_diff_one_more_v2, many_update_diff_one_less_v2, many_update_diff_one_more_one_less_v2, ] for i in tests: print_result("Update: " + i.__name__, i)
def run(): tests = [ no_rule_files, one_valid_rule_file, several_valid_rule_files, several_valid_rule_files_with_duplicate, hex_input_several_rules_no_match, hex_input_several_rules_one_match, two_hex_inputs_several_rules_two_matches, hex_input_several_rules_wrong_data, base64_input_several_rules_no_match, base64_input_several_rules_one_match, two_base64_inputs_several_rules_two_matches, base64_input_several_rules_wrong_data, plain_input_several_rules_no_match, plain_input_several_rules_one_match, two_plain_inputs_several_rules_two_matches, many_inputs_several_rules_different_results, ] for i in tests: print_result("yara_scan: " + i.__name__, i)
def run(): tests = [{ "test_name": "config_file_empty_json", "conf": {}, "log": "this is log 3", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "file", "conf": { "log_file_path": ALERT_FILE }, "log": "this is log 4", "expected_file": True, "expected_list": False, "expected_channel": False }, { "test_name": "socket", "conf": { "redis_socket_path": REDIS_SOCKET }, "log": "this is log 5", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "list", "conf": { "alert_redis_list_name": REDIS_ALERT_LIST }, "log": "this is log 6", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "channel", "conf": { "alert_redis_channel_name": REDIS_ALERT_CHANNEL }, "log": "this is log 7", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "empty_file", "conf": { "log_file_path": EMPTY_ALERT_FILE }, "log": "this is log 8", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "empty_socket", "conf": { "redis_socket_path": EMPTY_REDIS_SOCKET }, "log": "this is log 9", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "empty_list", "conf": { "alert_redis_list_name": EMPTY_REDIS_ALERT_LIST }, "log": "this is log 10", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "empty_channel", "conf": { "alert_redis_channel_name": EMPTY_REDIS_ALERT_CHANNEL }, "log": "this is log 11", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_file", "conf": { "log_file_path": WRONG_ALERT_FILE }, "log": "this is log 12", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_socket", "conf": { "redis_socket_path": WRONG_REDIS_SOCKET }, "log": "this is log 13", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_list", "conf": { "alert_redis_list_name": WRONG_REDIS_ALERT_LIST }, "log": "this is log 14", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_channel", "conf": { "alert_redis_channel_name": WRONG_REDIS_ALERT_CHANNEL }, "log": "this is log 15", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "list__channel", "conf": { "alert_redis_list_name": REDIS_ALERT_LIST, "alert_redis_channel_name": REDIS_ALERT_CHANNEL }, "log": "this is log 16", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "file__socket", "conf": { "log_file_path": ALERT_FILE, "redis_socket_path": REDIS_SOCKET }, "log": "this is log 17", "expected_file": True, "expected_list": False, "expected_channel": False }, { "test_name": "file__list", "conf": { "log_file_path": ALERT_FILE, "alert_redis_list_name": REDIS_ALERT_LIST }, "log": "this is log 18", "expected_file": True, "expected_list": False, "expected_channel": False }, { "test_name": "file__channel", "conf": { "log_file_path": ALERT_FILE, "alert_redis_channel_name": REDIS_ALERT_CHANNEL }, "log": "this is log 19", "expected_file": True, "expected_list": False, "expected_channel": False }, { "test_name": "file__list__channel", "conf": { "log_file_path": ALERT_FILE, "alert_redis_list_name": REDIS_ALERT_LIST, "alert_redis_channel_name": REDIS_ALERT_CHANNEL }, "log": "this is log 20", "expected_file": True, "expected_list": False, "expected_channel": False }, { "test_name": "socket__list", "conf": { "redis_socket_path": REDIS_SOCKET, "alert_redis_list_name": REDIS_ALERT_LIST }, "log": "this is log 21", "expected_file": False, "expected_list": True, "expected_channel": False }, { "test_name": "socket__channel", "conf": { "redis_socket_path": REDIS_SOCKET, "alert_redis_channel_name": REDIS_ALERT_CHANNEL }, "log": "this is log 22", "expected_file": False, "expected_list": False, "expected_channel": True }, { "test_name": "socket__list__channel", "conf": { "redis_socket_path": REDIS_SOCKET, "alert_redis_list_name": REDIS_ALERT_LIST, "alert_redis_channel_name": REDIS_ALERT_CHANNEL }, "log": "this is log 23", "expected_file": False, "expected_list": True, "expected_channel": True }, { "test_name": "file__socket__list", "conf": { "log_file_path": ALERT_FILE, "redis_socket_path": REDIS_SOCKET, "alert_redis_list_name": REDIS_ALERT_LIST }, "log": "this is log 24", "expected_file": True, "expected_list": True, "expected_channel": False }, { "test_name": "file__socket__channel", "conf": { "log_file_path": ALERT_FILE, "redis_socket_path": REDIS_SOCKET, "alert_redis_channel_name": REDIS_ALERT_CHANNEL }, "log": "this is log 25", "expected_file": True, "expected_list": False, "expected_channel": True }, { "test_name": "file__socket__list__channel", "conf": { "log_file_path": ALERT_FILE, "redis_socket_path": REDIS_SOCKET, "alert_redis_list_name": REDIS_ALERT_LIST, "alert_redis_channel_name": REDIS_ALERT_CHANNEL }, "log": "this is log 26", "expected_file": True, "expected_list": True, "expected_channel": True }, { "test_name": "wrong_file__socket", "conf": { "log_file_path": WRONG_ALERT_FILE, "redis_socket_path": REDIS_SOCKET }, "log": "this is log 27", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "file__wrong_socket", "conf": { "log_file_path": ALERT_FILE, "redis_socket_path": WRONG_REDIS_SOCKET }, "log": "this is log 28", "expected_file": True, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_file__wrong_socket", "conf": { "log_file_path": WRONG_ALERT_FILE, "redis_socket_path": WRONG_REDIS_SOCKET }, "log": "this is log 29", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_file__list", "conf": { "log_file_path": WRONG_ALERT_FILE, "alert_redis_list_name": REDIS_ALERT_LIST }, "log": "this is log 30", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "file__wrong_list", "conf": { "log_file_path": ALERT_FILE, "alert_redis_list_name": WRONG_REDIS_ALERT_LIST }, "log": "this is log 31", "expected_file": True, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_file__wrong_list", "conf": { "log_file_path": WRONG_ALERT_FILE, "alert_redis_list_name": WRONG_REDIS_ALERT_LIST }, "log": "this is log 32", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_file__channel", "conf": { "log_file_path": WRONG_ALERT_FILE, "alert_redis_channel_name": REDIS_ALERT_CHANNEL }, "log": "this is log 33", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "file__wrong_channel", "conf": { "log_file_path": ALERT_FILE, "alert_redis_channel_name": WRONG_REDIS_ALERT_CHANNEL }, "log": "this is log 34", "expected_file": True, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_file__wrong_channel", "conf": { "log_file_path": WRONG_ALERT_FILE, "alert_redis_channel_name": WRONG_REDIS_ALERT_CHANNEL }, "log": "this is log 35", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_file__list__channel", "conf": { "log_file_path": WRONG_ALERT_FILE, "alert_redis_list_name": REDIS_ALERT_LIST, "alert_redis_channel_name": REDIS_ALERT_CHANNEL }, "log": "this is log 36", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "file__wrong_list__channel", "conf": { "log_file_path": ALERT_FILE, "alert_redis_list_name": WRONG_REDIS_ALERT_LIST, "alert_redis_channel_name": REDIS_ALERT_CHANNEL }, "log": "this is log 37", "expected_file": True, "expected_list": False, "expected_channel": False }, { "test_name": "file__list__wrong_channel", "conf": { "log_file_path": ALERT_FILE, "alert_redis_list_name": REDIS_ALERT_LIST, "alert_redis_channel_name": WRONG_REDIS_ALERT_CHANNEL }, "log": "this is log 38", "expected_file": True, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_file__wrong_list__channel", "conf": { "log_file_path": WRONG_ALERT_FILE, "alert_redis_list_name": WRONG_REDIS_ALERT_LIST, "alert_redis_channel_name": REDIS_ALERT_CHANNEL }, "log": "this is log 39", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "file__wrong_list__wrong_channel", "conf": { "log_file_path": ALERT_FILE, "alert_redis_list_name": WRONG_REDIS_ALERT_LIST, "alert_redis_channel_name": WRONG_REDIS_ALERT_CHANNEL }, "log": "this is log 40", "expected_file": True, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_file__list__wrong_channel", "conf": { "log_file_path": WRONG_ALERT_FILE, "alert_redis_list_name": REDIS_ALERT_LIST, "alert_redis_channel_name": WRONG_REDIS_ALERT_CHANNEL }, "log": "this is log 41", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_file__wrong_list__wrong_channel", "conf": { "log_file_path": WRONG_ALERT_FILE, "alert_redis_list_name": WRONG_REDIS_ALERT_LIST, "alert_redis_channel_name": WRONG_REDIS_ALERT_CHANNEL }, "log": "this is log 42", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_socket__list", "conf": { "redis_socket_path": WRONG_REDIS_SOCKET, "alert_redis_list_name": REDIS_ALERT_LIST }, "log": "this is log 43", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "socket__wrong_list", "conf": { "redis_socket_path": REDIS_SOCKET, "alert_redis_list_name": WRONG_REDIS_ALERT_LIST }, "log": "this is log 44", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_socket__wrong_list", "conf": { "redis_socket_path": WRONG_REDIS_SOCKET, "alert_redis_list_name": WRONG_REDIS_ALERT_LIST }, "log": "this is log 45", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_socket__channel", "conf": { "redis_socket_path": WRONG_REDIS_SOCKET, "alert_redis_channel_name": REDIS_ALERT_CHANNEL }, "log": "this is log 46", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "socket__wrong_channel", "conf": { "redis_socket_path": REDIS_SOCKET, "alert_redis_channel_name": WRONG_REDIS_ALERT_CHANNEL }, "log": "this is log 47", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_socket__wrong_channel", "conf": { "redis_socket_path": WRONG_REDIS_SOCKET, "alert_redis_channel_name": WRONG_REDIS_ALERT_CHANNEL }, "log": "this is log 48", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_socket__list__channel", "conf": { "redis_socket_path": WRONG_REDIS_SOCKET, "alert_redis_list_name": REDIS_ALERT_LIST, "alert_redis_channel_name": REDIS_ALERT_CHANNEL }, "log": "this is log 49", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "socket__wrong_list__channel", "conf": { "redis_socket_path": REDIS_SOCKET, "alert_redis_list_name": WRONG_REDIS_ALERT_LIST, "alert_redis_channel_name": REDIS_ALERT_CHANNEL }, "log": "this is log 50", "expected_file": False, "expected_list": False, "expected_channel": True }, { "test_name": "socket__list__wrong_channel", "conf": { "redis_socket_path": REDIS_SOCKET, "alert_redis_list_name": REDIS_ALERT_LIST, "alert_redis_channel_name": WRONG_REDIS_ALERT_CHANNEL }, "log": "this is log 51", "expected_file": False, "expected_list": True, "expected_channel": False }, { "test_name": "wrong_socket__wrong_list__channel", "conf": { "redis_socket_path": WRONG_REDIS_SOCKET, "alert_redis_list_name": WRONG_REDIS_ALERT_LIST, "alert_redis_channel_name": REDIS_ALERT_CHANNEL }, "log": "this is log 52", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "socket__wrong_list__wrong_channel", "conf": { "redis_socket_path": REDIS_SOCKET, "alert_redis_list_name": WRONG_REDIS_ALERT_LIST, "alert_redis_channel_name": WRONG_REDIS_ALERT_CHANNEL }, "log": "this is log 53", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_socket__list__wrong_channel", "conf": { "redis_socket_path": WRONG_REDIS_SOCKET, "alert_redis_list_name": REDIS_ALERT_LIST, "alert_redis_channel_name": WRONG_REDIS_ALERT_CHANNEL }, "log": "this is log 54", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_socket__wrong_list__wrong_channel", "conf": { "redis_socket_path": WRONG_REDIS_SOCKET, "alert_redis_list_name": WRONG_REDIS_ALERT_LIST, "alert_redis_channel_name": WRONG_REDIS_ALERT_CHANNEL }, "log": "this is log 55", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_file__socket__list", "conf": { "log_file_path": WRONG_ALERT_FILE, "redis_socket_path": REDIS_SOCKET, "alert_redis_list_name": REDIS_ALERT_LIST }, "log": "this is log 56", "expected_file": False, "expected_list": True, "expected_channel": False }, { "test_name": "file__wrong_socket__list", "conf": { "log_file_path": ALERT_FILE, "redis_socket_path": WRONG_REDIS_SOCKET, "alert_redis_list_name": REDIS_ALERT_LIST }, "log": "this is log 57", "expected_file": True, "expected_list": False, "expected_channel": False }, { "test_name": "file__socket__wrong_list", "conf": { "log_file_path": ALERT_FILE, "redis_socket_path": REDIS_SOCKET, "alert_redis_list_name": WRONG_REDIS_ALERT_LIST }, "log": "this is log 58", "expected_file": True, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_file__wrong_socket__list", "conf": { "log_file_path": WRONG_ALERT_FILE, "redis_socket_path": WRONG_REDIS_SOCKET, "alert_redis_list_name": REDIS_ALERT_LIST }, "log": "this is log 59", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "file__wrong_socket__wrong_list", "conf": { "log_file_path": ALERT_FILE, "redis_socket_path": WRONG_REDIS_SOCKET, "alert_redis_list_name": WRONG_REDIS_ALERT_LIST }, "log": "this is log 60", "expected_file": True, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_file__socket__wrong_list", "conf": { "log_file_path": WRONG_ALERT_FILE, "redis_socket_path": REDIS_SOCKET, "alert_redis_list_name": WRONG_REDIS_ALERT_LIST }, "log": "this is log 61", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_file__wrong_socket__wrong_list", "conf": { "log_file_path": WRONG_ALERT_FILE, "redis_socket_path": WRONG_REDIS_SOCKET, "alert_redis_list_name": WRONG_REDIS_ALERT_LIST }, "log": "this is log 62", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_file__socket__channel", "conf": { "log_file_path": WRONG_ALERT_FILE, "redis_socket_path": REDIS_SOCKET, "alert_redis_channel_name": REDIS_ALERT_CHANNEL }, "log": "this is log 63", "expected_file": False, "expected_list": False, "expected_channel": True }, { "test_name": "file__wrong_socket__channel", "conf": { "log_file_path": ALERT_FILE, "redis_socket_path": WRONG_REDIS_SOCKET, "alert_redis_channel_name": REDIS_ALERT_CHANNEL }, "log": "this is log 64", "expected_file": True, "expected_list": False, "expected_channel": False }, { "test_name": "file__socket__wrong_channel", "conf": { "log_file_path": ALERT_FILE, "redis_socket_path": REDIS_SOCKET, "alert_redis_channel_name": WRONG_REDIS_ALERT_CHANNEL }, "log": "this is log 65", "expected_file": True, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_file__wrong_socket__channel", "conf": { "log_file_path": WRONG_ALERT_FILE, "redis_socket_path": WRONG_REDIS_SOCKET, "alert_redis_channel_name": REDIS_ALERT_CHANNEL }, "log": "this is log 66", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "file__wrong_socket__wrong_channel", "conf": { "log_file_path": ALERT_FILE, "redis_socket_path": WRONG_REDIS_SOCKET, "alert_redis_channel_name": WRONG_REDIS_ALERT_CHANNEL }, "log": "this is log 67", "expected_file": True, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_file__socket__wrong_channel", "conf": { "log_file_path": WRONG_ALERT_FILE, "redis_socket_path": REDIS_SOCKET, "alert_redis_channel_name": WRONG_REDIS_ALERT_CHANNEL }, "log": "this is log 68", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_file__wrong_socket__wrong_channel", "conf": { "log_file_path": WRONG_ALERT_FILE, "redis_socket_path": WRONG_REDIS_SOCKET, "alert_redis_channel_name": WRONG_REDIS_ALERT_CHANNEL }, "log": "this is log 69", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_file__socket__list__channel", "conf": { "log_file_path": WRONG_ALERT_FILE, "redis_socket_path": REDIS_SOCKET, "alert_redis_list_name": REDIS_ALERT_LIST, "alert_redis_channel_name": REDIS_ALERT_CHANNEL }, "log": "this is log 70", "expected_file": False, "expected_list": True, "expected_channel": True }, { "test_name": "wrong_file__wrong_socket__list__channel", "conf": { "log_file_path": WRONG_ALERT_FILE, "redis_socket_path": WRONG_REDIS_SOCKET, "alert_redis_list_name": REDIS_ALERT_LIST, "alert_redis_channel_name": REDIS_ALERT_CHANNEL }, "log": "this is log 71", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_file__socket__wrong_list__channel", "conf": { "log_file_path": WRONG_ALERT_FILE, "redis_socket_path": REDIS_SOCKET, "alert_redis_list_name": WRONG_REDIS_ALERT_LIST, "alert_redis_channel_name": REDIS_ALERT_CHANNEL }, "log": "this is log 72", "expected_file": False, "expected_list": False, "expected_channel": True }, { "test_name": "wrong_file__socket__list__wrong_channel", "conf": { "log_file_path": WRONG_ALERT_FILE, "redis_socket_path": REDIS_SOCKET, "alert_redis_list_name": REDIS_ALERT_LIST, "alert_redis_channel_name": WRONG_REDIS_ALERT_CHANNEL }, "log": "this is log 73", "expected_file": False, "expected_list": True, "expected_channel": False }, { "test_name": "wrong_file__wrong_socket__wrong_list__channel", "conf": { "log_file_path": WRONG_ALERT_FILE, "redis_socket_path": WRONG_REDIS_SOCKET, "alert_redis_list_name": WRONG_REDIS_ALERT_LIST, "alert_redis_channel_name": REDIS_ALERT_CHANNEL }, "log": "this is log 74", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_file__socket__wrong_list__wrong_channel", "conf": { "log_file_path": WRONG_ALERT_FILE, "redis_socket_path": REDIS_SOCKET, "alert_redis_list_name": WRONG_REDIS_ALERT_LIST, "alert_redis_channel_name": WRONG_REDIS_ALERT_CHANNEL }, "log": "this is log 75", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_file__wrong_socket__list__wrong_channel", "conf": { "log_file_path": WRONG_ALERT_FILE, "redis_socket_path": WRONG_REDIS_SOCKET, "alert_redis_list_name": REDIS_ALERT_LIST, "alert_redis_channel_name": WRONG_REDIS_ALERT_CHANNEL }, "log": "this is log 76", "expected_file": False, "expected_list": False, "expected_channel": False }, { "test_name": "wrong_file__wrong_socket__wrong_list__wrong_channel", "conf": { "log_file_path": WRONG_ALERT_FILE, "redis_socket_path": WRONG_REDIS_SOCKET, "alert_redis_list_name": WRONG_REDIS_ALERT_LIST, "alert_redis_channel_name": WRONG_REDIS_ALERT_CHANNEL }, "log": "this is log 77", "expected_file": False, "expected_list": False, "expected_channel": False }] for i in tests: print_result("AlertManager: " + i["test_name"], functools.partial(test, **i)) tests = [ check_log_rotate, ] for i in tests: print_result("AlertManager: " + i.__name__, i)