Skip to content

Commit e11bda4

Browse files
authored
test: Fix mqinfra test issue with aws sqs long poll (#413)
1 parent 47e2d9b commit e11bda4

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

internal/mqinfra/mqinfra_test.go

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ func testMQInfra(t *testing.T, mqConfig mqs.QueueConfig, dlqConfig mqs.QueueConf
2121
t.Parallel()
2222
t.Cleanup(testinfra.Start(t))
2323

24-
ctx := context.Background()
25-
infra := mqinfra.New(&mqConfig)
26-
require.NoError(t, infra.Declare(ctx))
24+
t.Run("should create queue", func(t *testing.T) {
25+
ctx := context.Background()
26+
infra := mqinfra.New(&mqConfig)
27+
require.NoError(t, infra.Declare(ctx))
2728

28-
t.Cleanup(func() {
29-
require.NoError(t, infra.TearDown(ctx))
30-
})
29+
t.Cleanup(func() {
30+
require.NoError(t, infra.TearDown(ctx))
31+
})
3132

32-
t.Run("should create queue", func(t *testing.T) {
3333
mq := mqs.NewQueue(&mqConfig)
3434
cleanup, err := mq.Init(ctx)
3535
require.NoError(t, err)
@@ -75,6 +75,14 @@ func testMQInfra(t *testing.T, mqConfig mqs.QueueConfig, dlqConfig mqs.QueueConf
7575
// - When the message is nacked, it should be retried 5 times before being sent to the DLQ.
7676
// - Afterwards, reading the DLQ should return the message.
7777
t.Run("should create dlq queue", func(t *testing.T) {
78+
ctx := context.Background()
79+
infra := mqinfra.New(&mqConfig)
80+
require.NoError(t, infra.Declare(ctx))
81+
82+
t.Cleanup(func() {
83+
require.NoError(t, infra.TearDown(ctx))
84+
})
85+
7886
mq := mqs.NewQueue(&mqConfig)
7987
cleanup, err := mq.Init(ctx)
8088
require.NoError(t, err)

0 commit comments

Comments
 (0)