Commit 71f40655 by bergquist

tech(alerting): remove comments

parent ecf44d4d
......@@ -64,21 +64,6 @@ func (arr *DefaultRuleReader) Fetch() []*Rule {
}
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.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
}
*/
}
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() {
So(len(alertRule.Notifications), ShouldEqual, 2)
})
/*
Convey("Can read noDataMode", func() {
So(len(alertRule.NoDataMode), ShouldEqual, m.AlertStateCritical)
})
*/
})
})
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment