Skip to content

Commit

Permalink
test: real ticker profiling in CI with a long duration (#653)
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind committed Jun 14, 2023
1 parent 513eb10 commit 0581ede
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions profiler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,24 @@ func restoreProfilerTicker() {
}

func TestProfilerCollection(t *testing.T) {
if !isCI() {
t.Run("RealTicker", func(t *testing.T) {
var require = require.New(t)
var goID = getCurrentGoID()
t.Run("RealTicker", func(t *testing.T) {
var require = require.New(t)
var goID = getCurrentGoID()

start := time.Now()
stopFn := startProfiling(start)
start := time.Now()
stopFn := startProfiling(start)
if isCI() {
doWorkFor(5 * time.Second)
} else {
doWorkFor(35 * time.Millisecond)
result := stopFn()
elapsed := time.Since(start)
require.NotNil(result)
require.Greater(result.callerGoID, uint64(0))
require.Equal(goID, result.callerGoID)
validateProfile(t, result.trace, elapsed)
})
}
}
result := stopFn()
elapsed := time.Since(start)
require.NotNil(result)
require.Greater(result.callerGoID, uint64(0))
require.Equal(goID, result.callerGoID)
validateProfile(t, result.trace, elapsed)
})

t.Run("CustomTicker", func(t *testing.T) {
var require = require.New(t)
Expand Down

0 comments on commit 0581ede

Please sign in to comment.