chore: remove redundant transactions from Dashboard (get) sql queries (#89186)
* chore: remove redundant transactions from sql queries * remove unused parameter
This commit is contained in:
@@ -787,7 +787,7 @@ func TestGetExistingDashboardByTitleAndFolder(t *testing.T) {
|
||||
insertTestDashboard(t, dashboardStore, "Apple", 1, 0, "", false)
|
||||
t.Run("Finds a dashboard with existing name in root directory and throws DashboardWithSameNameInFolderExists error", func(t *testing.T) {
|
||||
err = sqlStore.WithDbSession(context.Background(), func(sess *sqlstore.DBSession) error {
|
||||
_, err = getExistingDashboardByTitleAndFolder(sess, &dashboards.Dashboard{Title: "Apple", OrgID: 1}, sqlStore.GetDialect(), false, false)
|
||||
_, err = getExistingDashboardByTitleAndFolder(sess, &dashboards.Dashboard{Title: "Apple", OrgID: 1}, false, false)
|
||||
return err
|
||||
})
|
||||
require.ErrorIs(t, err, dashboards.ErrDashboardWithSameNameInFolderExists)
|
||||
@@ -795,7 +795,7 @@ func TestGetExistingDashboardByTitleAndFolder(t *testing.T) {
|
||||
|
||||
t.Run("Returns no error when dashboard does not exist in root folder", func(t *testing.T) {
|
||||
err = sqlStore.WithDbSession(context.Background(), func(sess *sqlstore.DBSession) error {
|
||||
_, err = getExistingDashboardByTitleAndFolder(sess, &dashboards.Dashboard{Title: "Beta", OrgID: 1}, sqlStore.GetDialect(), false, false)
|
||||
_, err = getExistingDashboardByTitleAndFolder(sess, &dashboards.Dashboard{Title: "Beta", OrgID: 1}, false, false)
|
||||
return err
|
||||
})
|
||||
require.NoError(t, err)
|
||||
@@ -805,7 +805,7 @@ func TestGetExistingDashboardByTitleAndFolder(t *testing.T) {
|
||||
savedFolder := insertTestDashboard(t, dashboardStore, "test dash folder", 1, 0, "", true, "prod", "webapp")
|
||||
savedDash := insertTestDashboard(t, dashboardStore, "test dash", 1, savedFolder.ID, savedFolder.UID, false, "prod", "webapp")
|
||||
err = sqlStore.WithDbSession(context.Background(), func(sess *sqlstore.DBSession) error {
|
||||
_, err = getExistingDashboardByTitleAndFolder(sess, &dashboards.Dashboard{Title: savedDash.Title, FolderUID: savedFolder.UID, OrgID: 1}, sqlStore.GetDialect(), false, false)
|
||||
_, err = getExistingDashboardByTitleAndFolder(sess, &dashboards.Dashboard{Title: savedDash.Title, FolderUID: savedFolder.UID, OrgID: 1}, false, false)
|
||||
return err
|
||||
})
|
||||
require.ErrorIs(t, err, dashboards.ErrDashboardWithSameNameInFolderExists)
|
||||
|
||||
Reference in New Issue
Block a user