feat(alerting): fixed build issues

This commit is contained in:
Torkel Ödegaard 2016-09-13 16:24:00 +02:00
parent 3af891d023
commit 8c30babdf1
4 changed files with 14 additions and 20 deletions

View File

@ -44,7 +44,6 @@ func TestAlertRuleExtraction(t *testing.T) {
"handler": 1, "handler": 1,
"enabled": true, "enabled": true,
"frequency": "60s", "frequency": "60s",
"severity": "critical",
"conditions": [ "conditions": [
{ {
"type": "query", "type": "query",
@ -129,11 +128,6 @@ func TestAlertRuleExtraction(t *testing.T) {
So(alerts[1].Handler, ShouldEqual, 0) So(alerts[1].Handler, ShouldEqual, 0)
}) })
Convey("should extract Severity property", func() {
So(alerts[0].Severity, ShouldEqual, "critical")
So(alerts[1].Severity, ShouldEqual, "warning")
})
Convey("should extract frequency in seconds", func() { Convey("should extract frequency in seconds", func() {
So(alerts[0].Frequency, ShouldEqual, 60) So(alerts[0].Frequency, ShouldEqual, 60)
So(alerts[1].Frequency, ShouldEqual, 60) So(alerts[1].Frequency, ShouldEqual, 60)

View File

@ -1,12 +1,8 @@
package notifiers package notifiers
import ( import . "github.com/smartystreets/goconvey/convey"
"testing"
. "github.com/smartystreets/goconvey/convey" func TestBaseNotifier( /* t *testing.T */ ) {
)
func TestBaseNotifier(t *testing.T) {
// Convey("Parsing base notification state", t, func() { // Convey("Parsing base notification state", t, func() {
// //
// Convey("matches", func() { // Convey("matches", func() {

View File

@ -40,6 +40,7 @@ type Item struct {
OrgId int64 `json:"orgId"` OrgId int64 `json:"orgId"`
DashboardId int64 `json:"dashboardId"` DashboardId int64 `json:"dashboardId"`
PanelId int64 `json:"panelId"` PanelId int64 `json:"panelId"`
CategoryId int64 `json:"panelId"`
Type ItemType `json:"type"` Type ItemType `json:"type"`
Title string `json:"title"` Title string `json:"title"`
Text string `json:"text"` Text string `json:"text"`

View File

@ -15,6 +15,7 @@ func addAnnotationMig(mg *Migrator) {
{Name: "user_id", Type: DB_BigInt, Nullable: true}, {Name: "user_id", Type: DB_BigInt, Nullable: true},
{Name: "dashboard_id", Type: DB_BigInt, Nullable: true}, {Name: "dashboard_id", Type: DB_BigInt, Nullable: true},
{Name: "panel_id", Type: DB_BigInt, Nullable: true}, {Name: "panel_id", Type: DB_BigInt, Nullable: true},
{Name: "category_id", Type: DB_BigInt, Nullable: true},
{Name: "type", Type: DB_NVarchar, Length: 25, Nullable: false}, {Name: "type", Type: DB_NVarchar, Length: 25, Nullable: false},
{Name: "title", Type: DB_Text, Nullable: false}, {Name: "title", Type: DB_Text, Nullable: false},
{Name: "text", Type: DB_Text, Nullable: false}, {Name: "text", Type: DB_Text, Nullable: false},
@ -27,18 +28,20 @@ func addAnnotationMig(mg *Migrator) {
Indices: []*Index{ Indices: []*Index{
{Cols: []string{"org_id", "alert_id"}, Type: IndexType}, {Cols: []string{"org_id", "alert_id"}, Type: IndexType},
{Cols: []string{"org_id", "type"}, Type: IndexType}, {Cols: []string{"org_id", "type"}, Type: IndexType},
{Cols: []string{"dashboard_id", "panel_id"}, Type: IndexType}, {Cols: []string{"org_id", "category_id"}, Type: IndexType},
{Cols: []string{"epoch"}, Type: IndexType}, {Cols: []string{"org_id", "dashboard_id", "panel_id", "epoch"}, Type: IndexType},
{Cols: []string{"org_id", "epoch"}, Type: IndexType},
}, },
} }
mg.AddMigration("Drop old annotation table v3", NewDropTableMigration("annotation")) mg.AddMigration("Drop old annotation table v4", NewDropTableMigration("annotation"))
mg.AddMigration("create annotation table v4", NewAddTableMigration(table)) mg.AddMigration("create annotation table v5", NewAddTableMigration(table))
// create indices // create indices
mg.AddMigration("add index annotation org_id & alert_id v3", NewAddIndexMigration(table, table.Indices[0])) mg.AddMigration("add index annotation 0 v3", NewAddIndexMigration(table, table.Indices[0]))
mg.AddMigration("add index annotation org_id & type v3", NewAddIndexMigration(table, table.Indices[1])) mg.AddMigration("add index annotation 1 v3", NewAddIndexMigration(table, table.Indices[1]))
mg.AddMigration("add index annotation dashboard_id panel_id", NewAddIndexMigration(table, table.Indices[2])) mg.AddMigration("add index annotation 2 v3", NewAddIndexMigration(table, table.Indices[2]))
mg.AddMigration("add index annotation epoch v3", NewAddIndexMigration(table, table.Indices[3])) mg.AddMigration("add index annotation 3 v3", NewAddIndexMigration(table, table.Indices[3]))
mg.AddMigration("add index annotation 4 v3", NewAddIndexMigration(table, table.Indices[4]))
} }