diff --git a/pkg/rules/remotewrite/wal.go b/pkg/rules/remotewrite/wal.go index 25b91435674..eaf08f99eb9 100644 --- a/pkg/rules/remotewrite/wal.go +++ b/pkg/rules/remotewrite/wal.go @@ -690,5 +690,5 @@ func (r *remoteWriteQueryable) Close() error { } func (r *remoteWriteQueryable) Select(sortSeries bool, hints *storage.SelectHints, matchers ...*labels.Matcher) storage.SeriesSet { - return nil + return storage.EmptySeriesSet() } diff --git a/test/e2e/rule_test.go b/test/e2e/rule_test.go index 90dfc48c1ca..cd14af01688 100644 --- a/test/e2e/rule_test.go +++ b/test/e2e/rule_test.go @@ -74,6 +74,14 @@ groups: severity: page annotations: summary: "I always complain and I have been loaded via /-/reload." +` + testRuleRecordAbsentMetric = ` +groups: +- name: example_record_rules + interval: 1s + rules: + - record: test_absent_metric + expr: absent(nonexistent{job='thanos-receive'}) ` amTimeout = model.Duration(10 * time.Second) ) @@ -388,15 +396,6 @@ func TestRule(t *testing.T) { func TestRule_CanRemoteWriteData(t *testing.T) { t.Parallel() - testRuleRecordAbsentMetric := ` -groups: -- name: example_record_rules - interval: 1s - rules: - - record: test_absent_metric - expr: absent(nonexistent{job='thanos-receive'}) -` - s, err := e2e.NewScenario("e2e_test_rule_remote_write") testutil.Ok(t, err) t.Cleanup(e2ethanos.CleanScenario(t, s)) @@ -407,13 +406,16 @@ groups: rulesSubDir := "rules" rulesPath := filepath.Join(s.SharedDir(), rulesSubDir) testutil.Ok(t, os.MkdirAll(rulesPath, os.ModePerm)) - createRuleFile(t, filepath.Join(rulesPath, "rules-0.yaml"), testRuleRecordAbsentMetric) + + for i, rule := range []string{testRuleRecordAbsentMetric, testAlertRuleWarnOnPartialResponse} { + createRuleFile(t, filepath.Join(rulesPath, fmt.Sprintf("rules-%d.yaml", i)), rule) + } am, err := e2ethanos.NewAlertmanager(s.SharedDir(), "1") testutil.Ok(t, err) testutil.Ok(t, s.StartAndWaitReady(am)) - receiver, err := e2ethanos.NewReceiver(s.SharedDir(), s.NetworkName(), "1", 1) + receiver, err := e2ethanos.NewIngestingReceiver(s.SharedDir(), s.NetworkName()) testutil.Ok(t, err) testutil.Ok(t, s.StartAndWaitReady(receiver)) rwURL := mustURLParse(t, e2ethanos.RemoteWriteEndpoint(receiver.NetworkEndpoint(8081))) @@ -459,7 +461,7 @@ groups: { "__name__": "test_absent_metric", "job": "thanos-receive", - "receive": "1", + "receive": "e2e_test_rule_remote_write", "tenant_id": "default-tenant", }, })