Remove folderID from service tests (#80615)

* Remove folderID from service tests

* Remove folderID from ngalert migration tests

* Remove tests related to folderIDs

* Roll back change

Before removing FolderID from this test, we need to adjust the code

* Remove FolderID from publicdashboard pkg

* Add back annotations test
This commit is contained in:
idafurjes
2024-01-26 17:36:35 +02:00
committed by GitHub
parent 04396c001a
commit f44592a97a
13 changed files with 144 additions and 604 deletions
@@ -25,7 +25,7 @@ func testIntegrationGetDashboardVersion(t *testing.T, fn getStore) {
dashVerStore := fn(ss)
t.Run("Get a Dashboard ID and version ID", func(t *testing.T) {
savedDash := insertTestDashboard(t, ss, "test dash 26", 1, 0, "", false, "diff")
savedDash := insertTestDashboard(t, ss, "test dash 26", 1, "", false, "diff")
query := dashver.GetDashboardVersionQuery{
DashboardID: savedDash.ID,
@@ -67,7 +67,7 @@ func testIntegrationGetDashboardVersion(t *testing.T, fn getStore) {
t.Run("Clean up old dashboard versions", func(t *testing.T) {
versionsToWrite := 10
for i := 0; i < versionsToWrite-1; i++ {
insertTestDashboard(t, ss, "test dash 53", 1, int64(i), strconv.Itoa(i), false, "diff-all")
insertTestDashboard(t, ss, "test dash 53"+strconv.Itoa(i), 1, strconv.Itoa(i), false, "diff-all")
}
versionIDsToDelete := []any{1, 2, 3, 4}
res, err := dashVerStore.DeleteBatch(
@@ -79,7 +79,7 @@ func testIntegrationGetDashboardVersion(t *testing.T, fn getStore) {
assert.EqualValues(t, 4, res)
})
savedDash := insertTestDashboard(t, ss, "test dash 43", 1, 0, "", false, "diff-all")
savedDash := insertTestDashboard(t, ss, "test dash 43", 1, "", false, "diff-all")
t.Run("Get all versions for a given Dashboard ID", func(t *testing.T) {
query := dashver.ListDashboardVersionsQuery{
DashboardID: savedDash.ID,
@@ -135,11 +135,10 @@ var (
)
func insertTestDashboard(t *testing.T, sqlStore db.DB, title string, orgId int64,
folderId int64, folderUID string, isFolder bool, tags ...any) *dashboards.Dashboard {
folderUID string, isFolder bool, tags ...any) *dashboards.Dashboard {
t.Helper()
cmd := dashboards.SaveDashboardCommand{
OrgID: orgId,
FolderID: folderId, // nolint:staticcheck
FolderUID: folderUID,
IsFolder: isFolder,
Dashboard: simplejson.NewFromAny(map[string]any{