mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-02 14:31:53 +08:00
[统计]记录流量(以5分钟作为间隔)
This commit is contained in:
39
internal/db/models/server_daily_stat_dao_test.go
Normal file
39
internal/db/models/server_daily_stat_dao_test.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestServerDailyStatDAO_SaveStats(t *testing.T) {
|
||||
stats := []*pb.ServerDailyStat{
|
||||
{
|
||||
ServerId: 1,
|
||||
RegionId: 2,
|
||||
Bytes: 1,
|
||||
CreatedAt: 1607671488,
|
||||
},
|
||||
}
|
||||
err := NewServerDailyStatDAO().SaveStats(stats)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("ok")
|
||||
}
|
||||
|
||||
func TestServerDailyStatDAO_SaveStats2(t *testing.T) {
|
||||
stats := []*pb.ServerDailyStat{
|
||||
{
|
||||
ServerId: 1,
|
||||
RegionId: 3,
|
||||
Bytes: 1,
|
||||
CreatedAt: 1607671488,
|
||||
},
|
||||
}
|
||||
err := NewServerDailyStatDAO().SaveStats(stats)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("ok")
|
||||
}
|
||||
Reference in New Issue
Block a user