monitor writes to db

Former-commit-id: 5aa70ad9d835c607abb1c19dc620f6c45d31a866
This commit is contained in:
bel
2019-06-22 14:40:57 -06:00
parent 5e87f1659d
commit 093d468f87
8 changed files with 58 additions and 17 deletions

View File

@@ -23,7 +23,7 @@ func TestMonitorNew(t *testing.T) {
func TestMonitorTrigger(t *testing.T) {
initMonitor()
m := New()
m, _ := New()
i, _ := NewItem("MonitorTrigger", time.Second)
i.setLast(never)
if time.Now().After(i.Last()) {
@@ -46,7 +46,7 @@ func TestMonitorTrigger(t *testing.T) {
func TestMonitorTriggered(t *testing.T) {
initMonitor()
m := New()
m, _ := New()
i, _ := NewItem("MonitorTriggered", time.Second)
i.setLast(time.Now().Add(time.Hour * -1))
m.queue.Push(i)
@@ -64,7 +64,7 @@ func TestMonitorTriggered(t *testing.T) {
func TestMonitorEnqueued(t *testing.T) {
initMonitor()
m := New()
m, _ := New()
m.Incoming = make(chan *Item, 1)
m.Incoming <- &Item{Key: "MonitorEnqueued"}
@@ -81,8 +81,8 @@ func TestMonitorEnqueued(t *testing.T) {
func TestMonitorEnqueue(t *testing.T) {
initMonitor()
m := New()
m.enqueue(nil)
m, _ := New()
m.enqueue(&Item{})
if m.queue.Len() != 1 {
t.Error(m.queue.Len())
@@ -92,7 +92,7 @@ func TestMonitorEnqueue(t *testing.T) {
func TestMonitorRun(t *testing.T) {
initMonitor()
m := New()
m, _ := New()
m.Outgoing = make(chan *Item, 1)
go m.Run()
defer config.Values().Can()