Skip to content

Commit 2b9c00e

Browse files
authored
speedup tests (#21)
* speedup tests * use ForceShort for tests
1 parent 6e1e211 commit 2b9c00e

File tree

6 files changed

+63
-22
lines changed

6 files changed

+63
-22
lines changed

.github/workflows/master.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,4 @@ on:
55
- master
66
jobs:
77
ci:
8-
uses: ThreeDotsLabs/watermill/.github/workflows/tests.yml@master
9-
with:
10-
stress-tests: true
11-
runs-on: ubuntu-latest-8core
8+
uses: ThreeDotsLabs/watermill/.github/workflows/tests.yml@master

.github/workflows/pr.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,3 @@ on:
66
jobs:
77
ci:
88
uses: ThreeDotsLabs/watermill/.github/workflows/tests.yml@master
9-
with:
10-
runs-on: ubuntu-latest-16core

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ up:
44
docker compose up -d
55

66
test:
7-
go test ./... -timeout=20m
7+
go test ./...
88

99
test_v:
1010
go test -v ./...
@@ -13,7 +13,7 @@ test_short:
1313
go test ./... -short
1414

1515
test_race:
16-
go test ./... -short -race -timeout=30m
16+
go test ./... -short -race
1717

1818
test_stress:
1919
STRESS_TEST_COUNT=3 go test -tags=stress -timeout=45m ./...

sns/pubsub_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,27 @@ import (
2323
)
2424

2525
func TestPublishSubscribe(t *testing.T) {
26+
t.Parallel()
27+
2628
tests.TestPubSub(
2729
t,
2830
tests.Features{
2931
ConsumerGroups: true,
3032
ExactlyOnceDelivery: false,
3133
GuaranteedOrder: false,
3234
Persistent: true,
35+
// Currently none of emulators are stable enough to
36+
// handle all tests, see: https://github.com/localstack/localstack/issues/2074
37+
ForceShort: true,
3338
},
3439
createPubSub,
3540
createPubSubWithConsumerGroup,
3641
)
3742
}
3843

3944
func TestPubSub_arn_topic_resolver(t *testing.T) {
45+
t.Parallel()
46+
4047
tests.TestPublishSubscribe(
4148
t,
4249
tests.TestContext{
@@ -50,6 +57,9 @@ func TestPubSub_arn_topic_resolver(t *testing.T) {
5057
GenerateTopicFunc: func(tctx tests.TestContext) string {
5158
return fmt.Sprintf("arn:aws:sns:us-west-2:000000000000:%s", tctx.TestID)
5259
},
60+
// Currently none of emulators are stable enough to
61+
// handle all tests, see: https://github.com/localstack/localstack/issues/2074
62+
ForceShort: true,
5363
},
5464
},
5565
func(t *testing.T) (message.Publisher, message.Subscriber) {
@@ -90,6 +100,8 @@ func TestPubSub_arn_topic_resolver(t *testing.T) {
90100
}
91101

92102
func TestPublisher_CreateTopic_is_idempotent(t *testing.T) {
103+
t.Parallel()
104+
93105
pub, _ := createPubSub(t)
94106

95107
topicName := watermill.NewUUID()
@@ -104,6 +116,8 @@ func TestPublisher_CreateTopic_is_idempotent(t *testing.T) {
104116
}
105117

106118
func TestSubscriber_SubscribeInitialize_is_idempotent(t *testing.T) {
119+
t.Parallel()
120+
107121
_, sub := createPubSub(t)
108122

109123
topicName := watermill.NewUUID()

sqs/pubsub_stress_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//go:build stress
2+
// +build stress
3+
4+
package sqs
5+
6+
func TestPubSub_stress(t *testing.T) {
7+
tests.TestPubSubStressTest(
8+
t,
9+
tests.Features{
10+
ConsumerGroups: false,
11+
ExactlyOnceDelivery: false,
12+
GuaranteedOrder: true,
13+
Persistent: true,
14+
},
15+
createPubSub,
16+
createPubSubWithConsumerGroup,
17+
)
18+
}

sqs/pubsub_test.go

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,34 +21,27 @@ import (
2121
)
2222

2323
func TestPubSub(t *testing.T) {
24-
tests.TestPubSub(
25-
t,
26-
tests.Features{
27-
ConsumerGroups: false,
28-
ExactlyOnceDelivery: false,
29-
GuaranteedOrder: true,
30-
Persistent: true,
31-
},
32-
createPubSub,
33-
createPubSubWithConsumerGroup,
34-
)
35-
}
24+
t.Parallel()
3625

37-
func TestPubSub_stress(t *testing.T) {
38-
tests.TestPubSubStressTest(
26+
tests.TestPubSub(
3927
t,
4028
tests.Features{
4129
ConsumerGroups: false,
4230
ExactlyOnceDelivery: false,
4331
GuaranteedOrder: true,
4432
Persistent: true,
33+
// Currently none of emulators are stable enough to
34+
// handle all tests, see: https://github.com/localstack/localstack/issues/2074
35+
ForceShort: true,
4536
},
4637
createPubSub,
4738
createPubSubWithConsumerGroup,
4839
)
4940
}
5041

5142
func TestPublishSubscribe_with_GenerateQueueUrlResolver(t *testing.T) {
43+
t.Parallel()
44+
5245
tests.TestPublishSubscribe(
5346
t,
5447
tests.TestContext{
@@ -59,6 +52,9 @@ func TestPublishSubscribe_with_GenerateQueueUrlResolver(t *testing.T) {
5952
GuaranteedOrder: true,
6053
GuaranteedOrderWithSingleSubscriber: true,
6154
Persistent: true,
55+
// Currently none of emulators are stable enough to
56+
// handle all tests, see: https://github.com/localstack/localstack/issues/2074
57+
ForceShort: true,
6258
},
6359
},
6460
func(t *testing.T) (message.Publisher, message.Subscriber) {
@@ -112,6 +108,8 @@ func TestPublishSubscribe_with_GenerateQueueUrlResolver(t *testing.T) {
112108
}
113109

114110
func TestPublishSubscribe_with_TransparentUrlResolver(t *testing.T) {
111+
t.Parallel()
112+
115113
tests.TestPublishSubscribe(
116114
t,
117115
tests.TestContext{
@@ -125,6 +123,9 @@ func TestPublishSubscribe_with_TransparentUrlResolver(t *testing.T) {
125123
GenerateTopicFunc: func(tctx tests.TestContext) string {
126124
return fmt.Sprintf("http://sqs.us-west-2.localhost.localstack.cloud:4566/000000000000/%s", tctx.TestID)
127125
},
126+
// Currently none of emulators are stable enough to
127+
// handle all tests, see: https://github.com/localstack/localstack/issues/2074
128+
ForceShort: true,
128129
},
129130
},
130131
func(t *testing.T) (message.Publisher, message.Subscriber) {
@@ -175,6 +176,8 @@ func TestPublishSubscribe_with_TransparentUrlResolver(t *testing.T) {
175176
}
176177

177178
func TestPublishSubscribe_batching(t *testing.T) {
179+
t.Parallel()
180+
178181
tests.TestPublishSubscribe(
179182
t,
180183
tests.TestContext{
@@ -185,6 +188,9 @@ func TestPublishSubscribe_batching(t *testing.T) {
185188
GuaranteedOrder: true,
186189
GuaranteedOrderWithSingleSubscriber: true,
187190
Persistent: true,
191+
// Currently none of emulators are stable enough to
192+
// handle all tests, see: https://github.com/localstack/localstack/issues/2074
193+
ForceShort: true,
188194
},
189195
},
190196
func(t *testing.T) (message.Publisher, message.Subscriber) {
@@ -231,6 +237,8 @@ func TestPublishSubscribe_batching(t *testing.T) {
231237
}
232238

233239
func TestPublishSubscribe_creating_queue_with_different_settings_should_be_idempotent(t *testing.T) {
240+
t.Parallel()
241+
234242
logger := watermill.NewStdLogger(false, false)
235243

236244
sub1, err := sqs.NewSubscriber(sqs.SubscriberConfig{
@@ -264,6 +272,8 @@ func TestPublishSubscribe_creating_queue_with_different_settings_should_be_idemp
264272
}
265273

266274
func TestPublisher_GetOrCreateQueueUrl_is_idempotent(t *testing.T) {
275+
t.Parallel()
276+
267277
pub, _ := createPubSub(t)
268278

269279
topicName := watermill.NewUUID()
@@ -280,6 +290,8 @@ func TestPublisher_GetOrCreateQueueUrl_is_idempotent(t *testing.T) {
280290
}
281291

282292
func TestSubscriber_doesnt_hang_when_queue_doesnt_exist(t *testing.T) {
293+
t.Parallel()
294+
283295
cfg := newAwsConfig(t)
284296

285297
_, sub := createPubSubWithConfig(
@@ -315,6 +327,8 @@ func TestSubscriber_doesnt_hang_when_queue_doesnt_exist(t *testing.T) {
315327
}
316328

317329
func TestPublisher_do_not_create_queue(t *testing.T) {
330+
t.Parallel()
331+
318332
cfg := newAwsConfig(t)
319333

320334
pub, _ := createPubSubWithConfig(

0 commit comments

Comments
 (0)