2021-12-16 06:25:57 +00:00
|
|
|
package history
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
"time"
|
2021-12-16 10:11:34 +00:00
|
|
|
|
|
|
|
"kumoly.io/kumoly/app/util"
|
2021-12-16 06:25:57 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestHistory(t *testing.T) {
|
2021-12-16 10:11:34 +00:00
|
|
|
t.Log("start")
|
|
|
|
Start(func(h *History) {
|
|
|
|
t.Logf("%+v\n", h)
|
|
|
|
})
|
|
|
|
go func() {
|
|
|
|
for {
|
|
|
|
Send(&History{
|
|
|
|
Module: "test",
|
|
|
|
Type: INFO,
|
|
|
|
Message: "testing",
|
|
|
|
Body: time.Now().String(),
|
|
|
|
Caller: util.Caller(2),
|
|
|
|
})
|
|
|
|
time.Sleep(time.Second)
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
|
|
|
time.Sleep(time.Second * 20)
|
|
|
|
Stop()
|
|
|
|
t.Log("stoped")
|
|
|
|
time.Sleep(time.Second * 2)
|
2021-12-16 06:25:57 +00:00
|
|
|
}
|