chore(thor): Parallel query engine correctness tests (#20811)

This commit is contained in:
Stas Spiridonov
2026-02-24 16:03:33 -05:00
committed by GitHub
parent 9546636275
commit e768ea8d02
6 changed files with 112 additions and 82 deletions

View File

@@ -21,6 +21,7 @@ import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/prometheus/promql"
"github.com/prometheus/prometheus/promql/parser"
"golang.org/x/sync/errgroup"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -236,11 +237,34 @@ func TestStorageEquality(t *testing.T) {
return
}
actual, err := store.Engine.Query(params).Exec(ctx)
if err != nil && errors.Is(err, engine.ErrNotSupported) {
t.Skipf("Store %s does not support features used in test case %s", store.Name, baseCase.Name())
var (
actual, expected logqlmodel.Result
)
g, ctx := errgroup.WithContext(ctx)
g.Go(func() error {
result, err := store.Engine.Query(params).Exec(ctx)
actual = result
return err
})
g.Go(func() error {
result, err := baseStore.Engine.Query(params).Exec(ctx)
expected = result
return err
})
err = g.Wait()
if err != nil {
if errors.Is(err, engine.ErrNotSupported) {
t.Skipf("Store %s does not support features used in test case %s", store.Name, baseCase.Name())
}
t.Fatal(err)
}
require.NoError(t, err)
t.Logf(`Summary stats: store=%s lines_processed=%d, entries_returned=%d, bytes_processed=%s, execution_time_in_secs=%d, bytes_processed_per_sec=%s`,
store.Name,
actual.Statistics.Summary.TotalLinesProcessed,
@@ -253,8 +277,6 @@ func TestStorageEquality(t *testing.T) {
dataobjStats, _ := json.Marshal(&actual.Statistics.Querier.Store.Dataobj)
t.Log("Dataobj stats:", string(dataobjStats))
expected, err := baseStore.Engine.Query(params).Exec(ctx)
require.NoError(t, err)
t.Logf(`Summary stats: store=%s lines_processed=%d, entries_returned=%d, bytes_processed=%s, execution_time_in_secs=%d, bytes_processed_per_sec=%s`,
baseStore.Name,
expected.Statistics.Summary.TotalLinesProcessed,

View File

@@ -3,59 +3,65 @@
# Basic label selector queries
# These are the fastest queries and run on every test
queries:
- description: "Basic label selector"
query: "${SELECTOR}"
- description: Basic label selector
query: ${SELECTOR}
kind: log
time_range:
length: "24h"
length: 24h
directions: both
tags:
- "baseline"
- "selector"
- baseline
- selector
- description: "Label selector with line filter"
query: '${SELECTOR} |= "level"'
- description: Label selector with line filter
query: ${SELECTOR} |= "level"
time_range:
length: "24h"
length: 24h
directions: both
requires:
keywords: ["level"]
keywords:
- level
tags:
- "line-filter"
- "text-search"
- line-filter
- text-search
- description: "Label selector with regex line filter (case-insensitive)"
query: '${SELECTOR} |~ "(?i)error"'
- description: Label selector with regex line filter (case-insensitive)
query: ${SELECTOR} |~ "(?i)error"
time_range:
length: "24h"
length: 24h
directions: both
requires:
keywords: ["error"]
keywords:
- error
tags:
- "line-filter"
- "regex"
- "case-insensitive"
- line-filter
- regex
- case-insensitive
- description: "Label selector with negative regex filter"
query: '${SELECTOR} !~ "(?i)debug"'
- description: Label selector with negative regex filter
query: ${SELECTOR} !~ "(?i)debug"
time_range:
length: "24h"
length: 24h
directions: both
requires:
keywords: ["debug"]
keywords:
- debug
tags:
- "line-filter"
- "regex"
- "negative-filter"
- line-filter
- regex
- negative-filter
- description: "Label filter expression outside stream selector"
query: '${SELECTOR} | ${LABEL_NAME} = "${LABEL_VALUE}"'
- description: Label filter expression outside stream selector
query: ${SELECTOR} | ${LABEL_NAME} = "${LABEL_VALUE}"
time_range:
length: "24h"
length: 24h
directions: both
requires:
labels: ["env", "region", "cluster"]
labels:
- env
- region
- cluster
tags:
- "line-filter"
- "label-filter"
notes: "Tests indexed label filtering using | label=value syntax. Requires streams with multiple labels."
- line-filter
- label-filter
notes: Tests indexed label filtering using | label=value syntax. Requires streams with multiple labels.

View File

@@ -2,51 +2,54 @@
---
# Simple metric queries for fast testing
queries:
- description: "Count over time"
query: "sum(count_over_time(${SELECTOR}[${RANGE}]))"
- description: Count over time
query: sum(count_over_time(${SELECTOR}[${RANGE}]))
kind: metric
time_range:
length: "24h"
step: "1m"
length: 24h
step: 1m
tags:
- "aggregation"
- "count"
- aggregation
- count
- description: "Count with error/warn filter"
query: 'sum(count_over_time(${SELECTOR} | detected_level=~"error|warn" [${RANGE}]))'
- description: Count with error/warn filter
query: sum(count_over_time(${SELECTOR} | detected_level=~"error|warn" [${RANGE}]))
kind: metric
time_range:
length: "24h"
step: "1m"
length: 24h
step: 1m
requires:
structured_metadata: ["detected_level"]
structured_metadata:
- detected_level
tags:
- "aggregation"
- "count"
- "structured-metadata"
- aggregation
- count
- structured-metadata
- description: "Rate with error/warn filter"
query: 'sum(rate(${SELECTOR} | detected_level=~"error|warn" [${RANGE}]))'
- description: Rate with error/warn filter
query: sum(rate(${SELECTOR} | detected_level=~"error|warn" [${RANGE}]))
kind: metric
time_range:
length: "24h"
step: "1m"
length: 24h
step: 1m
requires:
structured_metadata: ["detected_level"]
structured_metadata:
- detected_level
tags:
- "aggregation"
- "rate"
- "structured-metadata"
- aggregation
- rate
- structured-metadata
- description: "Count with line filter"
query: 'sum(count_over_time(${SELECTOR} |= "level" [${RANGE}]))'
- description: Count with line filter
query: sum(count_over_time(${SELECTOR} |= "level" [${RANGE}]))
kind: metric
time_range:
length: "24h"
step: "1m"
length: 24h
step: 1m
requires:
keywords: ["level"]
keywords:
- level
tags:
- "aggregation"
- "count"
- "line-filter"
- aggregation
- count
- line-filter

View File

@@ -8,7 +8,8 @@ queries:
length: 24h
directions: both
requires:
structured_metadata: ["detected_level"]
structured_metadata:
- detected_level
tags:
- structured-metadata
- filter
@@ -21,7 +22,8 @@ queries:
directions: both
requires:
log_format: logfmt
structured_metadata: ["detected_level"]
structured_metadata:
- detected_level
tags:
- structured-metadata
- logfmt
@@ -35,7 +37,8 @@ queries:
directions: both
requires:
log_format: logfmt
structured_metadata: ["detected_level"]
structured_metadata:
- detected_level
tags:
- structured-metadata
- logfmt
@@ -49,7 +52,8 @@ queries:
directions: both
requires:
log_format: json
structured_metadata: ["detected_level"]
structured_metadata:
- detected_level
tags:
- structured-metadata
- json
@@ -64,7 +68,8 @@ queries:
directions: both
requires:
log_format: json
structured_metadata: ["detected_level"]
structured_metadata:
- detected_level
tags:
- structured-metadata
- json

View File

@@ -43,9 +43,7 @@ queries:
- unwrap
- aggregation
- parser
notes: "Common pattern from drilldown fields tab when analyzing duration metrics
"
notes: Common pattern from drilldown fields tab when analyzing duration metrics
requires:
unwrappable_fields:
- duration
@@ -62,9 +60,7 @@ queries:
- count
- complex
- parser
notes: "Complex drilldown pattern with multiple filters and case-insensitive matching
"
notes: Complex drilldown pattern with multiple filters and case-insensitive matching
requires:
log_format: json
detected_fields:

View File

@@ -51,9 +51,7 @@ queries:
- json
- logfmt
- complex
notes: "Common pattern from Logs Drilldown UI with multiple parsing stages
"
notes: Common pattern from Logs Drilldown UI with multiple parsing stages
- description: Drilldown with failed search and error level
query: ${SELECTOR} | detected_level="error" |~ "(?i)failed"
time_range: