2020-12-02 20:31:42 +08:00
|
|
|
package configloaders
|
2020-11-20 18:06:54 +08:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
|
|
|
|
"time"
|
2024-07-27 15:42:58 +08:00
|
|
|
|
|
|
|
|
_ "github.com/iwind/TeaGo/bootstrap"
|
2020-11-20 18:06:54 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestLoadSecurityConfig(t *testing.T) {
|
|
|
|
|
for i := 0; i < 10; i++ {
|
|
|
|
|
before := time.Now()
|
|
|
|
|
config, err := LoadSecurityConfig()
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
t.Log(time.Since(before).Seconds()*1000, "ms")
|
|
|
|
|
t.Logf("%p", config)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestLoadSecurityConfig2(t *testing.T) {
|
|
|
|
|
for i := 0; i < 10; i++ {
|
|
|
|
|
config, err := LoadSecurityConfig()
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
if i == 0 {
|
|
|
|
|
config.Frame = "DENY"
|
|
|
|
|
}
|
|
|
|
|
t.Log(config.Frame)
|
|
|
|
|
}
|
|
|
|
|
}
|