1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-04 21:35:23 +02:00

feat(logging): replace all the loggers with zerolog EE-4186 (#7663)

This commit is contained in:
andres-portainer 2022-09-16 13:18:44 -03:00 committed by GitHub
parent 53025178ef
commit 36e7981ab7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
109 changed files with 1101 additions and 662 deletions

View file

@ -1,14 +1,14 @@
package datastore
import (
"log"
"testing"
portainer "github.com/portainer/portainer/api"
"github.com/portainer/portainer/api/database"
"github.com/portainer/portainer/api/filesystem"
"github.com/pkg/errors"
"github.com/portainer/portainer/api/filesystem"
"github.com/rs/zerolog/log"
)
var errTempDir = errors.New("can't create a temp dir")
@ -23,7 +23,8 @@ func MustNewTestStore(t *testing.T, init, secure bool) (bool, *Store, func()) {
if !errors.Is(err, errTempDir) {
teardown()
}
log.Fatal(err)
log.Fatal().Err(err).Msg("")
}
return newStore, store, teardown
@ -46,12 +47,15 @@ func NewTestStore(t *testing.T, init, secure bool) (bool, *Store, func(), error)
if err != nil {
panic(err)
}
store := NewStore(storePath, fileService, connection)
newStore, err := store.Open()
if err != nil {
return newStore, nil, nil, err
}
log.Debug().Msg("opened")
if init {
err = store.Init()
if err != nil {
@ -59,6 +63,8 @@ func NewTestStore(t *testing.T, init, secure bool) (bool, *Store, func(), error)
}
}
log.Debug().Msg("initialised")
if newStore {
// from MigrateData
store.VersionService.StoreDBVersion(portainer.DBVersion)
@ -77,6 +83,6 @@ func NewTestStore(t *testing.T, init, secure bool) (bool, *Store, func(), error)
func teardown(store *Store) {
err := store.Close()
if err != nil {
log.Fatalln(err)
log.Fatal().Err(err).Msg("")
}
}