Dashboard tags: add dashboard_uid and org_id (#98500)

This commit is contained in:
Stephanie Hingtgen
2025-01-06 08:58:16 -06:00
committed by GitHub
parent 17ed25e101
commit 7ab2539449
3 changed files with 91 additions and 10 deletions
@@ -213,15 +213,31 @@ func TestIntegrationDashboardDataAccess(t *testing.T) {
assert.Equal(t, len(queryResult), 2)
})
t.Run("Should be able to delete dashboard", func(t *testing.T) {
t.Run("Should be able to delete dashboard and associated tags", func(t *testing.T) {
setup()
dash := insertTestDashboard(t, dashboardStore, "delete me", 1, 0, "", false, "delete this")
err := dashboardStore.DeleteDashboard(context.Background(), &dashboards.DeleteDashboardCommand{
tags, err := dashboardStore.GetDashboardTags(context.Background(), &dashboards.GetDashboardTagsQuery{OrgID: 1})
require.NoError(t, err)
terms := make([]string, len(tags))
for i, tag := range tags {
terms[i] = tag.Term
}
require.Contains(t, terms, "delete this")
err = dashboardStore.DeleteDashboard(context.Background(), &dashboards.DeleteDashboardCommand{
ID: dash.ID,
OrgID: 1,
})
require.NoError(t, err)
tags, err = dashboardStore.GetDashboardTags(context.Background(), &dashboards.GetDashboardTagsQuery{OrgID: 1})
require.NoError(t, err)
terms = make([]string, len(tags))
for i, tag := range tags {
terms[i] = tag.Term
}
require.NotContains(t, terms, "delete this")
})
t.Run("Should be able to create dashboard", func(t *testing.T) {