From 85164cb7a6812bb2e1b7453c033ca1278ca4fe11 Mon Sep 17 00:00:00 2001 From: guanwenbo Date: Mon, 21 Dec 2020 10:05:40 +0800 Subject: [PATCH] fix: modified the bad spelling and added unit test Signed-off-by: guanwenbo --- config/config_test.go | 10 ++++++++++ config/options.go | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/config/config_test.go b/config/config_test.go index adb40dbd..a2eebd1e 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -899,3 +899,13 @@ func TestThrottlerDefaultConfig(t *testing.T) { assert.NoError(t, err) defer closeCloser(t, closer) } + +func TestWithRandomNumber(t *testing.T) { + cfg := &Configuration{ + ServiceName: "test-random-number", + } + randomNum := func() uint64 { return 1 } + _, closer, err := cfg.NewTracer(WithRandomNunmber(randomNum)) + assert.NoError(t, err) + defer closeCloser(t, closer) +} diff --git a/config/options.go b/config/options.go index 27c23777..7fcd2414 100644 --- a/config/options.go +++ b/config/options.go @@ -148,8 +148,8 @@ func Extractor(format interface{}, extractor jaeger.Extractor) Option { } } -// WithRandonNunmber set the Tracer random number func -func WithRandonNunmber(f func() uint64) Option { +// WithRandomNunmber set the Tracer random number func +func WithRandomNunmber(f func() uint64) Option { return func(c *Options) { c.randomNumber = f }