Skip to content

Commit

Permalink
Added dynamic stress test config
Browse files Browse the repository at this point in the history
  • Loading branch information
roblaszczak committed Oct 9, 2021
1 parent 24f7797 commit 1dfc9f8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pubsub/tests/test_pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"os/exec"
"reflect"
"runtime"
"strconv"
"strings"
"sync"
"testing"
Expand Down Expand Up @@ -185,15 +186,20 @@ func runTest(
})
}

var stressTestTestsCount = 5
const defaultStressTestTestsCount = 10

func TestPubSubStressTest(
t *testing.T,
features Features,
pubSubConstructor PubSubConstructor,
consumerGroupPubSubConstructor ConsumerGroupPubSubConstructor,
) {
for i := 0; i < stressTestTestsCount; i++ {
stressTestsCount, _ := strconv.ParseInt(os.Getenv("STRESS_TEST_COUNT"), 10, 64)
if stressTestsCount == 0 {
stressTestsCount = defaultStressTestTestsCount
}

for i := 0; i < int(stressTestsCount); i++ {
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
t.Parallel()
TestPubSub(t, features, pubSubConstructor, consumerGroupPubSubConstructor)
Expand Down

0 comments on commit 1dfc9f8

Please # to comment.