Skip to main content

query_builder_pre_agg_test.go

query_builder_pre_agg_test.go - Overview

  1. Overview This file contains unit tests for the query builder, specifically focusing on scenarios where pre-aggregation is enabled. The tests verify the correctness of generated SQL queries for different combinations of time aggregation, space aggregation, and temporality.

  2. Detailed Documentation

    TestPrepareMetricQueryCumulativeRatePreAgg(t *testing.T)

    • Purpose: Tests the generated query for cumulative metrics with time aggregation set to rate and space aggregation set to sum, with pre-aggregation enabled.
    • Parameters:
      • t: *testing.T - Testing object for running the test case.
    • Returns:
      • None (test function)

    TestPrepareMetricQueryDeltaRatePreAgg(t *testing.T)

    • Purpose: Tests the generated query for delta metrics with time aggregation set to rate and space aggregation set to sum, with pre-aggregation enabled.
    • Parameters:
      • t: *testing.T - Testing object for running the test case.
    • Returns:
      • None (test function)

    TestPrepreMetricQueryCumulativeQuantilePreAgg(t *testing.T)

    • Purpose: Tests the generated query for cumulative metrics with a quantile space aggregation (e.g., percentile 99), with pre-aggregation enabled.
    • Parameters:
      • t: *testing.T - Testing object for running the test case.
    • Returns:
      • None (test function)

    TestPrepreMetricQueryDeltaQuantilePreAgg(t *testing.T)

    • Purpose: Tests the generated query for delta metrics with a quantile space aggregation (e.g., percentile 99), with pre-aggregation enabled.
    • Parameters:
      • t: *testing.T - Testing object for running the test case.
    • Returns:
      • None (test function)

    TestPrepareMetricQueryGaugePreAgg(t *testing.T)

    • Purpose: Tests the generated query for gauge metrics with various aggregation settings, with pre-aggregation enabled.
    • Parameters:
      • t: *testing.T - Testing object for running the test case.
    • Returns:
      • None (test function)
  3. Code Examples

    None

  4. Clarity and Accuracy

    All documented functions are test functions and their purposes are described clearly.

  5. Markdown & MDX Perfection

    The documentation uses proper markdown syntax for headings, lists, and code blocks.

  6. Edge Cases To Avoid Breaking MDX

    • No unescaped special characters.
    • No broken links or images.
    • No raw HTML tags.
    • No HTML comments.
    • No tables.
    • Lists are properly indented.
    • Code blocks and headings are properly closed.
  7. Getting Started Relevance Include in Getting Started: NO