Beispiel #1
0
    def test_temporary_file_assign_to_logtype(self, test_name):
        input_path, original_log_file, path, result_log_file, results_yaml_file = self._prepare_files_path(
            test_name)
        effect_line_offset, line_content = self._gather_effect_line_data(
            input_path, original_log_file)

        whylog_config = self._prepare_config(path)
        log_reader = LogReader(whylog_config)
        effect_line = FrontInput(
            effect_line_offset, line_content,
            LineSource(
                'localhost',
                os.path.join(path, self._get_starting_file_name(input_path))))

        node1_source = LineSource('localhost',
                                  os.path.join(path, 'node_1.log'))
        node2_source = LineSource('localhost',
                                  os.path.join(path, 'node_2.log'))
        node3_source = LineSource('localhost',
                                  os.path.join(path, 'node_3.log'))
        temp_assign = {AbstractConfig.DEFAULT_LOG_TYPE: [node1_source]}
        if test_name == "010_multiple_files":
            temp_assign = {
                AbstractConfig.DEFAULT_LOG_TYPE: [node1_source, node2_source]
            }
        if test_name == "011_different_entry":
            temp_assign = {
                AbstractConfig.DEFAULT_LOG_TYPE:
                [node1_source, node2_source, node3_source]
            }

        results = log_reader.get_causes(effect_line, temp_assign)
        expected_results = self._investigation_results_from_yaml(
            results_yaml_file, result_log_file)
        self._check_results(results, expected_results)
Beispiel #2
0
    def test_temporary_file_assign_to_logtype(self, test_name):
        input_path, original_log_file, path, result_log_file, results_yaml_file = self._prepare_files_path(
            test_name
        )
        effect_line_offset, line_content = self._gather_effect_line_data(
            input_path, original_log_file
        )

        whylog_config = self._prepare_config(path)
        log_reader = LogReader(whylog_config)
        effect_line = FrontInput(
            effect_line_offset, line_content,
            LineSource('localhost', os.path.join(path, self._get_starting_file_name(input_path)))
        )

        node1_source = LineSource('localhost', os.path.join(path, 'node_1.log'))
        node2_source = LineSource('localhost', os.path.join(path, 'node_2.log'))
        node3_source = LineSource('localhost', os.path.join(path, 'node_3.log'))
        temp_assign = {AbstractConfig.DEFAULT_LOG_TYPE: [node1_source]}
        if test_name == "010_multiple_files":
            temp_assign = {AbstractConfig.DEFAULT_LOG_TYPE: [node1_source, node2_source]}
        if test_name == "011_different_entry":
            temp_assign = {
                AbstractConfig.DEFAULT_LOG_TYPE: [
                    node1_source, node2_source, node3_source
                ]
            }

        results = log_reader.get_causes(effect_line, temp_assign)
        expected_results = self._investigation_results_from_yaml(results_yaml_file, result_log_file)
        self._check_results(results, expected_results)
Beispiel #3
0
    def test_one(self, test_name):
        input_path, original_log_file, path, result_log_file, results_yaml_file = self._prepare_files_path(test_name)
        effect_line_offset, line_content = self._gather_effect_line_data(input_path, original_log_file)

        # preparing Whylog structures, normally prepared by Front
        whylog_config = YamlConfig(*ConfigPathFactory.get_path_to_config_files(path))
        log_reader = LogReader(whylog_config)
        effect_line = FrontInput(
            effect_line_offset,
            line_content,
            LineSource("localhost", os.path.join(path, self._get_starting_file_name(input_path))),
        )

        results = log_reader.get_causes(effect_line)
        expected_results = self._investigation_results_from_yaml(results_yaml_file, result_log_file)
        self._check_results(results, expected_results)
Beispiel #4
0
def whylog_factory():
    """
    This function returns LogReader object and teachers_generator.
    """
    settings = SettingsFactorySelector.get_settings()
    pattern_assistant = settings['assistant']()
    config = settings['config']
    return LogReader(config), partial(Teacher, config,
                                      pattern_assistant), config
Beispiel #5
0
    def test_one(self, test_name):
        input_path, original_log_file, path, result_log_file, results_yaml_file = self._prepare_files_path(
            test_name)
        effect_line_offset, line_content = self._gather_effect_line_data(
            input_path, original_log_file)

        # preparing Whylog structures, normally prepared by Front
        whylog_config = YamlConfig(
            *ConfigPathFactory.get_path_to_config_files(path))
        log_reader = LogReader(whylog_config)
        effect_line = FrontInput(
            effect_line_offset, line_content,
            LineSource(
                'localhost',
                os.path.join(path, self._get_starting_file_name(input_path))))

        results = log_reader.get_causes(effect_line)
        expected_results = self._investigation_results_from_yaml(
            results_yaml_file, result_log_file)
        self._check_results(results, expected_results)