diff --git a/lib/streamaggr/streamaggr_test.go b/lib/streamaggr/streamaggr_test.go index 9bd7b4e3f..28170cb96 100644 --- a/lib/streamaggr/streamaggr_test.go +++ b/lib/streamaggr/streamaggr_test.go @@ -48,6 +48,12 @@ func TestAggregatorsFailure(t *testing.T) { - interval: 1m `) + // Bad interval + f(` +- interval: 1foo + outputs: [total] +`) + // Invalid output f(` - interval: 1m @@ -65,6 +71,13 @@ func TestAggregatorsFailure(t *testing.T) { interval: 10ms `) + // bad dedup_interval + f(` +- interval: 1m + dedup_interval: 1foo + outputs: ["quantiles"] +`) + // interval isn't multiple of dedup_interval f(` - interval: 1m @@ -79,6 +92,27 @@ func TestAggregatorsFailure(t *testing.T) { outputs: ["quantiles"] `) + // bad staleness_interval + f(` +- interval: 1m + staleness_interval: 1foo + outputs: ["quantiles"] +`) + + // staleness_interval should be > interval + f(` +- interval: 1m + staleness_interval: 30s + outputs: ["quantiles"] +`) + + // staleness_interval should be multiple of interval + f(` +- interval: 1m + staleness_interval: 100s + outputs: ["quantiles"] +`) + // keep_metric_names is set for multiple inputs f(` - interval: 1m @@ -873,6 +907,19 @@ foo{abc="123", cde="1"} 4 10 foo:1m_by_cde_rate_sum{cde="1"} 0 `, "11") + // unique_samples output + f(` +- interval: 1m + outputs: [unique_samples] +`, ` +foo 1 10 +foo 2 20 +foo 1 10 +foo 2 20 +foo 3 20 +`, `foo:1m_unique_samples 3 +`, "11111") + // keep_metric_names f(` - interval: 1m