Skip to content

Commit

Permalink
replace
Browse files Browse the repository at this point in the history
  • Loading branch information
smx-Morgan committed Oct 22, 2024
1 parent 4c7ff3e commit 231cdd7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tracer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ func TestServerTracerWorkWithHertz(t *testing.T) {
})

h.POST("/metricPost", func(c context.Context, ctx *app.RequestContext) {
rand.Seed(time.Now().UnixMilli())
seed := time.Now().UnixMilli()
rnd := rand.New(rand.NewSource(seed))
// make sure the response time is greater than 50 milliseconds and less than around 151 milliseconds
time.Sleep(time.Duration(rand.Intn(100)+51) * time.Millisecond)
time.Sleep(time.Duration(rnd.Intn(100)+51) * time.Millisecond)
ctx.String(200, "hello post")
})

Expand Down Expand Up @@ -140,9 +141,10 @@ func TestWithBucketsOption(t *testing.T) {
})

h.POST("/metricPost", func(c context.Context, ctx *app.RequestContext) {
rand.Seed(time.Now().UnixMilli())
seed := time.Now().UnixMilli()
rnd := rand.New(rand.NewSource(seed))
// make sure the response time is greater than 50 milliseconds and less than around 151 milliseconds
time.Sleep(time.Duration(rand.Intn(100)+51) * time.Millisecond)
time.Sleep(time.Duration(rnd.Intn(100)+51) * time.Millisecond)
ctx.String(200, "hello post")
})

Expand Down

0 comments on commit 231cdd7

Please sign in to comment.