Files
EdgeAPI/internal/db/models/ip_list_dao_test.go

35 lines
540 B
Go
Raw Normal View History

2020-11-07 19:40:24 +08:00
package models
import (
_ "github.com/go-sql-driver/mysql"
"github.com/iwind/TeaGo/dbs"
2020-11-07 19:40:24 +08:00
"runtime"
"testing"
)
func TestIPListDAO_IncreaseVersion(t *testing.T) {
dbs.NotifyReady()
2021-01-10 17:34:35 +08:00
var tx *dbs.Tx
2020-11-07 19:40:24 +08:00
dao := NewIPListDAO()
2021-01-10 17:34:35 +08:00
version, err := dao.IncreaseVersion(tx)
2020-11-07 19:40:24 +08:00
if err != nil {
t.Fatal(err)
}
t.Log("version:", version)
}
func BenchmarkIPListDAO_IncreaseVersion(b *testing.B) {
runtime.GOMAXPROCS(1)
dbs.NotifyReady()
2021-01-10 17:34:35 +08:00
var tx *dbs.Tx
2020-11-07 19:40:24 +08:00
dao := NewIPListDAO()
for i := 0; i < b.N; i++ {
2021-01-10 17:34:35 +08:00
_, _ = dao.IncreaseVersion(tx)
2020-11-07 19:40:24 +08:00
}
}