mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-24 12:08:19 +02:00
check level, add test
This commit is contained in:
parent
ce1dc56f49
commit
c33b4dc5f6
2 changed files with 31 additions and 0 deletions
28
internal/autocert/certmagic_logger_test.go
Normal file
28
internal/autocert/certmagic_logger_test.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
package autocert
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
)
|
||||
|
||||
func TestCertMagicLogger(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
encoder := zapcore.NewJSONEncoder(zap.NewProductionEncoderConfig())
|
||||
var buf bytes.Buffer
|
||||
core := zapcore.NewCore(encoder, zapcore.AddSync(&buf), zapcore.DebugLevel)
|
||||
core = certMagicLoggerCore{core: core}
|
||||
|
||||
logger := zap.New(core)
|
||||
|
||||
logger.Info("TEST", zap.Error(errors.New("no OCSP server specified in certificate")))
|
||||
assert.Empty(t, buf.Bytes())
|
||||
|
||||
logger.Info("TEST")
|
||||
assert.NotEmpty(t, buf.Bytes())
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue