Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'workhorse/internal/log/logging_test.go')
-rw-r--r--workhorse/internal/log/logging_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/workhorse/internal/log/logging_test.go b/workhorse/internal/log/logging_test.go
index 1cb6438532e..9daf282daf4 100644
--- a/workhorse/internal/log/logging_test.go
+++ b/workhorse/internal/log/logging_test.go
@@ -7,6 +7,7 @@ import (
"net/http/httptest"
"testing"
+ "github.com/sirupsen/logrus"
"github.com/stretchr/testify/require"
)
@@ -14,6 +15,7 @@ func captureLogs(b *Builder, testFn func()) string {
buf := &bytes.Buffer{}
logger := b.entry.Logger
+ logger.SetLevel(logrus.DebugLevel)
oldOut := logger.Out
logger.Out = buf
defer func() {
@@ -25,6 +27,15 @@ func captureLogs(b *Builder, testFn func()) string {
return buf.String()
}
+func TestLogDebug(t *testing.T) {
+ b := NewBuilder()
+ logLine := captureLogs(b, func() {
+ b.Debug("an observation")
+ })
+
+ require.Regexp(t, `level=debug msg="an observation"`, logLine)
+}
+
func TestLogInfo(t *testing.T) {
b := NewBuilder()
logLine := captureLogs(b, func() {