mirror of
https://github.com/prymitive/karma
synced 2026-05-05 03:16:51 +00:00
fix(test): cover log level configuration when running tests
This commit is contained in:
28
main_test.go
Normal file
28
main_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prymitive/unsee/internal/config"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func TestLogConfig(t *testing.T) {
|
||||
logLevels := map[string]log.Level{
|
||||
"debug": log.DebugLevel,
|
||||
"info": log.InfoLevel,
|
||||
"warning": log.WarnLevel,
|
||||
"error": log.ErrorLevel,
|
||||
"fatal": log.FatalLevel,
|
||||
"panic": log.PanicLevel,
|
||||
}
|
||||
|
||||
for val, level := range logLevels {
|
||||
config.Config.Log.Level = val
|
||||
setupLogger()
|
||||
if log.GetLevel() != level {
|
||||
t.Errorf("Config.Log.Level=%s resulted in invalid log level %s", val, log.GetLevel())
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user