fix tracelogger_test TestTraceLog (#271)

This commit is contained in:
wayne
2020-12-10 17:04:57 +08:00
committed by GitHub
parent fd73ced6dc
commit ec2a9f2c57

View File

@@ -21,6 +21,7 @@ var mock tracespec.Trace = new(mockTrace)
func TestTraceLog(t *testing.T) {
var buf mockWriter
atomic.StoreUint32(&initialized, 1)
ctx := context.WithValue(context.Background(), tracespec.TracingKey, mock)
WithContext(ctx).(*traceLogger).write(&buf, levelInfo, testlog)
assert.True(t, strings.Contains(buf.String(), mockTraceId))