diff --git a/foundation/database/dbtest/dbtest.go b/foundation/database/dbtest/dbtest.go index 60fb9e0..2a6081a 100644 --- a/foundation/database/dbtest/dbtest.go +++ b/foundation/database/dbtest/dbtest.go @@ -9,6 +9,7 @@ import ( "testing" "time" + "github.com/GLCharge/otelzap" "github.com/jmoiron/sqlx" "github.com/xBlaz3kx/distributed-scheduler/foundation/database" "github.com/xBlaz3kx/distributed-scheduler/foundation/database/dbmigrate" @@ -46,7 +47,7 @@ func StopDB(c *docker.Container) { // Test owns state for running and shutting down tests. type Test struct { DB *sqlx.DB - Log *zap.SugaredLogger + Log *otelzap.Logger Teardown func() t *testing.T } @@ -114,10 +115,10 @@ func NewTest(t *testing.T, c *docker.Container) *Test { var buf bytes.Buffer encoder := zapcore.NewConsoleEncoder(zap.NewDevelopmentEncoderConfig()) writer := bufio.NewWriter(&buf) - log := zap.New( + log := otelzap.New(zap.New( zapcore.NewCore(encoder, zapcore.AddSync(writer), zapcore.DebugLevel), zap.WithCaller(true), - ).Sugar() + )) t.Log("Ready for testing ...") diff --git a/service/job/job_test.go b/service/job/job_test.go index 45c0127..87c4e7e 100644 --- a/service/job/job_test.go +++ b/service/job/job_test.go @@ -3,6 +3,10 @@ package job import ( "context" "fmt" + "runtime/debug" + "testing" + "time" + "github.com/google/go-cmp/cmp" "github.com/google/uuid" "github.com/samber/lo" @@ -11,9 +15,6 @@ import ( "github.com/xBlaz3kx/distributed-scheduler/model" "github.com/xBlaz3kx/distributed-scheduler/store/postgres" "gopkg.in/guregu/null.v4" - "runtime/debug" - "testing" - "time" ) var c *docker.Container @@ -120,7 +121,7 @@ func crud(t *testing.T) { // Get jobs // ------------------------------------------------------------------------- - jobs, err := jobService.ListJobs(ctx, 10, 0) + jobs, err := jobService.ListJobs(ctx, 10, 0, []string{}) if err != nil { t.Fatalf("Should be able to list jobs: %s", err) } @@ -132,7 +133,7 @@ func crud(t *testing.T) { // Get jobs with limit // ------------------------------------------------------------------------- - jobs, err = jobService.ListJobs(ctx, 1, 0) + jobs, err = jobService.ListJobs(ctx, 1, 0, []string{}) if err != nil { t.Fatalf("Should be able to list jobs: %s", err) } diff --git a/store/postgres/helpers.go b/store/postgres/helpers.go index a94a2d7..587e04a 100644 --- a/store/postgres/helpers.go +++ b/store/postgres/helpers.go @@ -2,6 +2,7 @@ package postgres import ( "database/sql" + "github.com/GLCharge/otelzap" "github.com/jmoiron/sqlx" "go.uber.org/zap"