initial import

This commit is contained in:
kevin
2020-07-26 17:09:05 +08:00
commit 7e3a369a8f
647 changed files with 54754 additions and 0 deletions

32
core/trace/noop_test.go Normal file
View File

@@ -0,0 +1,32 @@
package trace
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
)
func TestNoopSpan_Fork(t *testing.T) {
ctx, span := emptyNoopSpan.Fork(context.Background(), "", "")
assert.Equal(t, emptyNoopSpan, span)
assert.Equal(t, context.Background(), ctx)
}
func TestNoopSpan_Follow(t *testing.T) {
ctx, span := emptyNoopSpan.Follow(context.Background(), "", "")
assert.Equal(t, emptyNoopSpan, span)
assert.Equal(t, context.Background(), ctx)
}
func TestNoopSpan(t *testing.T) {
emptyNoopSpan.Visit(func(key, val string) bool {
assert.Fail(t, "should not go here")
return true
})
ctx, span := emptyNoopSpan.Follow(context.Background(), "", "")
assert.Equal(t, context.Background(), ctx)
assert.Equal(t, "", span.TraceId())
assert.Equal(t, "", span.SpanId())
}