fix(folders): use namespace_uid for alert count (#111773)
This commit is contained in:
@@ -60,7 +60,7 @@ func (s *LegacyStatsGetter) GetStats(ctx context.Context, in *resourcepb.Resourc
|
||||
group := "sql-fallback"
|
||||
|
||||
// Legacy alert rule table
|
||||
err = fn("alert_rule", "org_id=? AND dashboard_uid=?", group, "alertrules", false)
|
||||
err = fn("alert_rule", "org_id=? AND namespace_uid=?", group, "alertrules", false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -78,9 +78,10 @@ func TestIntegrationDirectSQLStats(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
ruleStore := ngalertstore.SetupStoreForTesting(t, db)
|
||||
dashboardUID := "test"
|
||||
_, err = ruleStore.InsertAlertRules(context.Background(), ngmodels.NewUserUID(tempUser), []ngmodels.AlertRule{
|
||||
{
|
||||
DashboardUID: &folder2UID,
|
||||
DashboardUID: &dashboardUID,
|
||||
UID: "test",
|
||||
Title: "test",
|
||||
OrgID: 1,
|
||||
@@ -97,7 +98,7 @@ func TestIntegrationDirectSQLStats(t *testing.T) {
|
||||
},
|
||||
Condition: "ok",
|
||||
Updated: now,
|
||||
NamespaceUID: "test",
|
||||
NamespaceUID: folder2UID,
|
||||
ExecErrState: ngmodels.ExecutionErrorState(ngmodels.Alerting),
|
||||
NoDataState: ngmodels.Alerting,
|
||||
IntervalSeconds: 60,
|
||||
|
||||
Reference in New Issue
Block a user