time_series_test.go
time_series_test.go - Overview
-
Overview This file contains unit tests for functions that prepare ClickHouse queries for time series data, specifically focusing on delta metrics. It tests the generation of subqueries for time aggregation and the final time series queries with different aggregation types, filters, and group by clauses.
-
Detailed Documentation
Function: TestPrepareTimeAggregationSubQuery
- Purpose: Tests the
prepareTimeAggregationSubQuery
function, which generates a subquery for time aggregation of metrics data. It asserts that the generated query contains the expected SQL clauses based on the providedBuilderQuery
. - Parameters:
t
(*testing.T): Testing object for running test cases.
- Returns: None
Function: TestPrepareTimeseriesQuery
- Purpose: Tests the
PrepareMetricQueryDeltaTimeSeries
function, which prepares the complete time series query for metrics data. It checks if the generated query contains the expected SQL clauses based on the givenBuilderQuery
and different aggregation scenarios. - Parameters:
t
(*testing.T): Testing object for running test cases.
- Returns: None
-
Code Examples None
-
Clarity and Accuracy The code is well-structured and the tests cover various scenarios with different combinations of time aggregation, space aggregation, and filters. The test cases assert that the generated queries contain the expected SQL clauses, ensuring the correct query construction.
-
Markdown & MDX Perfection No issues found.
-
Edge Cases To Avoid Breaking MDX No issues found.
-
Getting Started Relevance Include in Getting Started: NO