Shaman tests: colorise log output on some tests
Easier to read logging when tests fail. I've just done this where I need it, as there is no central place where Flamenco logs are initialised for unit tests.
This commit is contained in:
parent
466abf1387
commit
3f86364fa4
@ -30,8 +30,12 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/mattn/go-colorable"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"projects.blender.org/studio/flamenco/pkg/api"
|
||||
"projects.blender.org/studio/flamenco/pkg/shaman/config"
|
||||
"projects.blender.org/studio/flamenco/pkg/shaman/filestore"
|
||||
@ -39,6 +43,9 @@ import (
|
||||
)
|
||||
|
||||
func createTestManager() (*Manager, func()) {
|
||||
output := zerolog.ConsoleWriter{Out: colorable.NewColorableStdout(), TimeFormat: time.RFC3339}
|
||||
log.Logger = log.Output(output)
|
||||
|
||||
conf, confCleanup := config.CreateTestConfig()
|
||||
fileStore := filestore.New(conf)
|
||||
manager := NewManager(conf, fileStore)
|
||||
|
@ -30,9 +30,12 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/mattn/go-colorable"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"projects.blender.org/studio/flamenco/pkg/shaman/config"
|
||||
"projects.blender.org/studio/flamenco/pkg/shaman/filestore"
|
||||
"projects.blender.org/studio/flamenco/pkg/shaman/jwtauth"
|
||||
@ -40,6 +43,9 @@ import (
|
||||
)
|
||||
|
||||
func createTestShaman() (*Server, func()) {
|
||||
output := zerolog.ConsoleWriter{Out: colorable.NewColorableStdout(), TimeFormat: time.RFC3339}
|
||||
log.Logger = log.Output(output)
|
||||
|
||||
conf, confCleanup := config.CreateTestConfig()
|
||||
shaman := NewServer(conf, jwtauth.AlwaysDeny{})
|
||||
return shaman, confCleanup
|
||||
|
Loading…
x
Reference in New Issue
Block a user