From e53f739cbd764fed982e1110ce416ca5c487b38a Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Fri, 3 Mar 2017 15:54:06 -0600 Subject: [PATCH] Add STRESS_FACTOR to stress tests --- stress_test.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/stress_test.go b/stress_test.go index afb5d860..814c8023 100644 --- a/stress_test.go +++ b/stress_test.go @@ -4,6 +4,8 @@ import ( "errors" "fmt" "math/rand" + "os" + "strconv" "testing" "time" @@ -52,13 +54,15 @@ func TestStressConnPool(t *testing.T) { {"canceledExecContext", canceledExecContext}, } - var actionCount int - - if testing.Short() { - actionCount = 1000 - } else { - actionCount = 10000 + actionCount := 1000 + if s := os.Getenv("STRESS_FACTOR"); s != "" { + stressFactor, err := strconv.ParseInt(s, 10, 64) + if err != nil { + t.Fatalf("failed to parse STRESS_FACTOR: %v", s) + } + actionCount *= int(stressFactor) } + workerCount := 16 workChan := make(chan int)