func TestLoggerOpts(t *testing.T) { loader := config.New() loggerOpts := &Opts{} loader.Load(loggerOpts) if loggerOpts.StdoutEnable != true { t.Error("LoggerOpts load error") } if loggerOpts.StdoutLevel != INFO { t.Error("LoggerOpts load error") } if loggerOpts.StderrEnable != false { t.Error("LoggerOpts load error") } if loggerOpts.StderrLevel != ERROR { t.Error("LoggerOpts load error") } if loggerOpts.FileEnable != true { t.Error("LoggerOpts load error") } if loggerOpts.FileLevel != WARNING { t.Error("LoggerOpts load error") } if loggerOpts.FilePath != "tmp/log" { t.Error("LoggerOpts load error") } if loggerOpts.FileSizeLimit != 0 { t.Error("LoggerOpts load error") } if loggerOpts.FileRotateEnable != false { t.Error("LoggerOpts load error") } if loggerOpts.FileRotateLimit != 0 { t.Error("LoggerOpts load error") } }
func TestPolicyOpts(t *testing.T) { loader := config.New() policyOpts := &Opts{} loader.Load(policyOpts) if policyOpts.File != "policy.json" { t.Error("PolicyOpts file error") } if policyOpts.DefaultRule != "default" { t.Error("PolicyOpts default_rule error") } if policyOpts.Dirs[0] != "policy.d" { t.Error("PolicyOpts dirs error") } }
func init() { c := config.New() c.Load(&opts) }