fix: logx test foo (#2144)
constant testlog "Stay hungry, stay foolish." contains foo(foolish), changed to foo1
This commit is contained in:
@@ -50,7 +50,7 @@ func TestTraceError(t *testing.T) {
|
|||||||
otel.SetTracerProvider(tp)
|
otel.SetTracerProvider(tp)
|
||||||
defer otel.SetTracerProvider(otp)
|
defer otel.SetTracerProvider(otp)
|
||||||
|
|
||||||
ctx, span := tp.Tracer("foo").Start(context.Background(), "bar")
|
ctx, span := tp.Tracer("foo1").Start(context.Background(), "bar")
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
var nilCtx context.Context
|
var nilCtx context.Context
|
||||||
@@ -67,9 +67,9 @@ func TestTraceError(t *testing.T) {
|
|||||||
l.WithDuration(time.Second).Errorv(testlog)
|
l.WithDuration(time.Second).Errorv(testlog)
|
||||||
validate(t, w.String(), true, true)
|
validate(t, w.String(), true, true)
|
||||||
w.Reset()
|
w.Reset()
|
||||||
l.WithDuration(time.Second).Errorw(testlog, Field("foo", "bar"))
|
l.WithDuration(time.Second).Errorw(testlog, Field("foo1", "bar"))
|
||||||
validate(t, w.String(), true, true)
|
validate(t, w.String(), true, true)
|
||||||
assert.True(t, strings.Contains(w.String(), "foo"), w.String())
|
assert.True(t, strings.Contains(w.String(), "foo1"), w.String())
|
||||||
assert.True(t, strings.Contains(w.String(), "bar"), w.String())
|
assert.True(t, strings.Contains(w.String(), "bar"), w.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ func TestTraceInfo(t *testing.T) {
|
|||||||
otel.SetTracerProvider(tp)
|
otel.SetTracerProvider(tp)
|
||||||
defer otel.SetTracerProvider(otp)
|
defer otel.SetTracerProvider(otp)
|
||||||
|
|
||||||
ctx, span := tp.Tracer("foo").Start(context.Background(), "bar")
|
ctx, span := tp.Tracer("foo1").Start(context.Background(), "bar")
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
SetLevel(InfoLevel)
|
SetLevel(InfoLevel)
|
||||||
@@ -101,9 +101,9 @@ func TestTraceInfo(t *testing.T) {
|
|||||||
l.WithDuration(time.Second).Infov(testlog)
|
l.WithDuration(time.Second).Infov(testlog)
|
||||||
validate(t, w.String(), true, true)
|
validate(t, w.String(), true, true)
|
||||||
w.Reset()
|
w.Reset()
|
||||||
l.WithDuration(time.Second).Infow(testlog, Field("foo", "bar"))
|
l.WithDuration(time.Second).Infow(testlog, Field("foo1", "bar"))
|
||||||
validate(t, w.String(), true, true)
|
validate(t, w.String(), true, true)
|
||||||
assert.True(t, strings.Contains(w.String(), "foo"), w.String())
|
assert.True(t, strings.Contains(w.String(), "foo1"), w.String())
|
||||||
assert.True(t, strings.Contains(w.String(), "bar"), w.String())
|
assert.True(t, strings.Contains(w.String(), "bar"), w.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ func TestTraceSlow(t *testing.T) {
|
|||||||
otel.SetTracerProvider(tp)
|
otel.SetTracerProvider(tp)
|
||||||
defer otel.SetTracerProvider(otp)
|
defer otel.SetTracerProvider(otp)
|
||||||
|
|
||||||
ctx, span := tp.Tracer("foo").Start(context.Background(), "bar")
|
ctx, span := tp.Tracer("foo1").Start(context.Background(), "bar")
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
l := WithContext(ctx)
|
l := WithContext(ctx)
|
||||||
@@ -168,9 +168,9 @@ func TestTraceSlow(t *testing.T) {
|
|||||||
l.WithDuration(time.Second).Slowv(testlog)
|
l.WithDuration(time.Second).Slowv(testlog)
|
||||||
validate(t, w.String(), true, true)
|
validate(t, w.String(), true, true)
|
||||||
w.Reset()
|
w.Reset()
|
||||||
l.WithDuration(time.Second).Sloww(testlog, Field("foo", "bar"))
|
l.WithDuration(time.Second).Sloww(testlog, Field("foo1", "bar"))
|
||||||
validate(t, w.String(), true, true)
|
validate(t, w.String(), true, true)
|
||||||
assert.True(t, strings.Contains(w.String(), "foo"), w.String())
|
assert.True(t, strings.Contains(w.String(), "foo1"), w.String())
|
||||||
assert.True(t, strings.Contains(w.String(), "bar"), w.String())
|
assert.True(t, strings.Contains(w.String(), "bar"), w.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user