Skip to content

Test suite ideas for instant/range PromQL query paths #590

Description

@milindsrivastava1997

Test suite ideas for the instant-query/range-query pipelines in asap-query-engine/src/engines/simple_engine/{mod,promql}.rs, scoped alongside #589 (catalog of instant/range inconsistencies) and #584/#583/#581/#587.

Differential oracle test

For each (aggregation_type x window_type x single/dual-population x keyed/self-keyed) combination, run an instant query at t and a range query with start=end=t, assert identical output sets. This is the generic test that would have caught #584 without needing a one-off regression case per bug.

N-instants-equal-one-range property test

For a stable key set over [start, end], assert range(start, end, step) equals {instant(t) for t in steps}. Then specifically break the "stable key set" assumption — a label present only in the first half of the range, and one present only in the second half — to pin down #583: assert absence in the un-populated steps, not just a wrong value.

Keys-window-type coverage crossed with range

create_keys_query_params's SetAggregator and DeltaSetAggregator branches are likely only exercised by instant-query tests today. Add the same matrix under range queries.

Sliding-exact-window vs single-step-range parity

A range query covering exactly one Sliding window (step == window size) must equal the instant exact-query result bit-for-bit. Targets the fetch-strategy divergence noted in #589 item 4.

Binary-expr mirrors of every plain-query regression

Top-k self-keyed metric over a range inside a binary expr; dual-population metric with a changing key set combined with itself over a range. The binary-expr path is a separate fork (see #589 item 6), so every plain-query regression test needs a binary-expr counterpart.

Error-path parity

Missing key mid-merge should either fail both instant and range the same way, or the divergence should be an explicit, named, tested behavior (see #589 item 7).

Boundary/validation tests

Model-based test using existing simulation helpers

simulate_sliding_window / simulate_sliding_window_with_alignment (mod.rs:1728+) are already isolated reference oracles used for hand-picked cases — extend them to cover key expansion and use as the oracle for a broader property-based test rather than only fixed cases.

Related: #589, #584, #583, #581, #587.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions