Update package cmd/promtool tests for new labels.Labels type
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
parent
bf2c827d91
commit
19f300e6f0
|
@ -100,7 +100,7 @@ func TestBackfillRuleIntegration(t *testing.T) {
|
||||||
require.Equal(t, 1, len(gRules))
|
require.Equal(t, 1, len(gRules))
|
||||||
require.Equal(t, "rule1", gRules[0].Name())
|
require.Equal(t, "rule1", gRules[0].Name())
|
||||||
require.Equal(t, "ruleExpr", gRules[0].Query().String())
|
require.Equal(t, "ruleExpr", gRules[0].Query().String())
|
||||||
require.Equal(t, 1, len(gRules[0].Labels()))
|
require.Equal(t, 1, gRules[0].Labels().Len())
|
||||||
|
|
||||||
group2 := ruleImporter.groups[path2+";group2"]
|
group2 := ruleImporter.groups[path2+";group2"]
|
||||||
require.NotNil(t, group2)
|
require.NotNil(t, group2)
|
||||||
|
@ -109,7 +109,7 @@ func TestBackfillRuleIntegration(t *testing.T) {
|
||||||
require.Equal(t, 2, len(g2Rules))
|
require.Equal(t, 2, len(g2Rules))
|
||||||
require.Equal(t, "grp2_rule1", g2Rules[0].Name())
|
require.Equal(t, "grp2_rule1", g2Rules[0].Name())
|
||||||
require.Equal(t, "grp2_rule1_expr", g2Rules[0].Query().String())
|
require.Equal(t, "grp2_rule1_expr", g2Rules[0].Query().String())
|
||||||
require.Equal(t, 0, len(g2Rules[0].Labels()))
|
require.Equal(t, 0, g2Rules[0].Labels().Len())
|
||||||
|
|
||||||
// Backfill all recording rules then check the blocks to confirm the correct data was created.
|
// Backfill all recording rules then check the blocks to confirm the correct data was created.
|
||||||
errs = ruleImporter.importAll(ctx)
|
errs = ruleImporter.importAll(ctx)
|
||||||
|
@ -132,12 +132,12 @@ func TestBackfillRuleIntegration(t *testing.T) {
|
||||||
for selectedSeries.Next() {
|
for selectedSeries.Next() {
|
||||||
seriesCount++
|
seriesCount++
|
||||||
series := selectedSeries.At()
|
series := selectedSeries.At()
|
||||||
if len(series.Labels()) != 3 {
|
if series.Labels().Len() != 3 {
|
||||||
require.Equal(t, 2, len(series.Labels()))
|
require.Equal(t, 2, series.Labels().Len())
|
||||||
x := labels.FromStrings("__name__", "grp2_rule1", "name1", "val1")
|
x := labels.FromStrings("__name__", "grp2_rule1", "name1", "val1")
|
||||||
require.Equal(t, x, series.Labels())
|
require.Equal(t, x, series.Labels())
|
||||||
} else {
|
} else {
|
||||||
require.Equal(t, 3, len(series.Labels()))
|
require.Equal(t, 3, series.Labels().Len())
|
||||||
}
|
}
|
||||||
it := series.Iterator(nil)
|
it := series.Iterator(nil)
|
||||||
for it.Next() == chunkenc.ValFloat {
|
for it.Next() == chunkenc.ValFloat {
|
||||||
|
|
Loading…
Reference in New Issue