Files
argo-cd/gitops-engine/pkg/utils/tracing/logging_test.go
Leonardo Luz Almeida bcc0243f1e prepare repo for migration to ArgoCD repo
Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
2025-09-23 10:05:42 -04:00

29 lines
695 B
Go

package tracing
import (
"testing"
"github.com/go-logr/logr"
"go.uber.org/mock/gomock"
"github.com/argoproj/gitops-engine/pkg/utils/tracing/tracer_testing"
)
func TestLoggingTracer(t *testing.T) {
c := gomock.NewController(t)
l := tracer_testing.NewMockLogSink(c)
gomock.InOrder(
l.EXPECT().Init(gomock.Any()),
l.EXPECT().WithValues("my-key", "my-value").Return(l),
l.EXPECT().WithValues("operation_name", "my-operation", "time_ms", gomock.Any()).Return(l),
l.EXPECT().Enabled(gomock.Any()).Return(true),
l.EXPECT().Info(0, "Trace"),
)
tr := NewLoggingTracer(logr.New(l))
span := tr.StartSpan("my-operation")
span.SetBaggageItem("my-key", "my-value")
span.Finish()
}