Enhance stress test performance assertions for CI environments
- Updated the performance assertion for no-op operations in the stress test to account for slower execution times in CI environments, allowing a maximum time of 15ms instead of 5ms. - Added comments to clarify expected performance metrics for local versus CI runs, improving test documentation and understanding.
This commit is contained in:
parent
fab6d19c14
commit
9c7be8401a
1 changed files with 9 additions and 3 deletions
|
|
@ -3,6 +3,7 @@ package context_test
|
|||
import (
|
||||
stdContext "context"
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"sync"
|
||||
"testing"
|
||||
|
|
@ -381,9 +382,14 @@ func TestStressNoOpTracePerformance(t *testing.T) {
|
|||
t.Logf("Start memory: %d MB", startMemory/1024/1024)
|
||||
t.Logf("End memory: %d MB", endMemory/1024/1024)
|
||||
|
||||
// No-op operations should be reasonably fast (< 5ms per iteration)
|
||||
// This includes V8 call overhead, not just the no-op operation itself
|
||||
assert.Less(t, avgTimePerOp, 5*time.Millisecond, "No-op operations should be fast")
|
||||
// No-op operations should be reasonably fast
|
||||
// Note: CI environments may be slower due to resource limits
|
||||
// Local: ~2ms, CI: ~10ms
|
||||
maxTimePerOp := 5 * time.Millisecond
|
||||
if os.Getenv("CI") != "" || os.Getenv("GITHUB_ACTIONS") != "" {
|
||||
maxTimePerOp = 15 * time.Millisecond // More lenient for CI
|
||||
}
|
||||
assert.Less(t, avgTimePerOp, maxTimePerOp, "No-op operations should be fast")
|
||||
|
||||
// No-op operations should not leak memory (< 5MB growth)
|
||||
if endMemory > startMemory {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue