mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-23 06:50:25 +08:00
只有连续N分钟离线的节点才会发送通知
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package tasks
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
|
||||
"github.com/iwind/TeaGo/dbs"
|
||||
"testing"
|
||||
)
|
||||
@@ -8,10 +9,23 @@ import (
|
||||
func TestNodeMonitorTask_loop(t *testing.T) {
|
||||
dbs.NotifyReady()
|
||||
|
||||
task := NewNodeMonitorTask(60)
|
||||
var task = NewNodeMonitorTask(60)
|
||||
err := task.loop()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("ok")
|
||||
}
|
||||
|
||||
func TestNodeMonitorTask_Monitor(t *testing.T) {
|
||||
dbs.NotifyReady()
|
||||
var task = NewNodeMonitorTask(60)
|
||||
for i := 0; i < 5; i++ {
|
||||
err := task.monitorCluster(&models.NodeCluster{
|
||||
Id: 42,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user