mirror of
https://github.com/joohoi/acme-dns.git
synced 2025-07-11 00:07:57 +07:00
Refactoring main.go
This commit is contained in:
25
util_test.go
Normal file
25
util_test.go
Normal file
@ -0,0 +1,25 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSetupLogging(t *testing.T) {
|
||||
for i, test := range []struct {
|
||||
format string
|
||||
level string
|
||||
expected string
|
||||
}{
|
||||
{"text", "warning", "warning"},
|
||||
{"json", "debug", "debug"},
|
||||
{"text", "info", "info"},
|
||||
{"json", "error", "error"},
|
||||
{"text", "something", "warning"},
|
||||
} {
|
||||
setupLogging(test.format, test.level)
|
||||
if log.GetLevel().String() != test.expected {
|
||||
t.Errorf("Test %d: Expected loglevel %s but got %s", i, test.expected, log.GetLevel().String())
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user