Skip to main content

query_builder_test.go

query_builder_test.go - Overview

  1. Overview This file contains unit tests for the query builder, verifying the correctness of generated SQL queries for various scenarios, including different filter combinations, grouping, temporality, and aggregation types.

  2. Detailed Documentation

    TestPrepareTimeseriesFilterQuery(t *testing.T)

    • Purpose: Tests the PrepareTimeseriesFilterQuery function, verifying the generated time series filter sub-query.
    • Parameters:
      • t: *testing.T - Testing object for running the test case.
    • Returns:
      • None (test function)

    TestPrepareMetricQueryCumulativeRate(t *testing.T)

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

    TestPrepareMetricQueryDeltaRate(t *testing.T)

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

    TestPrepreMetricQueryCumulativeQuantile(t *testing.T)

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

    TestPrepreMetricQueryDeltaQuantile(t *testing.T)

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

    TestPrepareMetricQueryGauge(t *testing.T)

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

    TestPrepareMetricQueryValueTypePanelWithGroupBY(t *testing.T)

    -   **Purpose**: Tests the generated query for value type panel with grouping.
    - **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