forked from Shopify/kubeaudit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options_test.go
31 lines (24 loc) · 899 Bytes
/
options_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package kubeaudit_test
import (
"testing"
"github.com/Shopify/kubeaudit"
"github.com/Shopify/kubeaudit/auditors/all"
"github.com/Shopify/kubeaudit/config"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestWithLogger(t *testing.T) {
assert := assert.New(t)
allAuditors, err := all.Auditors(config.KubeauditConfig{})
require.NoError(t, err)
formatter := logrus.Formatter(&logrus.JSONFormatter{})
_, err = kubeaudit.New(allAuditors, kubeaudit.WithLogger(formatter))
assert.NoError(err)
assert.Equal(formatter, logrus.StandardLogger().Formatter)
formatter = logrus.Formatter(&logrus.TextFormatter{})
assert.NotEqual(formatter, logrus.StandardLogger().Formatter)
_, err = kubeaudit.New(allAuditors, kubeaudit.WithLogger(formatter))
assert.NoError(err)
assert.Equal(formatter, logrus.StandardLogger().Formatter)
}