Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
fix: test the creating of traceID with customer randomNum func
Browse files Browse the repository at this point in the history
Signed-off-by: guanwenbo <guanwenbostar@163.com>
  • Loading branch information
guanwenbogit committed Dec 23, 2020
1 parent 2cf204f commit 64f845f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -901,11 +901,17 @@ func TestThrottlerDefaultConfig(t *testing.T) {
}

func TestWithRandomNumber(t *testing.T) {
const traceID uint64 = 1

cfg := &Configuration{
ServiceName: "test-random-number",
}
randomNum := func() uint64 { return 1 }
_, closer, err := cfg.NewTracer(WithRandomNumber(randomNum))
randomNum := func() uint64 { return traceID }
tracer, closer, err := cfg.NewTracer(WithRandomNumber(randomNum))
span:=tracer.StartSpan("test-span")
spanCtx := span.Context().(jaeger.SpanContext)

assert.NoError(t, err)
assert.Equal(t, spanCtx.TraceID().Low ,traceID)
defer closeCloser(t, closer)
}

0 comments on commit 64f845f

Please sign in to comment.