Stats: use dashboard stats rather than list (#99130)

This commit is contained in:
Stephanie Hingtgen
2025-01-16 22:19:56 -07:00
committed by GitHub
parent 5a930e0ec6
commit e019e34eb5
11 changed files with 226 additions and 100 deletions
@@ -61,6 +61,7 @@ func TestIntegrationDashboardDataAccess(t *testing.T) {
savedDash = insertTestDashboard(t, dashboardStore, "test dash 23", 1, savedFolder.ID, savedFolder.UID, false, "prod", "webapp")
insertTestDashboard(t, dashboardStore, "test dash 45", 1, savedFolder.ID, savedFolder.UID, false, "prod")
savedDash2 = insertTestDashboard(t, dashboardStore, "test dash 67", 1, 0, "", false, "prod")
insertTestDashboard(t, dashboardStore, "test dash org2", 2, 0, "", false, "")
insertTestRule(t, sqlStore, savedFolder.OrgID, savedFolder.UID)
}
@@ -81,6 +82,17 @@ func TestIntegrationDashboardDataAccess(t *testing.T) {
require.Positive(t, len(savedFolder.UID))
})
t.Run("Should be able to get dashboard counts per org", func(t *testing.T) {
setup()
count, err := dashboardStore.CountInOrg(context.Background(), 1)
require.NoError(t, err)
require.Equal(t, int64(3), count)
count, err = dashboardStore.CountInOrg(context.Background(), 2)
require.NoError(t, err)
require.Equal(t, int64(1), count)
})
t.Run("Should be able to get dashboard by id", func(t *testing.T) {
setup()
query := dashboards.GetDashboardQuery{