mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
tech(alerting): remove comments
This commit is contained in:
parent
ecf44d4d9c
commit
71f406558e
@ -64,21 +64,6 @@ func (arr *DefaultRuleReader) Fetch() []*Rule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (arr *DefaultRuleReader) heartbeat() {
|
func (arr *DefaultRuleReader) heartbeat() {
|
||||||
|
|
||||||
//Lets cheat on this until we focus on clustering
|
|
||||||
//log.Info("Heartbeat: Sending heartbeat from " + this.serverId)
|
|
||||||
arr.clusterSize = 1
|
arr.clusterSize = 1
|
||||||
arr.serverPosition = 1
|
arr.serverPosition = 1
|
||||||
|
|
||||||
/*
|
|
||||||
cmd := &m.HeartBeatCommand{ServerId: this.serverId}
|
|
||||||
err := bus.Dispatch(cmd)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
log.Error(1, "Failed to send heartbeat.")
|
|
||||||
} else {
|
|
||||||
this.clusterSize = cmd.Result.ClusterSize
|
|
||||||
this.serverPosition = cmd.Result.UptimePosition
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
@ -1,84 +0,0 @@
|
|||||||
package alerting
|
|
||||||
|
|
||||||
import (
|
|
||||||
//m "github.com/grafana/grafana/pkg/models"
|
|
||||||
. "github.com/smartystreets/goconvey/convey"
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestAlertingScheduler(t *testing.T) {
|
|
||||||
Convey("Testing alert job selection", t, func() {
|
|
||||||
/*
|
|
||||||
mockFn := func() []m.AlertRule {
|
|
||||||
return []m.AlertRule{
|
|
||||||
{Id: 1, Title: "test 1"},
|
|
||||||
{Id: 2, Title: "test 2"},
|
|
||||||
{Id: 3, Title: "test 3"},
|
|
||||||
{Id: 4, Title: "test 4"},
|
|
||||||
{Id: 5, Title: "test 5"},
|
|
||||||
{Id: 6, Title: "test 6"},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Convey("single server", func() {
|
|
||||||
scheduler := &Scheduler{
|
|
||||||
jobs: make(map[int64]*AlertJob, 0),
|
|
||||||
runQueue: make(chan *AlertJob, 1000),
|
|
||||||
serverId: "",
|
|
||||||
serverPosition: 1,
|
|
||||||
clusterSize: 1,
|
|
||||||
}
|
|
||||||
|
|
||||||
scheduler.updateJobs(mockFn)
|
|
||||||
So(len(scheduler.jobs), ShouldEqual, 6)
|
|
||||||
})
|
|
||||||
|
|
||||||
Convey("two servers", func() {
|
|
||||||
scheduler := &Scheduler{
|
|
||||||
jobs: make(map[int64]*AlertJob, 0),
|
|
||||||
runQueue: make(chan *AlertJob, 1000),
|
|
||||||
serverId: "",
|
|
||||||
serverPosition: 1,
|
|
||||||
clusterSize: 2,
|
|
||||||
}
|
|
||||||
|
|
||||||
scheduler.updateJobs(mockFn)
|
|
||||||
So(len(scheduler.jobs), ShouldEqual, 3)
|
|
||||||
So(scheduler.jobs[1].rule.Id, ShouldEqual, 1)
|
|
||||||
})
|
|
||||||
|
|
||||||
Convey("six servers", func() {
|
|
||||||
scheduler := &Scheduler{
|
|
||||||
jobs: make(map[int64]*AlertJob, 0),
|
|
||||||
runQueue: make(chan *AlertJob, 1000),
|
|
||||||
serverId: "",
|
|
||||||
serverPosition: 6,
|
|
||||||
clusterSize: 6,
|
|
||||||
}
|
|
||||||
|
|
||||||
scheduler.updateJobs(mockFn)
|
|
||||||
So(len(scheduler.jobs), ShouldEqual, 1)
|
|
||||||
So(scheduler.jobs[6].rule.Id, ShouldEqual, 6)
|
|
||||||
})
|
|
||||||
|
|
||||||
Convey("more servers then alerts", func() {
|
|
||||||
mockFn := func() []m.AlertRule {
|
|
||||||
return []m.AlertRule{
|
|
||||||
{Id: 1, Title: "test 1"},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
scheduler := &Scheduler{
|
|
||||||
jobs: make(map[int64]*AlertJob, 0),
|
|
||||||
runQueue: make(chan *AlertJob, 1000),
|
|
||||||
serverId: "",
|
|
||||||
serverPosition: 3,
|
|
||||||
clusterSize: 3,
|
|
||||||
}
|
|
||||||
|
|
||||||
scheduler.updateJobs(mockFn)
|
|
||||||
So(len(scheduler.jobs), ShouldEqual, 0)
|
|
||||||
})
|
|
||||||
*/
|
|
||||||
})
|
|
||||||
}
|
|
@ -88,11 +88,6 @@ func TestAlertRuleModel(t *testing.T) {
|
|||||||
Convey("Can read notifications", func() {
|
Convey("Can read notifications", func() {
|
||||||
So(len(alertRule.Notifications), ShouldEqual, 2)
|
So(len(alertRule.Notifications), ShouldEqual, 2)
|
||||||
})
|
})
|
||||||
/*
|
|
||||||
Convey("Can read noDataMode", func() {
|
|
||||||
So(len(alertRule.NoDataMode), ShouldEqual, m.AlertStateCritical)
|
|
||||||
})
|
|
||||||
*/
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user