Jelajahi Sumber

test(alerting): fix broken unit tests

bergquist 9 tahun lalu
induk
melakukan
8dbb5bad4b

+ 1 - 1
pkg/models/alerts_test.go

@@ -346,7 +346,7 @@ func TestAlertModel(t *testing.T) {
 			},
 		}
 
-		alerts := *cmd.GetAlertModels()
+		alerts := cmd.GetAlertModels()
 
 		Convey("all properties have been set", func() {
 			So(alerts, ShouldNotBeEmpty)

+ 1 - 1
pkg/services/sqlstore/alert_rule_changes_test.go

@@ -40,7 +40,7 @@ func TestAlertRuleChangesDataAccess(t *testing.T) {
 			}
 
 			cmd := m.SaveAlertsCommand{
-				Alerts:      &items,
+				Alerts:      items,
 				DashboardId: testDash.Id,
 				OrgId:       FakeOrgId,
 				UserId:      2,

+ 5 - 5
pkg/services/sqlstore/alert_rule_test.go

@@ -34,7 +34,7 @@ func TestAlertingDataAccess(t *testing.T) {
 		}
 
 		cmd := m.SaveAlertsCommand{
-			Alerts:      &items,
+			Alerts:      items,
 			DashboardId: testDash.Id,
 			OrgId:       1,
 			UserId:      1,
@@ -80,7 +80,7 @@ func TestAlertingDataAccess(t *testing.T) {
 				DashboardId: testDash.Id,
 				OrgId:       1,
 				UserId:      1,
-				Alerts:      &modifiedItems,
+				Alerts:      modifiedItems,
 			}
 
 			err := SaveAlerts(&modifiedCmd)
@@ -135,7 +135,7 @@ func TestAlertingDataAccess(t *testing.T) {
 				},
 			}
 
-			cmd.Alerts = &multipleItems
+			cmd.Alerts = multipleItems
 			err = SaveAlerts(&cmd)
 
 			Convey("Should save 3 dashboards", func() {
@@ -156,7 +156,7 @@ func TestAlertingDataAccess(t *testing.T) {
 			Convey("should updated two dashboards and delete one", func() {
 				missingOneAlert := multipleItems[:2]
 
-				cmd.Alerts = &missingOneAlert
+				cmd.Alerts = missingOneAlert
 				err = SaveAlerts(&cmd)
 
 				Convey("should delete the missing alert", func() {
@@ -195,7 +195,7 @@ func TestAlertingDataAccess(t *testing.T) {
 			}
 
 			cmd := m.SaveAlertsCommand{
-				Alerts:      &items,
+				Alerts:      items,
 				DashboardId: testDash.Id,
 				OrgId:       1,
 				UserId:      1,

+ 1 - 1
pkg/services/sqlstore/alert_state_test.go

@@ -33,7 +33,7 @@ func TestAlertingStateAccess(t *testing.T) {
 		}
 
 		cmd := m.SaveAlertsCommand{
-			Alerts:      &items,
+			Alerts:      items,
 			DashboardId: testDash.Id,
 			OrgId:       1,
 			UserId:      1,