mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 06:04:05 -08:00
Merge pull request #8569 from roidelapluie/fix-default-resolution
Fix subqueries with default resolution in promql unit tests
This commit is contained in:
commit
f2fc05fd5f
4
cmd/promtool/testdata/rules.yml
vendored
4
cmd/promtool/testdata/rules.yml
vendored
|
@ -22,3 +22,7 @@ groups:
|
||||||
# A recording rule that doesn't depend on input series.
|
# A recording rule that doesn't depend on input series.
|
||||||
- record: fixed_data
|
- record: fixed_data
|
||||||
expr: 1
|
expr: 1
|
||||||
|
|
||||||
|
# Subquery with default resolution test.
|
||||||
|
- record: suquery_interval_test
|
||||||
|
expr: count_over_time(up[5m:])
|
||||||
|
|
|
@ -157,6 +157,7 @@ func (tg *testGroup) test(evalInterval time.Duration, groupOrderMap map[string]i
|
||||||
return []error{err}
|
return []error{err}
|
||||||
}
|
}
|
||||||
defer suite.Close()
|
defer suite.Close()
|
||||||
|
suite.SubqueryInterval = evalInterval
|
||||||
|
|
||||||
// Load the rule files.
|
// Load the rule files.
|
||||||
opts := &rules.ManagerOptions{
|
opts := &rules.ManagerOptions{
|
||||||
|
|
|
@ -22,8 +22,7 @@ You can use `promtool` to test your rules.
|
||||||
rule_files:
|
rule_files:
|
||||||
[ - <file_name> ]
|
[ - <file_name> ]
|
||||||
|
|
||||||
# optional, default = 1m
|
[ evaluation_interval: <duration> | default = 1m ]
|
||||||
evaluation_interval: <duration>
|
|
||||||
|
|
||||||
# The order in which group names are listed below will be the order of evaluation of
|
# The order in which group names are listed below will be the order of evaluation of
|
||||||
# rule groups (at a given evaluation time). The order is guaranteed only for the groups mentioned below.
|
# rule groups (at a given evaluation time). The order is guaranteed only for the groups mentioned below.
|
||||||
|
|
|
@ -657,7 +657,8 @@ type LazyLoader struct {
|
||||||
|
|
||||||
loadCmd *loadCmd
|
loadCmd *loadCmd
|
||||||
|
|
||||||
storage storage.Storage
|
storage storage.Storage
|
||||||
|
SubqueryInterval time.Duration
|
||||||
|
|
||||||
queryEngine *Engine
|
queryEngine *Engine
|
||||||
context context.Context
|
context context.Context
|
||||||
|
@ -710,11 +711,12 @@ func (ll *LazyLoader) clear() {
|
||||||
ll.storage = teststorage.New(ll)
|
ll.storage = teststorage.New(ll)
|
||||||
|
|
||||||
opts := EngineOpts{
|
opts := EngineOpts{
|
||||||
Logger: nil,
|
Logger: nil,
|
||||||
Reg: nil,
|
Reg: nil,
|
||||||
MaxSamples: 10000,
|
MaxSamples: 10000,
|
||||||
Timeout: 100 * time.Second,
|
Timeout: 100 * time.Second,
|
||||||
EnableAtModifier: true,
|
NoStepSubqueryIntervalFn: func(int64) int64 { return durationMilliseconds(ll.SubqueryInterval) },
|
||||||
|
EnableAtModifier: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
ll.queryEngine = NewEngine(opts)
|
ll.queryEngine = NewEngine(opts)
|
||||||
|
|
Loading…
Reference in a new issue