1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-20 05:19:40 +02:00
2020-04-16 14:37:45 +02:00

24 lines
476 B
Go

package log
import (
"bytes"
"github.com/stretchr/testify/assert"
"testing"
)
func TestSecrets(t *testing.T) {
t.Run("should log", func(t *testing.T) {
secret := "password"
var buffer bytes.Buffer
Entry().Logger.SetOutput(&buffer)
Entry().Infof("My secret is %s.", secret)
assert.Contains(t, buffer.String(), secret)
buffer.Reset()
RegisterSecret(secret)
Entry().Infof("My secret is %s.", secret)
assert.NotContains(t, buffer.String(), secret)
})
}