实现请求日志写入

This commit is contained in:
刘祥超
2020-10-10 11:49:21 +08:00
parent 8a5fa81c5a
commit 8fce802185
13 changed files with 479 additions and 2 deletions

View File

@@ -0,0 +1,30 @@
package models
import (
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
_ "github.com/go-sql-driver/mysql"
_ "github.com/iwind/TeaGo/bootstrap"
"testing"
"time"
)
func TestCreateHTTPAccessLogs(t *testing.T) {
err := NewDBNodeInitializer().loop()
if err != nil {
t.Fatal(err)
}
accessLog := &pb.HTTPAccessLog{
ServerId: 1,
NodeId: 4,
Status: 200,
Timestamp: time.Now().Unix(),
}
dao := randomAccessLogDAO()
t.Log("dao:", dao)
err = CreateHTTPAccessLogsWithDAO(dao, []*pb.HTTPAccessLog{accessLog})
if err != nil {
t.Fatal(err)
}
t.Log("ok")
}