mirror of https://github.com/jackc/pgx.git
Add STRESS_FACTOR to stress tests
parent
70f04f227e
commit
e53f739cbd
|
@ -4,6 +4,8 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
"os"
|
||||||
|
"strconv"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -52,13 +54,15 @@ func TestStressConnPool(t *testing.T) {
|
||||||
{"canceledExecContext", canceledExecContext},
|
{"canceledExecContext", canceledExecContext},
|
||||||
}
|
}
|
||||||
|
|
||||||
var actionCount int
|
actionCount := 1000
|
||||||
|
if s := os.Getenv("STRESS_FACTOR"); s != "" {
|
||||||
if testing.Short() {
|
stressFactor, err := strconv.ParseInt(s, 10, 64)
|
||||||
actionCount = 1000
|
if err != nil {
|
||||||
} else {
|
t.Fatalf("failed to parse STRESS_FACTOR: %v", s)
|
||||||
actionCount = 10000
|
|
||||||
}
|
}
|
||||||
|
actionCount *= int(stressFactor)
|
||||||
|
}
|
||||||
|
|
||||||
workerCount := 16
|
workerCount := 16
|
||||||
|
|
||||||
workChan := make(chan int)
|
workChan := make(chan int)
|
||||||
|
|
Loading…
Reference in New Issue