[集群]增加TOA相关设置

This commit is contained in:
刘祥超
2020-12-02 14:26:17 +08:00
parent e477c2584e
commit 806786c76e
7 changed files with 1086 additions and 629 deletions

View File

@@ -0,0 +1,42 @@
package nodeconfigs
import (
"runtime"
"testing"
)
func TestTOAConfig_RandLocalPort(t *testing.T) {
{
toa := &TOAConfig{}
err := toa.Init()
if err != nil {
t.Fatal(err)
}
t.Log(toa.RandLocalPort())
}
{
toa := &TOAConfig{
MinLocalPort: 1,
MaxLocalPort: 2,
}
err := toa.Init()
if err != nil {
t.Fatal(err)
}
t.Log(toa.RandLocalPort())
}
}
func BenchmarkTOAConfig_RandLocalPort(b *testing.B) {
runtime.GOMAXPROCS(1)
toa := &TOAConfig{
MinLocalPort: 1,
MaxLocalPort: 2,
}
_ = toa.Init()
for i := 0; i < b.N; i++ {
_ = toa.RandLocalPort()
}
}