Skip to content

Commit

Permalink
added ForceShort for test features (#537)
Browse files Browse the repository at this point in the history
  • Loading branch information
roblaszczak authored Jan 13, 2025
1 parent 0e64e21 commit 2a85241
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pubsub/tests/test_pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ type Features struct {

// GenerateTopicFunc overrides standard topic name generation.
GenerateTopicFunc func(tctx TestContext) string

// ForceShort forces running tests in short mode.
// It's useful for Pub/Subs that are slow or have some limitations.
ForceShort bool
}

// RunOnlyFastTests returns true if -short flag was provided -race was not provided.
Expand Down Expand Up @@ -275,7 +279,7 @@ func TestConcurrentSubscribe(
messagesCount := 5000
subscribersCount := 50

if testing.Short() {
if testing.Short() || tCtx.Features.ForceShort {
messagesCount = 100
subscribersCount = 10
}
Expand Down Expand Up @@ -316,7 +320,7 @@ func TestConcurrentSubscribeMultipleTopics(
messagesCount := 100
topicsCount := 20

if testing.Short() {
if testing.Short() || tCtx.Features.ForceShort {
messagesCount = 50
topicsCount = 10
}
Expand Down Expand Up @@ -393,7 +397,7 @@ func TestPublishSubscribeInOrder(
}

messagesCount := 1000
if testing.Short() {
if testing.Short() || tCtx.Features.ForceShort {
messagesCount = 100
}

Expand Down Expand Up @@ -600,7 +604,7 @@ func TestContinueAfterSubscribeClose(

totalMessagesCount := 5000
batches := 5
if testing.Short() {
if testing.Short() || tCtx.Features.ForceShort {
totalMessagesCount = 50
batches = 2
}
Expand Down Expand Up @@ -750,7 +754,7 @@ func TestContinueAfterErrors(
subscribersToNack := 3
nacksPerSubscriber := 100

if testing.Short() {
if testing.Short() || tCtx.Features.ForceShort {
subscribersToNack = 1
nacksPerSubscriber = 5
}
Expand Down Expand Up @@ -837,7 +841,7 @@ func TestPublisherClose(
}

messagesCount := 10000
if testing.Short() {
if testing.Short() || tCtx.Features.ForceShort {
messagesCount = 100
}

Expand Down

0 comments on commit 2a85241

Please sign in to comment.