collector_config_test.go
collector_config_test.go - Overview
-
Overview This file contains unit tests for the log parsing pipeline functionality, specifically focusing on building and updating collector configurations. It tests functions related to building log processing pipelines and ensuring that pipeline configurations are correctly generated and updated.
-
Detailed Documentation
buildProcessorTestData
- Purpose: This is a variable which holds test data for the
updateProcessorConfigsInCollectorConf
function. Each test case includes an initial agent configuration, a pipeline processor configuration to be applied, and the expected output configuration after the update. - Type:
[]struct{}
BuildLogsPipelineTestData
- Purpose: This is a variable which holds test data for the
buildCollectorPipelineProcessorsList
function. Each test case includes the current pipeline, a desired log pipeline configuration, and the expected combined pipeline after applying the log pipeline. - Type:
[]struct{}
TestBuildLogParsingProcessors
- Purpose: Tests the
updateProcessorConfigsInCollectorConf
function, which updates the processor configurations in the collector configuration based on the pipeline processor configuration.- Parameters:
t
(*testing.T): The testing object.
- Returns: None
- Parameters:
TestBuildLogsPipeline
- Purpose: Tests the
buildCollectorPipelineProcessorsList
function, which builds a collector pipeline processors list by combining existing processors with new log parsing processors.- Parameters:
t
(*testing.T): The testing object.
- Returns: None
- Parameters:
TestPipelineAliasCollisionsDontResultInDuplicateCollectorProcessors
- Purpose: Tests that pipeline alias collisions do not result in duplicate collector processors. It generates a collector configuration with pipelines that have the same alias and verifies that the generated configuration contains the expected number of processors.
- Parameters:
t
(*testing.T): The testing object.
- Returns: None
- Parameters:
TestPipelineRouterWorksEvenIfFirstOpIsDisabled
- Purpose: Tests that the pipeline router functions correctly even if the first operator in a pipeline is disabled. It simulates processing logs with a pipeline that has a disabled operator and verifies that the enabled operators are still executed.
- Parameters:
t
(*testing.T): The testing object.
- Returns: None
- Parameters:
TestPipeCharInAliasDoesntBreakCollectorConfig
- Purpose: Tests that the presence of a pipe character (
|
) in a pipeline alias does not break the collector configuration or the processing of logs. It simulates processing logs with a pipeline whose alias contains a pipe character and verifies that the logs are processed correctly.- Parameters:
t
(*testing.T): The testing object.
- Returns: None
- Parameters:
-
Code Examples None
-
Clarity and Accuracy The documentation is based on the code provided.
-
Markdown & MDX Perfection The markdown is properly formatted.
-
Edge Cases To Avoid Breaking MDX No MDX issues.
-
Getting Started Relevance Include in Getting Started: NO